Building an I2C expander
Right, now that we've worked out what we need to do to give us more digital I/O pins, and built our power supply for it, we can build our expansion port.
To do this, we're going to use a chip designed exactly for the job: the MCP23017, manufactured by Microchip and widely available from electronic suppliers.
The MCP23017 is an integrated circuit that connects directly to the I2C bus (the SDA and SCL pins we talked about earlier) and gives us 16 bi-directional input and output pins. If required, we can connect up to 8 of these chips to the same bus, giving us up to 128 inputs and outputs (yes, I know that I said "virtually unlimited" previously, but I'll explain later).
Note
The full datasheet for the MCP23017 is available on Microchip's site, which can be found at www.microchip.com/MCP23017.
The I2C port expander circuit
The basic parts you will need to build your port expander are as follows:
- A 1 x MCP23017...