Bicycle handle bar end caps keep the bicycle handlebar tape from unraveling. This LED blinky will do that, and blinks Red, Green, and Blue. Provision is made to reprogram the light sequence or add color mixing. There is no circuit board. The microcontroller is an 8 pin DIP ATtiny85. Each bar end cap blinky is powered by 3ea. LR44 batteries. The circuit is designed to sleep or wake by pressing the LED; during sleep, power consumption is only 0.6 uA.
Step 1: Materials
Step 2: Construction
Print the plastic parts, remove any flashing, and file or sand as required. The compartment for the switch (smaller) and compartment for the ATtiny85 (slightly longer) should both slide easily into the top cap. Glue the back housing of the pushbutton to the bulkhead of the switch compartment after first soldering two 1" long wires onto the switch contacts. Prepare the leads of the RGB LED to fit into the slotted button pusher piece (see photo). The leads should come out of the slot almost flush with the outside diameter. Solder surface mount resistors to the leads at 90 degrees so the resistors almost fit flush with the pusher diameter. Note the resistor value varies with each R, G, or B anode to maintain the same perceived brightness, see materials. Solder four 1" long wires (R,G,B, and ground) to the resistors and common. Glue the LED into the pusher. The pusher does not need to be glued to the button.
Refer to the wiring diagram and solder RGB, grounds, and pushbutton wire to the top of the ATtiny85 pins, therefore preserving the lower part of the pins so they can fit into a programmer socket if reprogramming is later desired. Drill a small hole in the ATtiny bulkhead near the outer diameter for the battery positive connection. Connect a wire to ATtiny Vcc and pass it through the hole, and solder a narrow copper ring which is then glued to the outer side of the ATtiny bulkhead. From the ATtiny, also connect a wire from ground through the center bulkhead hole, and solder to a small circle of copper and glue to the center of the bulkhead so it will contact the battery negative (negative is the top contact of the LR44 type batteries).
Program the ATtiny85 with the Arduino program. I used the USBtinyISP programmer, about $10. on Amazon.com. I wired a programming socket with header pins for the ATtiny on a bit of perfboard. Add ATtiny boards support to the Arduino IDE to enable programming of the ATtiny with the USBtinyISP programmer. My ATtiny85 is set to a 1Mhz internal clock to save a bit of power. Note that when reprogramming, remove the ground wire lead of the ATtiny otherwise the LED circuit will draw power and disrupt program download.
Complete the battery holder by cutting a 5/32 brass rod 1/8" long and soldering a wire to the end. Place the wire in the compartment recess, and glue in place. Strip the top portion of this wire and make a loop of bare wire. Glue it to the perimeter of the battery holder just above the threads.
Add three LR44 batteries to the battery holder, + (the outer case and bottom of the cell) should be touching the brass contact. When the battery holder is screwed into the top cap, power is connected to the ATtiny. No on/off switch is needed, since sleep current is only 0.6 uA.
Step 3: Completed Blinky
You can change the number of times the LED blinks by changing the count number in the code. You could add color blending, I think there are examples already available on the internet. You could use the pushbutton to select different color changing patterns.
Future improvements would include using a a surface mount ATtiny85 instead of the DIP style, and making a small pcb with pads for reprogramming. Possibly the circuit board could then be located between the LED and the pushbutton, thus saving wiring and making a cleaner project.