Using the MCP23008 output expander to get more GPIO pins.

Components

  • 1x MCP23008 output expander IC
  • 1x LED
  • 1x 270 Resistor

Datasheet


Instructions

Make the following connections:

  • VDD to 3.3v
  • GND to GND
  • A0, A1, A2 (Address select pins) to GND
  • RESET to 3.3v
  • GP0 to an LED, then through the resistor to GND

Look at and run output-expander.cpp. You should see the LED flash on and off.

Info

An output expander is useful in the case that we run out of digital pins. Since this IC uses I2C, we can connect many of them onto the same bus and get a huge amount of digital inputs or outputs.

A library was written to make using this device easier. Look in MCP23008.h to read the code.

Exercises

Exercise

Look in the MCP23008.h file and see if you can find out how to use the output expander to read inputs. Connect a button to another pin and use it to control the LED on pin 0.

Exercise

Connect 8 LEDs to the 8 outputs of the MCP23008 and use them to recreate the Knight Rider effect.