Arduino I/O Expander with MCP23017 and 74HC4051

The I/O expander described in this post provides a total of 24 digital I/O ports as well as 16 analog ports. Each MCP23017 provides 16-bit, general purpose parallel I/O expansion for I2C bus or SPI applications. The 74HC4051 is a 8-channel analog multiplexer/ demultiplexer. The PCB shown below includes 2x MCP23017 and 2x 74HC4051.

The Arduino sketch is based on the wire library and the MCP23017 library from Adafruit. In this application the Analog In pins A0 and A1 of the Arduino board are used as inputs for the data from the analog mux/demux. The addresses for the 4051 and the ports are selected by utilizing the GPA port of one of the digital IO expanders MCP23017 and the I2C bus.

Resistors at ports X0 – X7 of the 74HC4051: The assembly and the values of these resistors at the individual ports depend on the application. For example, if used to read voltages in combination with an Arduino UNO, the voltage at the port should not exceed 5V, unless the settings for the AREF pin have been changed. The values in the schematic are only examples. The values of the resistors that have been assembled have to be entered into the sketch to enable the calculation of the actual voltage at the terminal.
The VEE pin of the 74HC4051 is connected to GND via resistor R9: 0 Ohm, since only voltages >0V will be measured.
IC5, IC6: MCP23017 The addresses for IC5 and IC6 are hardwired on the PCB, they are also shown on the silkscreen of the PCB. Interrupts A and B for each MCP23017 (IC5, IC6) are available at terminals, if needed. The RESET pins of IC5 and IC6 are connected to VCC.

Link to the Arduino sketch (Text File): MUXREV1_122812

Credits & Links for more Information:

Datasheets: 74HC4051   MCP23017

Adafruit MCP23017 Library for Arduino

Maximizing your Arduino’s I/O Ports

Analog Multiplexer 74HC4051


Leave a Reply

Your email address will not be published. Required fields are marked *