Introduction: Toy Traffic Light With Arduino Nano

About: Tinkerer

Here is my small project that I made for my son’s 2nd birthday.

He is very fond of trains and cars, so I thought that a working traffic light would not hurt. I know there are some commercially produced toys, but I wanted to do something myself. If you have religious feelings about Lego, proceed with caution – some damaging images ahead.


Project is based on Arduino Nano which fits pretty well inside the regular Duplo block.


  • Arduino Nano V3
  • Red, Green, Yellow LEDs
  • 3x 220 Ohm resistor (for the LEDs)
  • Pushbutton
  • Battery block of your choice (e.g. 3xAAA battery pack or a 18650 battery)
  • 2x4 Lego Duplo Blocks (2x)
  • Other Duplo blocks for base
  • Hot glue or superglue
  • Small screws (4x)


  • Drill
  • Dremmel (not mandatory, but would save you some time)
  • Solder

Step 1: Step 1: Carve and Drill the Insides of Duplo Block


First, you need to carve out space for the Arduino Nano.

Take the 2x4 Duplo block and cut two and half tubes and the bulkheads.

Fit multiple times and don't carve too much at once.

Lego blocks appeared to be fairly easy to process. I used Dremmel-like tool with rotary bit here, but you can get away with a hot nail and a knife I guess.

Also you would need to carve or drill a hole for the pushbutton and wires for the external battery pack.


Drill the other block to place LEDs later.

You will need another 2x4 block. There just place a 5mm drill in the center of each tube and drill it.

Step 2: Step 2: Solder

Let's prepare your soldering tools here.

Since the space inside the Duplo block is limited I couldn't find a better solution than solder everything in the air.

Probably one could make a little circuit board, but I wasn't sure it would fit.

Here is my take:

Start with the LEDs

Since you will need to fit everything tightly, try putting LEDs in the holes you drilled before.

Then cut the LEDs pins really to the minimum and solder the resistors to them.

Try to fit it with the second block and find an optimum position for the wires.

As soon as you found the proper resistors position, solder their terminals into Arduino pins (D3, D4, D5 for green, yellow and red).

Wiring the ground

Here you would need to join the three LEDs' pins together and you may need some extra hands here.

I fixed everything in the 3rd hand helper tool and then called in my wife to actually put tin on the terminals while I was soldering it.

The push button

This one is optional, but you can add other states to the program, so it can have multiple patterns.

Here just solder one pin to the ground, and another one to Arduino pin D2.

Power wires

As the last step wire your power pack wires to Vin and GND.

Fritzing schematics original file:

Step 3: Step 3: Flash Your Arduino

I hope you have some experience with Arduino. In case you don't please head to the Getting Started page.

Just download the source from Github and use Arduino IDE to flash it.

Step 4: Step 4: Assembly

Here is how I did it:

Put your Arduino with all the soldered stuff into its block.

Then start pressing the second block (with holes for the LEDs) against it, but not to the end.

Use tweezers or similar thin instrument to push the LEDs into its holes.

If everything goes right, and you tested with batteries and it works, then congratulations!

If you are building it for a toddler and don't them to disassemble the toy at first try, apply some hot glue between the blocks to secure it.

Step 5: Step 5: Add Base

Build up a base and join it with a battery pack.

I used 2 high 2x2 blocks, drilled them to screw the traffic lights and the battery pack.

My take: