Wednesday, 9 April 2025

TinkerCad microbit traffic light simulator (now with video)

Have you ever wondered how the traffic lights at the end of your street actually work? They aren’t just on timers; they are controlled by small computers. Today, we’re going to build and code our own traffic light system using a free online tool called Tinkercad.

The best part? You don’t need to buy any expensive equipment. You can build the whole thing virtually on your computer.

What is Tinkercad?

Tinkercad is a free, web-based tool from Autodesk. While many people use it for 3D design, it also has a "Circuits" section where you can drag and drop electronic components—like batteries, LEDs, and micro-computers—to see if they work before building them in real life.

The Project: The Micro:bit Traffic Light

In this project, we use a BBC micro:bit (a pocket-sized computer) to control three lights: Red, Orange, and Green.

To make this work, we connect the micro:bit to a "breadboard" (a plug-and-play board for electronics) or can get away with just wiring them togther with wires (as seen in the circuit below).

  • The Lights: We use three LEDs (Light Emitting Diodes).

  • The Safety: We add resistors.

  • The Connections: * Pin 0 controls the Red light.

    • Pin 1 controls the Orange light.

    • Pin 2 controls the Green light



So here is a circuit with a microbit. The anode (the one with the bent leg)connects to the microbit pins through resistors. The cathode goes to the ground connection.





Here is the code for the microbit turning the LEDs on and off, and when it starts up by putting a smiley face onto the microbit.









For those who like circuit diagrams, it can produce a more formal circuit diagram and the parts list (see below)- nice feature.









Have a play with the simulator below it goes a little bit further and changes the smiley face to letters (see the code below)


Here is how the logic works:

  • The Start: When the micro:bit turns on, it displays a Smiley Face on its screen to show it’s ready.

  • The Loop: 1. Green Light: The micro:bit sends a signal to Pin 2 to turn the Green light on. It shows the letter "G" on its screen. 2. Orange Light: After a few seconds, it turns Green off and turns Pin 1 (Orange) on. It shows the letter "A" (for Amber). 3. Red Light: Finally, it turns Orange off and turns Pin 0 (Red) on. It shows the letter "R".

  • Repeat: The code "loops" forever, just like a real traffic light!









Why Give This a Go?

  • It’s Safe: Since it’s a simulation, you can’t break anything or cause a short circuit.

  • Professional Tools: Tinkercad can automatically generate a "Parts List" and a professional "Circuit Diagram" for you—great for school projects or portfolios.

  • Endless Creativity: Once you master the traffic light, you can change the timings, add a "Pedestrian Walk" button, or even change the colors of the LEDs.

Ready to Build?

Head over to Tinkercad.com, create a free account, and look for the Circuits tab. Search for "micro:bit" and start dragging components onto your workspace.


All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

No comments:

Post a Comment

The "Hug Avoider": A Coding Journey from Blocks to MicroPython

This project journey follows the evolution of a simple social-distancing idea into a fully realized "Hug Avoider" wearable. Writte...