Step 1: Parts List
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
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
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
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
Step 8: Reattach to Bike
Step 9: Custom Battery (optional)
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.