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).

An MCP23017 integrated circuit pinout

Note

The full datasheet ...

Get Building a Home Security System with Raspberry Pi now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.