Skip to main content

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

Comments

Popular posts from this blog

Robot Software

In the previous blog posts for this 'series' "It is a good time...."  Post 1  looked at the hardware unpinning some of this positive rise in robots; Post 2  looked at social robots; Post 3  looked at a collection of small robots; Post 4 looked at further examples of small robots Robots, such as the forthcoming Buddy and JIBO, will be based some established open sourceand other technologies. Jibo will be based around various technologies including Electron and JavaScript (for more details see:  http://blog.jibo.com/2015/07/29/jibo-making-development-readily-accessible-to-all-developers/ ). Buddy is expected to be developed around tools for Unity3d, Arduino and OpenCV, and support Python, C++, C#, Java and JavaScript (for more details see http://www.roboticstrends.com/article/customize_your_buddy_companion_robot_with_this_software_development_kit ).  This post contin ues with some of the software being used with the smaller robots.  A number ...

Speech Recognition in Scratch 3 - turning Hello into Bonjour!

The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , that is a brilliant use of Scratch 3 - Speech Recognition to control a sprite in an alien language. Do the activity, and it is very much worth doing, and it will make sense! I  would also recommend going to the  machinelearningforkids.co.uk   site anyway it is full of exciting things to do (for example loads of activities  https://machinelearningforkids.co.uk/#!/worksheets  ) . Scratch 3 has lots of extensions that are accessible through the Extension button in the Scratch 3 editor (see below) which add new fun new blocks to play with. The critical thing for this post is  Machine Learning for Kids  have created a Scratch 3 template with their own extensions for Scratch 3 within it  https://machinelearningforkids.co.uk/scratch3/ . One of which is a Speech to Text extension (see below). You must use this one ...

Scratch and web-cams in Scratch 3

Scratch 3 was launched on 2nd January 2019, so I wanted to know would Webcams still work with Scratch 3 as it did with Scratch 2. For example, in a previous post  Scratch, webcams, cats and explosions  the cat (Scratch) moved across the screen and a button burst when the object moved in the camera onto it.  Can the same thing be done in Scratch 3? The short answer is yes, but it is done slightly differently. The first change the video capture is not there in the blocks automatically; but is an extension that needs to be added. First, you need to add the extension blocks for video sensing. Go to the little icon at the bottom left of the screen (as shown below) this takes you to the extensions menu. Next, find the Video Sensing option and selected. The webcam, if enabled, with start automatically. A video sensing set of blocks is now in the list of block options.  The rest is very similar to doing this in Scratch 2. Moving ...