Arduino Stop Light

by JamesB60 in Circuits > Arduino

695 Views, 2 Favorites, 0 Comments

Arduino Stop Light

DSC_8653f.JPG

RGB LEDs are a great way to introduce kids to programming. They will endlessly mess with color combinations and timing, getting a feeling for code on their own time. This project uses cheap full-color LEDs controlled over I2C, so there are only four wires to connect. It makes a great introduction to I2C.

After you've got the stop light running, you can change the color sequence to anything you like - it uses standard color hex codes.

What I used

1 Arduino, e.g. Uno

3 LED modules from Electric Dollar Store

1 carrier board and headers

4 jumper wires, male to female

Soldering iron

Assemble the Modules

DSC_8646a.JPG
DSC_8647b.JPG
DSC_8648c.JPG

Remove the modules from their packets, and solder the three LED modules into the white squares on the carrier. It's easiest to work from right to left, as shown.

To give the LED modules different I2C addresses, you will need to change two solder jumpers. The ones to change are A0 on the middle module, and A1 on the right-hand module. To change a jumper, break the right-hand solder link and add solder to make a new connection to the left.

There is a Sparkfun tutorial on how to do this, here.

Solder a 4-pin header to the board, and add pullup resistors, if using.

Connect the Arduino

DSC_8649d.JPG

Use four jumper wires to connect the Arduino to the module:

  • GND connects to Arduino GND
  • VCC connects to Arduino 3.3V
  • SDA connects to Arduino A4
  • SCL connects to Arduino A5

When you've made the connection, switch on the Arduino and confirm that the three LED lamps glow softly. This means that they are all getting power.

Load and Run the Sketch

Launch the Arduino IDE, then download and add this stoplight.ino sketch. There are no libraries to install; the sketch is all you need. Run the sketch, and the stoplight will start cycling between red, green and yellow.