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
In this case, ...