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.

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: http://www.radioshack.com/product/index.jsp?productId=2062588)

3x - 100 Ohm Resistors
1x - 10k Ohm Resistor
(You can get both resistor values in this assortment at RadioShack: http://www.radioshack.com/product/index.jsp?productId=2062304)

22AWG Solid Core Hookup Wire
(There is a three pack of hookup wire at RadioShack. Make sure to get solid core! http://www.radioshack.com/product/index.jsp?productId=2049743)

1x - ATTiny85 8-pin PDIP Microcontroller
(You can get these at Jameco: https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2151312_-1)

1x - 8 pin socket for the ATTiny
(You can get these at Jameco: https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_112206_-1)

1x - Small DPDT Slide Switch
(You can get these at Radioshack: http://www.radioshack.com/product/index.jsp?productId=3020764)

1x - Momentary Tactile Button Switch
(You can get a 20 pack of these useful buttons at Adafruit: http://www.adafruit.com/products/367)

1x - 5V Power Regulator
(You can get these at Jameco: https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_51262_-1)

1x - Printed Circuit Board (Perfboard)
(This one from RadioShack has a really nice layout for the traffic light: http://www.radioshack.com/product/index.jsp?productId=2102845)

1x - 9V Battery Snap Connector
(You can get these at RadioShack: http://www.radioshack.com/product/index.jsp?productId=2062219)

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

(I used an Arduino Uno - R3 https://www.adafruit.com/products/50)

10uF Capacitor
(RadioShack has a nice assortment of capacitors: http://www.radioshack.com/product/index.jsp?productId=2062376)

Arduino IDE
(I used Arduino 1.0.4 http://arduino.cc/en/Main/Software)

Soldering Iron
(I happen to be using this one from RadioShack: http://www.radioshack.com/product/index.jsp?productId=2062750)

(I'm using 60/40 Rosin Core 0.05" Solder from RadioShack: http://www.radioshack.com/product/index.jsp?productId=2062712)
<p>This is very good for getting started ATTiny. Clear instruction and easy to follow. Thank you very much.</p>
<p>it&acute;s my first project with the attiny13, and works great.</p>
<p>Thank you for taking the time to put this Ible together. I'm just starting to play with the ATTinys and this looks fun.</p>
<p>Great! ^^</p>
<p>I am going to build this now ...this will be a great circuit for testing my ATTiny85 chips!</p><p>Thank you for sharing and nice work !</p><p>Build_it_Bob </p>
<p>Built it on a breadboard , loaded it and tested it ...works great !!!</p><p>I was looking for a something straight forward and this is excellent !</p><p>Thank you again!</p><p>Build_it_Bob</p>
Thank you for posting this project. It helped me to solve one issue I had with voltage regulators!! <br>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) <br>Thanks!
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. <br>Thanks again for an awesome instructable!
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?

About This Instructable




Bio: I am a geek, dad, coder, CTO of American Reading Company, electronics enthusiast, and amusement park aficionado.
More by nthdesign:ATTiny85 Traffic Light 
Add instructable to: