Bike Turn Signal & Brake Light Handlebars
This
project was inspired by a very cool kickstarter called Helios Bars. I
took it up as a DIY challenge! Essentially what this project does is put
an arduino, LEDs, and buttons into your bike handlebars. The LEDs can
be used as turn signals, brake lights, or display ambient colors while
riding. It's fun, cheap, and a good introductory to LEDs and arduino. The coolest thing though is that the project can be completely enclosed in the handlebars and even waterproofed! This
is because the Arduino Micro will fit inside any handlebars with an
inner diameter of 0.7 inches or greater! It is also a cheap project with
a cost of around $30-$40 to buy everything. The best way I can explain
it is by showing it, SO CHECK IT OUT HERE. (I'm having issues with embedding so just try the link for now!)
Step 1: Parts List
To
modify your handlebars this project uses a 'kit', all the pieces of
which can be bought at a place like Radioshack. It's a fairly simple and
cheap project with few components.
Parts:
Arduino Micro - You could also use Arduino Uno or any others, but they would have to be externally mounted to the bike. If you have a choice, get the version of the Micro without headers.
2x Pushbuttons - Any kind will work, you just may have to change a little code. I used the 12mm ones seen in the picture, and they work awesome.
2x (or more) RGB LED's - I recommend 2, but the number is up to you. You should probably get more just in case.
Resistors - Various resistances, these are needed for the pushbuttons and the RGB LED's so they will be specific to what you use. I used four 2k ohm resistors.
Batteries - Anything 6V or greater works but I will discuss this a lot more in the 'Custom Battery' step.
Wire - Lots and preferably thin.
Tools:
Soldering Iron
Drill
Files
Parts:
Arduino Micro - You could also use Arduino Uno or any others, but they would have to be externally mounted to the bike. If you have a choice, get the version of the Micro without headers.
2x Pushbuttons - Any kind will work, you just may have to change a little code. I used the 12mm ones seen in the picture, and they work awesome.
2x (or more) RGB LED's - I recommend 2, but the number is up to you. You should probably get more just in case.
Resistors - Various resistances, these are needed for the pushbuttons and the RGB LED's so they will be specific to what you use. I used four 2k ohm resistors.
Batteries - Anything 6V or greater works but I will discuss this a lot more in the 'Custom Battery' step.
Wire - Lots and preferably thin.
Tools:
Soldering Iron
Drill
Files
Step 2: Basic Circuit
Circuit Description:
So the design of this project boils down to the schematic for the LEDs and the buttons in the pictures. It's much easier to see the circuit from the pictures but I will describe it just to be safe. Basically you have a wire carrying 5V through a resistor (resistance value depends on your LED) and three signal wires going to both LEDs. Then there will be a 5V, ground (through a resistor, once again the resistance depends on your button), and signal wire going to both buttons. You will also need V-in and ground wires connecting your battery to the arduino. That's the extent of the circuit! To keep things simple I used central ground and 5V wires that ran the whole length of the bar so I could solder all the components onto them wherever they were needed (I used this ground wire to connect the battery as well).
Extra Info:
Once you have all your parts I recommend breadboarding your components into the circuit to do some testing and make sure the program runs properly. Note that the way to hook up your RGB LEDs may be different depending on what kind you have (I have common cathode RGBs). I control the RGBs using the PWM pins on the arduino so be sure you hook up the LEDs to the exact same pins I do (you can use other PWM pins but you will have to modify the code). Once you have it set up then you are ready to test it with my program, or your own!
So the design of this project boils down to the schematic for the LEDs and the buttons in the pictures. It's much easier to see the circuit from the pictures but I will describe it just to be safe. Basically you have a wire carrying 5V through a resistor (resistance value depends on your LED) and three signal wires going to both LEDs. Then there will be a 5V, ground (through a resistor, once again the resistance depends on your button), and signal wire going to both buttons. You will also need V-in and ground wires connecting your battery to the arduino. That's the extent of the circuit! To keep things simple I used central ground and 5V wires that ran the whole length of the bar so I could solder all the components onto them wherever they were needed (I used this ground wire to connect the battery as well).
Extra Info:
Once you have all your parts I recommend breadboarding your components into the circuit to do some testing and make sure the program runs properly. Note that the way to hook up your RGB LEDs may be different depending on what kind you have (I have common cathode RGBs). I control the RGBs using the PWM pins on the arduino so be sure you hook up the LEDs to the exact same pins I do (you can use other PWM pins but you will have to modify the code). Once you have it set up then you are ready to test it with my program, or your own!
Step 3: Program
The IDE for writing code and programming any arduino can be found HERE.
You can grab my program in the word file I have attached and copy paste
it into a new arduino sketch. Unfortunately I couldn't upload the
arduino file. Just connect the arduino micro using a Micro B/USB cable
to your computer and click the upload button on the arduino program. If
you are having trouble uploading or don't know how try HERE or HERE.
NOTE: if you don't have common cathode RGB LEDs then you will have to modify my code. Try switching the values for the variables off and on and it should work.
NOTE: if you don't have common cathode RGB LEDs then you will have to modify my code. Try switching the values for the variables off and on and it should work.
Step 4: Soldering the Components
NOTE: Try
this project with just 2 LEDs in the endcaps first, having 4 or more
proved very difficult to wire and looked challenging to get inside the
handlebars to position well. It is also easy to add more onto your
existing circuit later.
Laying Out Circuit:
When soldering your circuit make sure you leave a little extra wire length for the LEDs and arduino, for the buttons though , the wire distance between them must be EXACTLY the same as the distance between their mounting holes (or quite close). It is very difficult to push the wire together of it is too long. I can't help you with exact lengths of wire because depending on LED placement, number of LEDs, handlebar shape, and button placement, the lengths of wire used change dramatically. I recommend pushing just one wire through certain sections of the bars to find exact lengths of wire.
Cleaning Up Wiring:
To keep the wiring clean I would twist certain sections together, such as the three signal wires for the LEDs or the 2 signal wires for the buttons. I then took these 4 or so braided wires and arranged them how they should be to attach to component and taped them all together every 6 inches or so. I also laid out all the components to keep myself from getting confused. This kept things as clean and organized as possible.
Soldering:
Next I soldered the wires to my components, leaving the arduino for last. Use plenty of solder to ensure strong, durable connections. After soldering make sure to wrap all exposed solder joints and metal with electrical tape or something similar to prevent accidental circuit changes/shorts.
Testing:
Just make sure to double check your circuit schematic with mine and test it afterwards to make sure it works. I planned on having the battery near one end of the handlebars and the arduino micro near the end of the other to keep them separated and safe and this is shown in the circuit. You may need to make changes if you aren't doing the same.
NOTE: If your arduino micro has headers you may need to desolder them so they will fit inside the bike bars, if you don't wish to have them mounted inside the handlebars, then you can leave the headers on. An awesome guide for desoldering can be found HERE.
Laying Out Circuit:
When soldering your circuit make sure you leave a little extra wire length for the LEDs and arduino, for the buttons though , the wire distance between them must be EXACTLY the same as the distance between their mounting holes (or quite close). It is very difficult to push the wire together of it is too long. I can't help you with exact lengths of wire because depending on LED placement, number of LEDs, handlebar shape, and button placement, the lengths of wire used change dramatically. I recommend pushing just one wire through certain sections of the bars to find exact lengths of wire.
Cleaning Up Wiring:
To keep the wiring clean I would twist certain sections together, such as the three signal wires for the LEDs or the 2 signal wires for the buttons. I then took these 4 or so braided wires and arranged them how they should be to attach to component and taped them all together every 6 inches or so. I also laid out all the components to keep myself from getting confused. This kept things as clean and organized as possible.
Soldering:
Next I soldered the wires to my components, leaving the arduino for last. Use plenty of solder to ensure strong, durable connections. After soldering make sure to wrap all exposed solder joints and metal with electrical tape or something similar to prevent accidental circuit changes/shorts.
Testing:
Just make sure to double check your circuit schematic with mine and test it afterwards to make sure it works. I planned on having the battery near one end of the handlebars and the arduino micro near the end of the other to keep them separated and safe and this is shown in the circuit. You may need to make changes if you aren't doing the same.
NOTE: If your arduino micro has headers you may need to desolder them so they will fit inside the bike bars, if you don't wish to have them mounted inside the handlebars, then you can leave the headers on. An awesome guide for desoldering can be found HERE.
Step 5: Preparing the Handlebars
This step seems long but really you are only drilling holes in your handlebars and endcaps.
Removing Handlebars:
You are going to need to pick your handlebars for this project. The first step is to take them off your bike by undoing the allen screw(s) holding them in place at the top of the fork. There are many possibly ways they could be attached so I'll let you figure that out. Next, remove your handlebar grips/tape and brakes. After you have the bar completely off and bare, remove the end caps by prying with a screw driver.
Next use a marker and plot where you want to make holes for the LEDs and buttons. You only have to make holes in the handlebars for the buttons if you are putting the LEDs in the endcaps of your handlebars.
Drilling Endcaps:
Now you will need to find two drill bits. One that is the size of the LED "bulb" and another the size of the button part of your pushbutton. First take your end caps and use a clamp to hold them in place. Fix you LED drill bit into your drill and make a hole cleanly through the whole way. Test to see if your LED is able to protrude from the outside end so will be visible when mounted. If not widen the hole by wiggling the bit or trying a larger bit. Repeat for other LED. If you are adding additional LEDs in the handlebar drill those holes now too.
Drilling Handlebars:
After this you only have left to drill the holes for your pushbutton. I recommend putting the bars in a vice. On the spots you've marked on your handlebar use a hammer to pound a nail on each of these spots to make a small mark that the drill bit can grab. Then fix your button drill bit and drill in each of the holes. You will also need to make another hole on the back part of the handlebar for each hole you just drilled (so you will have a hole going completely through both sides of the bar). This allows you to push from the back of the button and stick something in to keep the button pressed up against the handlebar so it can be clicked without falling back into the bar. I recommend doing 4 holes in the same spot, so 2 holes go completely through both sides of the bar, this is because it is very difficult to twist the button to a button to a better orientation once inside the bar making mounting tough.
Finishing Touches:
For all the holes in your handlebars you will want to file the outside and if you have a de-burring tool or a small file then use those to smooth the inside of the holes as well.
Removing Handlebars:
You are going to need to pick your handlebars for this project. The first step is to take them off your bike by undoing the allen screw(s) holding them in place at the top of the fork. There are many possibly ways they could be attached so I'll let you figure that out. Next, remove your handlebar grips/tape and brakes. After you have the bar completely off and bare, remove the end caps by prying with a screw driver.
Next use a marker and plot where you want to make holes for the LEDs and buttons. You only have to make holes in the handlebars for the buttons if you are putting the LEDs in the endcaps of your handlebars.
Drilling Endcaps:
Now you will need to find two drill bits. One that is the size of the LED "bulb" and another the size of the button part of your pushbutton. First take your end caps and use a clamp to hold them in place. Fix you LED drill bit into your drill and make a hole cleanly through the whole way. Test to see if your LED is able to protrude from the outside end so will be visible when mounted. If not widen the hole by wiggling the bit or trying a larger bit. Repeat for other LED. If you are adding additional LEDs in the handlebar drill those holes now too.
Drilling Handlebars:
After this you only have left to drill the holes for your pushbutton. I recommend putting the bars in a vice. On the spots you've marked on your handlebar use a hammer to pound a nail on each of these spots to make a small mark that the drill bit can grab. Then fix your button drill bit and drill in each of the holes. You will also need to make another hole on the back part of the handlebar for each hole you just drilled (so you will have a hole going completely through both sides of the bar). This allows you to push from the back of the button and stick something in to keep the button pressed up against the handlebar so it can be clicked without falling back into the bar. I recommend doing 4 holes in the same spot, so 2 holes go completely through both sides of the bar, this is because it is very difficult to twist the button to a button to a better orientation once inside the bar making mounting tough.
Finishing Touches:
For all the holes in your handlebars you will want to file the outside and if you have a de-burring tool or a small file then use those to smooth the inside of the holes as well.
Step 6: Assembly
Helper Wires:
You are ready to assemble the device! To make it as easy as possible I used what I call 'helper wires' which are just one strand of wire that I pulled through a section of the handlebar. I used three: one from the end of the tube to the right button, one from the right to the left buttons, and a third from the left button out to the other side of the tube (see pic if confused).
Assembly:
I would tie the helper wire to the V-in and ground wires of my circuit since they were longest and put tape over the knot to reduce the chance it snagged on something. Then I would slowly pull the helper wire and push in the part of my circuit entering the handlebar so the long circuit would slowly inch its way into the handlebars. Once the helper wire pulled out the right button hole I would untie it and attach the next helper wire to the V-in and ground wires again, repeating the process until the circuit was completely through the handlebars. Be careful to not tug or push too hard if it isn't moving, it might be caught on the inside burs of one of the holes. Look into the holes and if you see wires near them take a paperclip or wire and poke them away from the opening before pulling again.
Securing Buttons:
Once you have it completely through line up the buttons with their holes. You will need to find something that you can stick in the back side (opposite the hole that the button part of the pushbutton will stick through) to secure the button so it won't fall back into the handlebars when pushed. I used a tapered plastic piece (not sure what it goes too...) I found in the basement that fit snugly in the hole and held the button well.
Don't worry if you need to take out and re-insert the circuit into the handlebars a few times to readjust things, it doesn't take too long and my circuit worked fine even after several times of pushing and pulling on it.
You are ready to assemble the device! To make it as easy as possible I used what I call 'helper wires' which are just one strand of wire that I pulled through a section of the handlebar. I used three: one from the end of the tube to the right button, one from the right to the left buttons, and a third from the left button out to the other side of the tube (see pic if confused).
Assembly:
I would tie the helper wire to the V-in and ground wires of my circuit since they were longest and put tape over the knot to reduce the chance it snagged on something. Then I would slowly pull the helper wire and push in the part of my circuit entering the handlebar so the long circuit would slowly inch its way into the handlebars. Once the helper wire pulled out the right button hole I would untie it and attach the next helper wire to the V-in and ground wires again, repeating the process until the circuit was completely through the handlebars. Be careful to not tug or push too hard if it isn't moving, it might be caught on the inside burs of one of the holes. Look into the holes and if you see wires near them take a paperclip or wire and poke them away from the opening before pulling again.
Securing Buttons:
Once you have it completely through line up the buttons with their holes. You will need to find something that you can stick in the back side (opposite the hole that the button part of the pushbutton will stick through) to secure the button so it won't fall back into the handlebars when pushed. I used a tapered plastic piece (not sure what it goes too...) I found in the basement that fit snugly in the hole and held the button well.
Don't worry if you need to take out and re-insert the circuit into the handlebars a few times to readjust things, it doesn't take too long and my circuit worked fine even after several times of pushing and pulling on it.
Step 7: Reattach to Bike
Now
the last step is just to attach the handlebar back to the bike. Be sure
to reattach brakes and grips/tape if desired. I found that if you
lightly tape over the buttons so they aren't pressed then they are
completely hidden and are waterproof! To waterproof the rest of the
design you can use some tape/hot glue/sugru between the LED and end
caps. Also don't worry if you plan on making a custom battery you can
insert it once attached to the bike. Try it out! I used a 9V taped to
the bars for testing.
Step 8: Custom Battery (optional)
You can skip this
by externally mounting a larger battery, such as a 9V, and just having
you V-in and ground wires attached outside of the handlebars. To make
this project completely fit inside the handlebars you will need to make a
skinny battery pack! The largest battery that I found would fit with
wires is AAs.Originally I decided I would use 6 rechargeable AAs
soldered in a line with little pieces of wire between each battery so it
could flex, but I decided that would be too difficult and so I just
used rechargeable coin cells instead. Feel free to make whatever works
best for you, it just has to be 6V or more.
Connecting the Battery:
Connect the negative (-) terminal of the battery to your ground wire and the positive (+) terminal of the battery to your V-in wire. Then just stuff the wires and batteries down the handle and plug it back up. If you have questions let me know.
Battery Life:
As for battery life, during testing I used an old 9V (far from full charge but I don't have actual readings) and it is still working perfectly fine after 4-5 hours so power requirements for the battery is quite low.
Connecting the Battery:
Connect the negative (-) terminal of the battery to your ground wire and the positive (+) terminal of the battery to your V-in wire. Then just stuff the wires and batteries down the handle and plug it back up. If you have questions let me know.
Battery Life:
As for battery life, during testing I used an old 9V (far from full charge but I don't have actual readings) and it is still working perfectly fine after 4-5 hours so power requirements for the battery is quite low.
It is a nice arrangement to be done in a cycles...i really like to do it in my own bicycle
ReplyDelete