Introduction: Bike Turn Signal & Brake Light Handlebars
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.
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 - I used 12mm ones seen in the picture, and they work awesome.
2x RGB LED's - These need to be common anode to work with my code. I recommend 2, but the number is up to you. You should probably get more just in case.
Resistors - 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 and flexible.
Additionally if you want to waterproof the bars be sure to get some sugru. More on this in Step 7.
Step 2: Basic Circuit
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. There are three things that need to be connected to the arduino: the LEDs, buttons, and battery. The LEDs are hooked up to 5V through a resistor (resistance value depends on your LED) and three signal wires. The buttons will have a 5V, ground (through a resistor, once again the resistance depends on your button), and signal wire. 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 a central ground and 5V wire 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).
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 anode 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 arduino IDE for writing code and programming any arduino can be found HERE. You can grab my program in the word file I have attached to this step and copy paste it into a new arduino sketch. Then, 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 anode 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
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. I planned on having the battery opposite the end of the handlebars with the arduino so you'll also need to measure out lengths of wire the length of the handlebars for the ground and V-in wires.
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.
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.
Double check your circuit schematic with mine and test to make sure it works before moving on.
NOTE: If your arduino micro has headers you may need to desolder them so they will fit inside the bike bars. 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.
Take your handlebars 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. I placed the buttons 4 inches on either side of the center of the handlebars and the LEDs in the end caps.
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 your LED drill bit into your drill and make a hole clean through the center. 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 drill bit or trying a larger bit. Repeat for the other LED.
I recommend putting the bars in a vice. On the spots you've marked on your handlebar, use a hammer to pound a nail to make a small mark that the drill bit can grab. Then fix your button drill bit and drill 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 (2 holes going completely through both sides of the bar). This is because it is extremely difficult to twist a button so it can be pushed through the holes you have drilled.
Use a metal file to smooth the holes drilled in your handlebars. 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
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 first picture).
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.
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 (it's a plastic drywall screw anchor) I found in the basement that fit snugly in the hole and held the button well but screws or other parts should work fine.
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: Waterproofing
When adding bike tape, I found that if you lightly tape over the buttons (so they aren't pressed) then they are completely hidden and are waterproof! Also, with a little sugru you can waterproof the endcaps and LEDs as well! You'll only need one package, so open it up and roll the sugru into a long cylinder. You need four of these rolled segments, two to wrap around the LEDs and two for the end caps. Push your LEDs through the end caps and right at the base where the LED touches the end cap wrap the sugru string around it and smooth it to both surfaces. Next, push the end caps almost completely into the bars, but just enough to wrap sugru between them and the edge of your handlebars. Push the handlebars completely in and smooth the sugru around the outside. Your handle bars are now impenetrable!
Step 8: Reattach to Bike
Now the last step is just to attach the handlebar back to the bike. Also don't worry if you plan on making a custom battery you can insert it once the handlebars are attached to the bike. Try it out! I used a 9V taped to the bars for testing.
Step 9: Custom Battery (optional)
You can skip this step by externally mounting a larger battery, such as a 9V, and just having 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 expensive, 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.
As for battery life, during testing I used an old 9V and it is still working great after 18 hours. Power requirements for the battery is quite low.
Step 10: Enjoy
This is a great learning project with an awesome end product! I hope to see this evolve, I mean once you have two buttons and an arduino in your bike handlebars there's plenty of things you can do from there. Let me know if you have questions or do anything awesome with it!
Second Prize in the
Second Prize in the
Battery Powered Contest
First Prize in the
Bikes and Wheels Contest
markgrecowork made it!
We have a be nice policy.
Please be positive and constructive.
Very good project i'm very interested to do it BUT
the Arduino Micro is DISCONTINUED.
Do you have a solution replace part?