A modern traffic light displays a green signal against the backdrop of a building with warm orange tones and large windows.
An overhead view of a bustling city street shows multiple lanes of traffic, a busy crosswalk with pedestrians, and several cars moving in both directions.

Traffic lights are used at the intersection of two roads to control the flow of traffic. They use a universal colour system – red for stop, yellow for caution, and green for go – to direct drivers and pedestrians.

Let’s think about Sustainable Cities and Communities by building a traffic light for Forward’s Smart City!

The traffic light in the project will:

  • cycle traffic on a timer using red, yellow, and green LEDs
Forward Education's traffic light project with Learn to Solder module

Prepare

You’ll need the following items to complete this project:

Build

First, let’s build our traffic light project with the building blocks and robotic components from the Climate Action Kit and the Smart Solder component:

As you build, think about the orientation of your red, yellow, and green lights, how tall your design should be, and how to make your traffic light sturdy.

Code

Explore the code below to get started using your Traffic Light.

  • Connect your project to the computer and download the starter code to make it work!
  • Review the code comments on each block to learn about how your traffic light works, then try testing it in real life.

Improve

Think about accessible features to add to your traffic light! How would you modify the sample code provided, or create your own code that includes the following features?

  • A motion sensor to sense when a car is waiting
  • A pedestrian signal or crosswalk function

No Smart Soldering Kit? No Problem!

You can modify this project by replacing the Smart Solder component with the LED Ring from the Climate Action Kit, and test your traffic light using the code provided.

Feeling Stuck? Explore the Knowledge Base for common questions and troubleshooting tips.