Bicycle Blinker and Brake Light

by jorgez661 in Circuits > LEDs

5516 Views, 42 Favorites, 0 Comments

Bicycle Blinker and Brake Light

2014-08-14 14.42.28.jpg
2014-08-15 14.50.11.jpg
DIY Bike Blinker

Hi everyone! This is my first Instructable! Please provide feedback for me on the comments. I hope you enjoy!

The idea behind this was to modify a cheap bike light into a fully functional blinker and brake light similar to what you would actually see on a car. Typically bicyclists use hand signals to notify drivers that they're turning however there is one major drawback to this. Bike lanes tend to be very narrow so when a cyclist is signaling they have to balance the handlebars with one hand which can be very difficult and extremely Dangerous! Thus the idea for a bike blinker was born.

Features

It makes signaling safer by removing the need to balance the bike with only one hand on the handlebars and by notifying drivers that you are slowing down

Its crazy cheap costing around $15 total but it can be made with even cheaper parts.

Blinker switches are conveniently located in the center of the handlebars with two easy to flip toggle switches.

Brake light button is a tiny tactile switch that feels comfortable and natural to press with your thumb while braking (picture 2)

The light is removable to prevent it from being stolen!

It uses PWM to save battery life

Overall looks nice and doesn't ruin the look of the bike!

Materials

2014-08-14 17.53.48.jpg

These are the materials I used however you can substitute many of these for your own. I ordered materials from Sparkfun.com

Some of these are dirt cheap. I think the most expensive component was the ATtiny85 which ran like $3. Not only that but some of the components you probably have laying around.

1 Bicycle Light
I like this one because it already has yellow and red lights and just needs to be reprogrammed. Additionally its super cheap I actually found one at the 99cents store.

1 ATtiny85

3 1" Protoboards (They come in packs of 2)
I used single sided but I really wish I would've used double

1 on/off switch

2 toggle switches to turn the blinkers on/off (from Radioshack)

1 momentary push button

15' 6 wire Ribbon Cable (might get away with the 3')

2 crimp connectors

2 Shrouded headers

1 (or more) Roll of solid core Hook-up-wire

Tools

Hot Glue gun

Soldering Iron

Drill

Wire strippers

Sticky Bookmark tabs

Wire Cutters

electric tape

solder

Code

attinylabelled.jpg

First off we need to program the ATtiny85. I used this guide http://highlowtech.org/?p=1695

Here is the code I wrote.

//Bike blinker and stop button by Jorge Z.

const int left = 4; //left blinker
const int right = 3; //right blinker
const int stopbutton = 2; //brake light
const int night = 1; //red led lights

int ledState = LOW;
long previousMillis = 0;

long interval = 400;
int buttonState = 0;

void setup(){
pinMode(left, OUTPUT);
pinMode(right, OUTPUT);
pinMode(night, OUTPUT);
pinMode(stopbutton, INPUT);
digitalWrite(stopbutton, HIGH);
}

void loop() {
unsigned long currentMillis = millis(); //this part is the blink without delay example
if(currentMillis - previousMillis > interval)
{
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
digitalWrite(left, ledState);
digitalWrite(right, ledState);
}
buttonState = digitalRead(stopbutton); //this reads the button state of the brake button
if (buttonState == HIGH)
{
analogWrite(night, 30); //this says that when the button is not pushed, the red lights will be dim
}
else
{
analogWrite(night, 255); // when the button is pressed the red lights will go brighter
}
}

Soldering

2014-08-14 13.48.14.jpg

Once the ATtiny85 is programmed you can solder it onto one of the 1" protoboards.

The ones I recommended have pins that are connected every three holes so make sure none of the leads are shorted! Afterwards solder some wires (about 1 foot long) to each of the leads except the reset and the 0 pin.

There are three wires that should be connected to Ground! One will go to the leds, one goes to the negative battery holder terminal (all in a later step), and another will go to a button used for the brake light.

Make sure to label each wire with what it does according to the code. Example one wire on ground and the wire at pin 2 should be labelled "Brake light" each. I used sticky bookmark tabs.

NOTE: the picture in this step is of something else but it can be used as a reference. Make sure to trim the leads after soldering.

Drilling and Cutting

2014-08-08 18.54.17.jpg
2014-08-08 18.42.28.jpg
2014-08-08 18.42.35.jpg

When you open up the assembly you should see a long straight pcb. We need to cut the old controller thing out and replace it with the new one. The controller in this pcb looks like a white circle. Cut only the controller out. This leaves us with two pieces of the pcb. From this point on I will refer to the side with the single LED as the right side.

Next we need to drill a hole through the right side (Note: It may be more convenient to just use the hole on the left side but that would require cutting the board again on the left. Its up to you). This is where the wires will be fed to the handlebars.

Now we need to cut the protoboard with the ATtiny85 to fit on the right side of the assembly as shown in the pictures above. Once you've gotten a nice snug fit push the wires through the freshly drilled hole. Now we can begin attaching wires to the LEDs

Wiring LEDs

2014-08-08 18.43.04.jpg
2014-08-08 18.43.10-1.jpg
2014-08-08 18.43.21.jpg

First notice how the LEDs get power. There are two pads on the PCB that are touching the positive and negative terminals from the batteries. We need to cover those pads up with electric tape since we will be suppling power from the ATtiny85 instead.

Next we need to solder 1 foot 6 inch wires to the positive terminals of the LEDs. Do some testing and you should be able to figure out which end is positive. Notice the red LEDs are connected by parallel paths on the PCB. We can use this to our advantage and just solder one wire to the first leftmost red LED (Yellow wire in picture 1). All grounds were originally connected to the controller before we cut it off so if you use plenty of solder you can make a connection for all the grounds of all the LEDs (Black wire Picture 2). Use one of the ground wires from the ATtiny we attached earlier.

On the leftmost yellow LED there is a path that connects it to the power. We need to break that path as shown in the first picture. Then solder another 1 foot 6 inch wire to the positive terminal of that LED.

Lastly the lonely LED on the right side. Solder a long 1 foot wire to the positive terminal and then solder a short wire from the negative terminal to either the ground on the ATtiny85 or the ground of the other LEDs.

Moving onto the power switch.

Power Switch

2014-08-08 18.43.49.jpg
2014-08-14 13.48.07.jpg

Take another wire from the ground of the ATtiny and attach it to the negative terminal of the battery holder as shown in the first picture.

Next solder one short wire to the positive terminal of the battery holder. I decided to place the power switch on the left side of the assembly where the old button used to be. I used a Dremel to make the hole a little more oval shaped and fit the power switch right in. Next I soldered the wire from the positive terminal of the battery holder (yellow wire in the first picture) to one of the leads on the switch. I attached the wire from the VCC+ on the ATtiny85 to the other lead. Next I held it all together with a hot glue gun. (In the second picture you can kinda see the switch).

Almost done, next step is reassemble.

Ribbon Cable

2014-08-14 13.48.07.jpg
2014-08-14 14.44.44.jpg
2014-08-14 13.48.14.jpg

Push in all components as best as you can, run all 1 foot wires through the hole on the right, and screw the PCB back in place and reassemble. Next we'll attach the ribbon cable.

You should have 6 wires coming out of the assembly.

2 for Right blinker (one from the positive LED terminal and one from the ATtiny)

2 for Left blinker (same as above)

2 for the Brake light (one ATtiny Ground and one from pin 2 on the ATtiny)

Use one of the 1" protoboards and solder on a shrouded header.

Solder the 6 wires onto the protoboard as well. Since each component has two wires associated with it I recommend soldering one cable on the top header row and the other on the bottom row like this

A B C

A B C

where the A's are left blinker cables, B's are brake button, and C's are right blinker

Next attach one of the crimp connectors to the ribbon cable and we now have a removable connection!

Trim the protoboard as much as you like, wrap it in electric tape, and move on!

Controls

2014-08-15 14.33.20.jpg
2014-08-15 14.33.59.jpg
2014-08-15 14.34.50.jpg
2014-08-15 14.49.50.jpg
2014-08-15 14.50.11.jpg
2014-08-15 14.51.21.jpg

Use one more 1" protoboard and solder on another shrouded header. Solder 6 wires onto the protoboard with the middle wires being longer for the brake button and then solder the buttons on the ends of the wires.

EDIT:

After sleeping on some ideas I finally came up with a good layout for the controls. I found the toggle switches with the mini panel at Radioshack and thought they would be perfect for the blinkers (picture 1 and 4). I strapped them onto the reflector with some electrical tape.

The brake light button was a little more difficult. It had to be something that would not force the rider to brake differently. So I grabbed the brakes and pulled as I normally would and realized that my thumb was in the perfect position to press a small tactile switch. Picture 2 illustrates the SMD tactile momentary switch I chose. I fixed it into position by covering it with electrical tape and it worked perfectly (Picture 6)! Not only was it in a perfect spot but it felt completely natural and did not ruin the look of the bike (picture 5).

Overall I'm really happy with how this project came out.

Let me know what you think!

Thanks!