Thursday, July 9, 2009

A Really Blinking LED



Ready to tackle another simple Arduino project but don’t want to spend too much money?

Does a buck sound about right?

So let’s be off to the Dollar Tree, where everything there is $1. There I found several interesting things that might make for future, simple and fun Arduino experiments, but for this project I settled on the Sports Air Horn. This is a really loud, non-electronic horn, complete with three very bright, flashing LEDs, one red, one green, and one blue.

OK, now let’s tear open the package and see what we have. That plastic thing is actually a horn. If you blow into the small hole on the side,this thing creates a very loud sound, but our goal is to examine that little circuit board inside. The top of the horn is covered with a plastic/rubber membrane, however the bottom of the plastic case is wide open.

Going in from the bottom, use a screwdriver to carefully break away the circuit board. You will hear plastic cracking as the circuit board separates from the housing, but don’t worry, I broke away four of these circuit boards without damging the circuit board or the housing. You can still use the horn itself (sans lights) to irritate the neighbors.

When the circuit board is free of the case, you will have something looking like this:
It’s that circuit on the right that we are after. It can easily snap out of its plastic cover.

Looking at the circuit board we see three batteries (covered with metal holders) connected together in series to provide 4.5 volts for powering the circuit. We don’t care about the connections between the batteries, we only need to locate a final positive and negative contact point, that will allow us to connect to the power supply from the Arduino. We will also need to find a place to attach a wire giving us a means to connect to an OUT pin on the Arduino.



On the printed circuit side; all the spots marked with an X are connections for the batteries – we can remove the batteries and ignore these. BTW if you leave the batteries on the board, they can power the Arduino for a while. The red “+” is where we will connect +5 volts and the black “–“ is the ground connection. The yellow “P” point is where we will solder a wire for connection to an Arduino OUT pin. The switch (which will remain soldered to the board in the event we desire to test the LEDs) connects P to ground or in Arduino terms, “to LOW”.
Solder the wires as shown below: The red positive 5 volts wire is shown soldered to the right of the little hole (the same hole the black negative wire enters the board), however it can just as easily be attached to any of the other point shown by the red + sign. If you remove the AG10 batteries and their holder, there will be no + connection to the solder point shown below, because the battery holder acts as a conductor for the 5 volts.
Here are two pictures of the finished Blinker, one attached to Arduino pin 12, using a Proto Shield and a mini solderless breadboard, and one directly connected to the Arduino.


The Arduino program, or sketch, is a simple modification of the original blinking LED exercise. The code is available in the code listings on the right hand sidebar as a text file. Simply copy and paste it into the Arduino code window.

The LEDs are very bright!

Have some fun playing with the delays in the code. The circuit has a life of its own, so the timing may not seem to behave perfectly. I am considering making an array of 9 or more of these (3 sets) using three OUT pins and a variety of delay timings.

At the Dollar Tree,I also picked up a $1 noise maker; I plan to combine with these Really Blinking LEDs in another project.