You may want to control many traffic light controllers via one board, that is, Raspberry Pi 2. It's possible. You just expand Raspberry Pi GPIO according to your needs. In the previous section, we already learned how to expand Raspberry Pi GPIO using the IC MCP23017. How to work with more than one IC MCP23017?
You can implement it with the following configuration:
You can connect the SCL and SDA pins to the same pin for I2C
Set the module address (A0, A1, and A2) with different address, for instance, IC1
000
and IC2111
Now, you can connect the lamps to the IC MCP23017 output pins as usual. The following is a sample of the wiring implementation:
From the preceding figure, you can do construct the following wiring:
All IC MCP23017 SDA pins are connected to Raspberry Pi SDA
All IC MCP23017 SCL pins are connected to Raspberry Pi SCL
All IC MCP23017 VCC pins are connected to Raspberry Pi +5 V
All IC MCP23017 GND pins are connected to Raspberry Pi GND
The following...