For a long time I was searching for a cheap and easy to use module to expand the I/O interface of the Raspberry Pi. Important for me is that the module is supported by a Python library which makes the usage very comfortable and easy. The MCP23017 chip supports the I2C interface which could be used by the Raspberry Pi for communication.

Adafruit developed a Python library which could be used together with MCP23017 chip. This library makes it very easy to use the additional I/O ports from the MCP23017. This library makes the MCP23017 chip soldered on a small break out board with the 16 in/out pins ideal for the usage in small do it yourself projects.

MCP23017 Port Expander

MCP23017 Port Expander

MCP23017 use cases

The idea is to control a cheap relais which initial has no I2C bus for communication with the Raspberry Pi. With this tiny board the plan is to connect the relais to the MCP23017 board and to control the relais with the I2C bus of the MCP23017 chip to switch an IR light on or off which is connected to the relais.

MCP23017 I2C address configuration

On the back of the MCP23017 board all the pins are named or numbered depending on their function. With the pins A0 / A1 / A2 the I2C bus address could be set. The pins you need to solder on the board where included in the package. You only have to solder the pins on top of the board.

MCP23017 Port Expander back

MCP23017 Port Expander back

Python library:

Adafruit offers on their website a python library with which your python program could speak to the MCP23017 chip. This library could be installed form everyone on their Raspberry Pi to start programming the first program for the port expander.

Web site:

MCP23017 technical data:

16-Bit Remote Bidirektionale I/O-Port:
-I/O at default the pins are set as input

High-Speed I2C interface (MCP23017):
-100 kHz
-400 kHz
-1,7 MHz

High-Speed SPI interface (MCP23S17):
-10 MHz (maximum)


Three pins are available to set the hardware address to support up to eight devices on the I2C bus.

An extra pin is available for a hardware reset.

Operation voltages:
-1,8 V zu 5,5 V @-40 ° C bis + 85 ° C
-2,7 V zu 5,5 V @-40 ° C bis + 85 ° C
-4,5 V zu 5,5 V @-40 ° C bis + 125 ° C



(Visited 19 times, 1 visits today)