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:
Raphango5 days ago

Great! ^^

Build_it_Bob4 months ago

I am going to build this now ...this will be a great circuit for testing my ATTiny85 chips!

Thank you for sharing and nice work !


Built it on a breadboard , loaded it and tested it great !!!

I was looking for a something straight forward and this is excellent !

Thank you again!


crusso1 year 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)
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?