ATtiny85 Toy Traffic Light

Introduction: ATtiny85 Toy Traffic Light

About: I am a sound designer who's studied computer game development, run my own sound design business and like to build thing in my spare time.

This is a toy traffic light i made for a friends son! Using only a few parts and an ATtiny85!

Step 1: Materials

Materials used:

3 LED's (red, yellow and green).

3 Resistors.

3 AA batteries.

1 3 AA battery holder.

1 Switch.

1 ATtiny85.

1 8 pin dip socket.

1 Small piece of bread board.

1 Arduino Leonardo (doesn't have to be a Leonardo).

1 Breadboard and jumpers.

A few pieces of wood

1 inch dowel

Tools used:

Basic woodworking tools.


Soldering iron.

Hot glue gun.

Spray paint.

Step 2: Breadboard

This is the circuit on a breadboard. Always test your circuit on a breadboard before you build it!

I used 65 Ohm resistors. Your circuit might require another resistor value so use Ohm's law to calculate your resistor value.

To learn how to program the ATtiny85 and upload your sketch, check out:

I used an Arduino Leonardo for this.

Step 3: Code

I am not a programmer so this is really basic stuff. There might be a better way of doing it. Please comment if you have any suggestions or improvements!

I don't know if traffic light signals are the same over the world, but here in Sweden it goes like this: Red, Red AND Yellow, Green, Yellow, and back to Red.

The code just cycles through the LEDs forever (or until turned off).

This is the final code I uploaded to the ATtiny85 so the pinmodes described here are for the ATtiny85 since it only has 5 outputs.

//Traffic light toy sketch for ATtiny85. by: Simon Nordberg.

void setup() {

pinMode(0, OUTPUT); //Red LED.

pinMode(1, OUTPUT); //Yellow LED.

pinMode(2, OUTPUT); //Green LED. }

//Looping forever

void loop() {

digitalWrite(0, HIGH); // Turn on red LED.

delay(3000); //Waits for 3 sec.

digitalWrite(1, HIGH); //Turn on yellow LED.

delay(2000); //Waits for 2 sec.

digitalWrite(0, LOW); //Turn off red LED.

digitalWrite(1, LOW); //Turn off yellow LED.

digitalWrite(2, HIGH); //Turn on green LED.

delay(5000); //Waits for 5 sec.

digitalWrite(2, LOW); //Turn off green LED.

digitalWrite(1, HIGH); //Turn on yellow LED.

delay(2000); //Waits for 2 sec.

digitalWrite(1, LOW); //Turn off yellow LED.


Step 4: Building

Base: Drill out the base and carve out enough room the fit the batteries, circuit and the switch.

Pole: Drill a hole through the dowel to fit the LED wires through.

Head: Drill 3 holes in the head to fit the LEDs. Drill a hole through the bottom of the head and insert the LEDs from the bottom.

Assembly: Glue the head to the pole and the pole the the base. Before attaching the batteries, Solder the wires to the circuit board.

With a bit of planning, all this fits together nicely! :)

Step 5: You're Done!

That's it! Enjoy building your toy traffic light!

Automation Contest

Participated in the
Automation Contest

Be the First to Share


    • Pets Challenge

      Pets Challenge
    • Build a Tool Contest

      Build a Tool Contest
    • Stone Concrete Cement Contest

      Stone Concrete Cement Contest



    2 years ago

    Nice build!
    Liked how you only used a single microcontroller, without all extra stuff, and the project is really compact.


    5 years ago

    My little son (7 years) plays well with fire tricolode and his cars...!!!!

    I used N batteries (LR01) they are smaller. If you want I can make pictures!


    Reply 5 years ago

    Hi! Yes please post a photo :)


    Reply 5 years ago

    Hello Simon,

    My Grandson and I thank you for this beautiful construction. It is a pleasure to see him play with.
    As I had proposed, I will post some photos.
    See you soon (I will also do your Lab feeding with an old PC)


    5 years ago

    Can not operate as indicated ( Step 2: Breadboard)

    The digitalWrite (1, LOW) function is used to set pin 1 to 0Volt (... ground). The direction of mounting of the diodes must therefore be reversed. The + of the has the output of the resistance "and the other paw" at least "... And there it works well.


    7 years ago on Introduction

    Hi, nice build. Do you have some photos from the soldering/internal?


    7 years ago on Introduction

    I've always wanted to do something like this but with a real traffic light.