In school this year, I have a pretty late schedule. Sometimes i'll be coming home from class after
sundown and with a bike that can be dangerous. Before purchasing a commercial bike light, I decided to see if I could make one myself. Using an IKEA lamp I found at goodwill (for $2) I figured I could make a pretty unique, environmentally friendly bike light. The lamp that I will show in this instructable can be found here. It uses a solar panel and re-chargable batteries which provides 3.6 volts to light several LEDs. The solar panel takes about 9 hours to charge and can provide 3 hours of light. I thought those specs were perfect for embedding a microcontroller (such as an attiny) to make a stylish bike light. Here are some features of the complete bike light:
-about 3 hour battery life
-extra bright with 4 LEDs
-8 different LED animations (selectable via a push button)
This project is great for students, bikers, makers, and anyone who enjoys tinkering with electronics! And best of all it is not expensive to make. The parts list won't set you back more than $3 (assuming you already own the lamp). However, before we begin here are some warnings I want everyone to acknowledge before continuing:
WARNING!: GREEN LIGHT IS NOT AN ACCEPTABLE COLOR FOR BIKING. I USED GREEN LEDS FOR STYLE. WHEN I USE THIS WITH A BIKE, I WILL NEED TO USE EITHER WHITE OR RED!
DISCLAIMER: I AM NOT RESPONSIBLE FOR ANY HARM DUE TO THE MAKING/USE OF THIS BIKE LIGHT.
Once you have acknowledged these warnings, lets begin gathering our parts for this project!
Step 1: Parts
You'll need these parts:
-attiny85 (or attiny45)
-4 100 ohm resistors
-1 SPST button
You'll need these tools:
-Soldering iron (with rosin)
-Hot glue gun
Step 2: Open Wide!
Lets begin by preparing the lamp for modification!
Begin by removing the solar charging pack from the lamp. To do this push the center of the lamp from the back, the solar pack should pop off. Set it aside. Next unscrew both the base. After, take out all visible screws inside the lamp's base and cut the wires leading to the LEDs through the bendable metal neck.
Now lets get back to that solar pack! Unscrew the four screws on the back of the pack and carefully take the case off. Once open you should see a PCB board, and a battery pack. Take out the batteries and check for any leaking material from each battery. If theres anything strange coming from the batteries, I suggest searching online for replacement batteries.
However, if they are OK, we can double check their voltage outputs with a multimeter then lets move onto some actually "hacking"!
Step 3: Gut It Like a Fish!
For our new electronics to fit in this case, we will need to make some room. Inside the case, you will notice several black weights screwed in inside the lamp. Before continuing be sure you have removed all these.
Next, get your dremel tool out and lets make some room for our SPST swtich button. Using the dremel, enlarge the hole which the metal spine protruded from so that or SPST button screws in. Then dremel four 5mm holes, one on each side, and two on the top. Be sure that the tips of the LEDs fit snug in the holes.
Once our SPST button and four LEDs fit in our case we can install them more permanently!
Step 4: Hot Glue It!
Before we semi-permanently install our LEDs to the case, lets test each LED to ensure we don't install a faulty one. Using a 3.3 volt supply (from the arduino), test each LED to make sure it actually emits light. To do this just connect your power supply to the positive side of the LED (the positive side is the longest lead) and ground to the other.
Ok now that we know each LED is functioning, we can mount them to the case. Slide each LED into the holes you dremeled out in the previous step. One by one, hot glue each LED (from the inside) into the holes. Be sure you use lots of hot glue to make sure that your LEDs are sturdy. If you have epoxy that would be a more permanent solution, but hot glue is nice since it is strong, yet it can still be removed.
Now that our LEDs are in place, lets focus on making our bike light circuit!
Step 5: Breadboard It!
Before soldering, lets build our circuit on a breadboard. To do this, use the schematics and code found on the next two steps. In those steps I will go over the details on what you must connect to what. However, you will need to know how to read schematics and basic coding skills. Also, keep in mind that you will have to know how to program an attiny!
Once you have programmed that attiny and the circuit is working properly, we can finally solder!
Step 6: The Schematic
Our schematic for this project is pretty easy on the eyes. All we have to worry about is connecting our LEDs, our SPST switch, and connecting VCC and ground. For those who are not firmiliar with schematics I'll go over whats happening with each pin:
Pin 1: Nothing!
Pin 2: Connect a 100 ohm resistor to an LED which is connected to ground
Pin 3: Connect the SPST button which is connected to ground
Pin 4: Connect to ground
Pin 5: Connect a 100 ohm resistor to an LED which is connected to ground
Pin 6: Connect a 100 ohm resistor to an LED which is connected to ground
Pin 7: Connect a 100 ohm resistor to an LED which is connected to ground
Pin 8: Connect to 3.6 volts
Step 7: The Code
If you use the schematics in the previous step exactly, you should just be able to upload the attached code and have a functioning bike light, but for those of you who want to know whats happening in the code continue reading.
All that is going on in the code is a "switch" statement and a variable which keeps track of what mode the program is in. Whenever the SPST button is pressed, the mode increments. There are eight modes, and there are four different LED animations (each one has two different speeds).
A fault of my code is that it uses the "delay()" function to animate the LEDs. It would be better to use the "millis()" function so that the MCU is never just in delay mode. However, using "delay()' still works quite well since we are only delaying for a few milliseconds.
Step 8: Solder!
Lets get this thing working! To solder the circuit, cut a small piece of perfboard sized to fit our attiny (and extra room for our wire connections). Follow the schematics shown in previous steps and look back at your breadboarded circuit to make sure you solder this right the first time. Here are some mistakes that are easily made with this circuit:
-Not using long enough wire.
-Forgetting to add resistors
-Breaking LED leads while trying to solder to them.
Once you have successfully soldered the circuit, we can mount your new solar powered bike light to your bike/backpack!
Step 9: Mount it!
Mounting your new solar powered bike light is going to depend on your bike and your backpack. Since it will vary from person to person, I'm going to just list many ways you can mount it and you can choose which method works best for you.
Here are some ways to mount onto a backpack/bike:
-Epoxy a belt-like strap to the back of the case, and belt it onto a strap on the mounting surface.
-Attach heavy-duty velcro to the mounting surface and to the back of the case.
-Attach a wire to two washers, put the washers on the screws which go into the back of the case. Put the wire through a strap on your mounting surface, and screw the washers in.
When you're all done mounting your new device, you can go take your bike for a spin and try it out!
Step 10: Bike Safely!
Now you should have a bike light to brag about! You'll be saving the environment from disposable batteries while riding in style with your new solar powered bike light. I hope building this light taught you at least a little about batteries, solar power, attinys, and green electronics. If you think this instructable is awesome then please give me a vote in either the Green Design, Summer #MikeHacks, or Battery Powered contest! Thank you for your interest!