Arduino Traffic Light

3,293

18

3

Introduction: Arduino Traffic Light

This instructable is derived from: Arduino-Traffic-Light-Simulator

I have used the drawing from this instructable, to create a separate traffic light. I made the following changes:

  • Holes for LEDs are smaller, for 5mm LEDs (instead of 10mm LEDs).

  • Added tiny platform, so the traffic light can stand on its own.

  • Changed the shape, so that it can be used for material with thickness of 4mm (instead of 3mm).

Note on cost: Since 5mm LEDs are cheaper then 10mm LEDs and 4mm plywood is cheaper then 3mm acrylic, this is a 'budget' version of the traffic light.

The traffic light can be connected to (and off course programmed with) any microcontroller (such as Arduino UNO).
Tip: use an Attiny 85 development board if you wish to keep your entire project very small.

With many thanks @ pcvnes for a very good and clear instructable! I really appreciate that even includes instructions (lesmateriaal) in Dutch!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts List and Tools

The following parts are needed:

  • 1 red LED, 5 mm
  • 1 yellow (or orange) LED, 5 mm
  • 1 green LED, 5 mm
  • a piece of plywood, 4 mm thick. Size is about 11 cm x 12 cm.
    Or acrylic or any other material that can be cut with a lasercutter, as long as the thickness is 4 mm.
  • 4 jumper wires:
    • a red, yellow, green wire, 10 cm
    • a black one, 15 or 20 cm
      I have used wires that correspond with the colors of the LEDs, if you don't care about the colour, 2 jumper wires will be enough, as they are cut in half.
  • 3 resistors, 330 ohm
  • a bit of scrap wire (3 cm or so)

To turn the traffic light on, and to program it, you also need a microcontroller (such as Arduino UNO) and 4 jumper wires to connect the traffic light to your microcontroller. This part is not included in this instructable.


The following tools are needed:

  • a laser cutter (see next step if you don't have one)
  • a soldering iron (and a bit of solder tin)
  • something to strip the jumper wires with (I used a sharp knife (stanleymes) for this)
  • wood glue

Step 2: Cut Out Parts

Cut out the parts with a lasercutter. The base (square with the cross-shaped hole) needs to be cut out twice.

I have used the laser cutter from my local FabLab.

To find the FabLab closest to you , visit: https://www.fablabs.io/labs/map

I assume you could also print the drawing on a piece of paper, stick it to plywood and use a hand (fret)saw, and drill the holes. Or even use strong cardboard. I have not tried it though.

Step 3: Assemble Parts

Assemble the parts, as described in step 3 of this instructable: https://www.instructables.com/id/Arduino-Traffic-L...

Because the LEDs are smaller then in the original instructable, you may not be able to connect all LEDs without an extra piece of wire. I needed one piece of wire of 2,5 cm (from the red LED to one of the resistors) so I used a piece of wire left over from another project. If you don't have wire left over, you could also use a piece of paperclip (leg of a LED, resistor, etc.), this also works fine.

Because I do not own tools to put 4 dupont pins at the end of a wire, I have cut 4 jumper wires in half. Strip the end of each wire. Solder half a jumper wire to the end of each resistor (red wire at the resistor that has the red light, yellow to yellow, green to green). Then solder a black jumper wire to the green LED, the anode (minus or short) pin.

Notes/ tips:

  • Jumper wires can be male or female. Males are recommended if you plan to connect your traffic light to a breadboard or Arduino UNO. Females if you plan to connect to an Arduino Nano or Attiny 85.
  • It is most easy to attach LEDs, wires and resistors, before gluing the parts together.

  • Because you only need half a each wire for 1 traffic light, you could used the 4 pieces of wire left over for a second traffic light.
  • The first time, I stapled the wires to the wood for extra strength, this was a bad idea. The wires do not stay in place, and it's easy to damage them. The second time, I used a drop of hot glue, this worked much better.

1 Person Made This Project!

Recommendations

  • Raspberry Pi Contest 2020

    Raspberry Pi Contest 2020
  • Wearables Contest

    Wearables Contest
  • Fix It Contest

    Fix It Contest

3 Discussions

0
alice18
alice18

Question 12 months ago

Hi, how are you?
I'm Alicia, and I am writing from Spain. In our highschool we're doing some Arduino projects. So my friends and I have chosen this Arduino traffic light, because we think it's very interesting.
We have already made the wood pieces, but we need the code. Could you send it to me, please? My email is aliciameigarcia@gmail.com
Thank you!
Hope to know about you soon,
Alicia.

0
framakers
framakers

Answer 8 months ago

Hi Alicia,

Here are a couple of links/suggested steps, that I hope are helpful to you.
There are two options.

1) The first is to use the Arduino IDE (which can be downloaded here: https://www.arduino.cc/en/Main/Software).

Start with turning only one LED on and off. Please see the example "blink": https://www.arduino.cc/en/Tutorial/Blink
To make it work, connect the red LED to pin 13 and the "minus" (black cable in the foto's) to a pin that is marked "GND". Just leave the yellow and green one disconnected.

Then try to turn more then one LED on or off,
https://www.instructables.com/id/Multiple-Blinking-LED-on-the-Arduino/
To make it work, connect the red LED to pin 13, yellow to pin 12, green to pin 11 and the "minus" (black cable in the foto's) to a pin that is marked "GND".

2) Or... for a quick and easy way to programm an arduino, I recommend starting with mBlock (free software): http://www.mblock.cc/
I have attached code for mBlock.

I hope this helps, and I would love to hear how your project turned out or see a foto. Succes!

traffic light.png