ATTiny85 Traffic Light

Picture of ATTiny85 Traffic Light
This instructable will show you how to build a fun traffic light circuit using the cheap and powerful ATTiny85 microcontroller. The ATTiny85 can be programmed using the Arduino Processing language, and can do many of the things an Arduino can do. Learning how to use the ATTiny85 in this way will let you take your awesome Arduino projects and make them permanent. It's much more feasible to leave a $2 ATTiny85 attached to your circuit than it is a $30 Arduino.

The traffic light itself is a very simple gadget. Press the tiny pushbutton, and the light advances from red to green, then from green to yellow, and finally back to red. To make it even more sophisticated, the lights "fade" on and off using pulse width modulation (PWM).

After finishing this quick project, you'll have a foundation upon which you can build many cool circuits using the ATTiny85.
Remove these adsRemove these ads by Signing Up

Step 1: Go Shopping!

Here are the parts I used to build the traffic light.

Feel free to make substitutions, and buy parts from any vendor you like.

1x - Red LED
1x - Yellow LED
1x - Green LED
(You can get all three LEDs in this assortment at RadioShack:

3x - 100 Ohm Resistors
1x - 10k Ohm Resistor
(You can get both resistor values in this assortment at RadioShack:

22AWG Solid Core Hookup Wire
(There is a three pack of hookup wire at RadioShack. Make sure to get solid core!

1x - ATTiny85 8-pin PDIP Microcontroller
(You can get these at Jameco:

1x - 8 pin socket for the ATTiny
(You can get these at Jameco:

1x - Small DPDT Slide Switch
(You can get these at Radioshack:

1x - Momentary Tactile Button Switch
(You can get a 20 pack of these useful buttons at Adafruit:

1x - 5V Power Regulator
(You can get these at Jameco:

1x - Printed Circuit Board (Perfboard)
(This one from RadioShack has a really nice layout for the traffic light:

1x - 9V Battery Snap Connector
(You can get these at RadioShack:

Here are some things we're assuming you already have.

(I used an Arduino Uno - R3

10uF Capacitor
(RadioShack has a nice assortment of capacitors:

Arduino IDE
(I used Arduino 1.0.4

Soldering Iron
(I happen to be using this one from RadioShack:

(I'm using 60/40 Rosin Core 0.05" Solder from RadioShack:
crusso8 months ago
Thank you for posting this project. It helped me to solve one issue I had with voltage regulators!!
Just one comment, you could try to automate the lighting sequence with some code, just like the traffic lights in the street (instead of pressing the buttons to make it work)
Mercurion9259 months ago
Great instructable....I'm about to experiment with using the Arduino IDE and ATtiny85 together....been meaning to do it for a while, but just never got around to it. The High-Low Tech tutorial page appears to be down at the moment, but there's a cached version online.
Thanks again for an awesome instructable!
nthdesign (author) 1 year ago
For this tutorial, you have to press the button each time. But, all of the code to advance the state of the light is encapsulated in functions, so it wouldn't be too hard to modify the Arduino sketch to advance the light automatically.
Does this particular tutorial make the lights automatically switch from red to green to yellow or do you have to press the button each time?

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!