O'Reilly logo

Raspberry Pi LED Blueprints by Agus Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a traffic light controller

After having understood about a traffic light controller and learned how to use a channel relay and how to expand Raspberry Pi GPIO, you are ready to build a traffic light controller.

For testing, we will build a traffic light controller for four road intersections with the following scenario:

  • First, we set all intersections showing the red lamp
  • To execute traffic light 1, we turn on the yellow lamp and then turn on the green lamp
  • After this, we turn on the red lamp on traffic light 1
  • Repeat these steps for traffic lights 2, 3, and 4

The following hardware is needed:

  • A Raspberry Pi board
  • Twelve lamps with four red lamps, four yellow lamps, and four green lamps
  • A 4 x 3-channel relay module
  • An IC MCP23017
  • Cables

In this case, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required