Introduction: Bright Bike, the Automated Alert System for Bikers and Drivers

About: From solder to zip ties, lead acid batteries and LEDs, and especially Legos, putting things together has always fascinated me. The more challenging the better, because whats the fun of putting something togeth…
Practically everywhere that I need to get to, including school, I bike to. It is a great way to wake up in the morning not to mention the other benefits over driving. Unfortunately, though, there is always that small group of drivers that does not like to share the road and it can get especially dangerous at night or on narrow roads. While I could get back at the drivers by mounting strobe lights on the back of my bike or pedaling as slowly as possible that does not seem to be the best solution for a number of reasons. While thinking about ways to combat this I noticed the large number of great bike light projects on Instructables. Thats when I decided to build this project and to step up the game of ordinary flashing red lights. From an Arduino that I have recently fallen in love with (bet you've never heard that one before) and an Ultrasonic sensor came Bright Bike which would control the amount of light that a driver sees depending on how close he or she drives to me.

After some searching on the web and plenty of impatient waiting for packages to arrive I was finally able to connect and control 17 LEDs and an Ultrasonic sensor in a show of lights. 

Now enough talking and more constructing...

Step 1: Materials

One of the nice things about this project that I found was that most of these parts are extremely common allowing them to be purchased from virtually any electronics/hobby website or store.

Materials:
1x Arduino Uno

17x 5mm LED
4 each of Red, Green, Yellow, Blue. You will also need an additional 17th for your handle bars. A diffused LED will be a little less jarring for your eyes. Make sure than none of them draw more than 40mA. These are available through most every electronics website. You can also buy them at Radio Shack, although, in my experience they always cost a little more in a pysical location versus an online store.

17x Resistors
A helpful resistor calculator can be found here. Allelectronics has a great selection page to choose from.

1x Container
Homedepot has a number of cheap and sturdy options or Allelectronics which is what I used. Make sure to buy something at least a  1/4 bigger than the Arduino in each direction. The one that I used fit a little to snuggly.

1x Perf board

22 AWG wire
One color should be fine and you will not need more than a couple of feet.

1x Ultrasonic Proximity sensor
There a number of options depending on what kind of range you want, but I used this one from Sparkun which has a range of 6.45 meters.

1x Switch It should not need to carry more than an amp and should be capable of 9v. Try to get one with a neck like this and two legs, however this particular switch can handle far more amps than you will ever need with this project

1x 9v Battery holder and 9v battery

Velcro, Zip ties, or some other material to attach the box to the bike. Depending on the size of your saddle bag you might be able to fit it inside of that.

Electrical Tape

D.I.Y style patience

Tools:
Soldering Iron
Dremel or some sort of similar cutting tool
Drill
Wire stripper or a knife will work

Step 2: Schematic

Until this challenge I had never heard of Upverter. There are some really neat things that you can do with the free version and it beats drawing everthing. The specific pins in the schematic are the ones that I used in the program. Each LED is connected to its own pin on the Arduino and has its own resistor; they all share the same ground.

Step 3: LED Resistors and Solder

Each LED is connected to its own pin on the Arduino and they all share the same ground. The most important part of soldering this together is to watch out for solder connecting the positive and negative terminals of the LED or the positive end of 2 LEDs touching.

On the Perf board the ground runs along the outside so the short legs of the LEDs are always of the outside while the longer leg is on the inside. Run a stripped hookup wire along the outside soldering all of the short legs and then clip the ends of off the LEDs so that they each have about 1/2 inch sticking up. 

Next solder the appropriate type of resistor to each inside leg of the LEDs and from there solder about 6 inches or hookup wire to the opposite side of the resistor as can be seen in the schematic. 

Finally one more LED, the 17th will run up to your handle bars. Choose your favorite colored LED (as you will be seeing it a lot) and connect it to a resistor and hook up wire. Connect it to your handle bars and now you have an LED that will alert you when a car comes to close. Be sure not to aim the LED directly at yourself otherwise it might surprise/blind you with more then help you and leave enough slack for the handle bars to turn.

Step 4: Adding the Ultrasonic Sensor

On the back of the sensor you should see 3 holes for 5v, Ground, and PWM. You can actually use PWM or Analog which is a nice benefit of this sensor, just connect the hook up wire to the adjacent hole. In order to make this sensor easily accessible push 3 hookup wire through the back of the Perf board and sensor and bend then on the side of the sensor so that they cannot be pulled back through. Then hook them up to their respective pins on the Arduino. On the bottom of the sensor do the same with another wire and hole just to make sure that the bottom does not pop up. This wire does not attach to anything. While solder, tape, or glue or some other type of bond might be expected to hold the sensor in place I found that the bent wire was enough to hold the sensor in place since there never really was any force put on it.

Step 5: Code

Attached are a couple of fun programs that I wrote. They are exactly what the title sounds like and are in the below video.

I highly suggest visiting arduino.cc if this is all new to you as they have fantastic documentation which will most likely answer any questions you have about the programs or you can ask me.

If you modify the design in some way or come up with a neat program I would love to see a photo/video of it if you attach it below in the comment section for everyone to see.

The program that finally will ended up resting in the Arduino is called BlinkFinal.

Below is a video of the patterns just to give you an idea of what they should look like. Trust me, though, they look much better in person.

Step 6: Case

We are closing in on the final steps and there is just one more thing to do before you can put away the soldering iron and its fumes.

The Arduino is a smidge to big to fit in my box on one face so it is resting diagonally, which really will not injure it. First, however use a Dremel to cut out one of the smallest faces of the box which is where the Perf Board with LEDs and sensor will rest.

Next drill out a small hole on the side of the box for the switch. The hole should be the width of the switches "neck". This way you can stick the "neck" through and tighten the nuts from both sides which will hold the switch in place and that also means that less is sticking out of the box. 

Once you have the switch in place cut the red wire on the 9v batter holder in half. Solder the positive end of the battery holder to one leg of the switch and solder the cut off half to the other leg. Plug the ground lead of the battery holder into the Gnd pin next to the Vin pin on the Arduino and the positive end from the switch into the Vin pin. Now you have an "on" "off" switch, although, the hardest part is seems is remembering to flick the switch and turn it off.

Give everything one last test (it gets annoying when you seal everything up and one LED starts acting finicky) and place it in the box. Wrap some black electrical tape around the protruding perf board to make a nice seal that will hold everything in place (as drumroll starts to sound). Aaaand you're done! Time to put this on your bike and give it a test run.


Step 7: Mounting on a Bike

How you do this will vary on your bike. You can replace you're saddle bag for it or possibly even fit it in you're saddle bag. Or if you have a rack like I do you can attach it to the side. Zip ties work great as there is no adhesive to decay in bad weather. 

Now pack all the tools and bits of wire up and go for a ride with some friends and light up the night!
Remote Control Challenge

Participated in the
Remote Control Challenge

Robot Challenge

Participated in the
Robot Challenge

Green Tech Contest

Participated in the
Green Tech Contest