Book Image

Raspberry Pi LED Blueprints

By : Agus Kurniawan
Book Image

Raspberry Pi LED Blueprints

By: Agus Kurniawan

Overview of this book

Table of Contents (14 chapters)
Raspberry Pi LED Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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, you can ignore channel relay modules if you use a +3 V/+5 V LED, so LEDs can be connected to the IC MCP23017 pins directly. To simplify this demo, we use DC LEDs and don't need many-channel relay modules.

To implement our wiring, you connect all...