Introduction: LinkIt ONE – MCP23017 I2C Port Expander

The MCP23017 chip is an input and output expander, which uses the I2C communication protocol. You can connect it to your LinkIt One using two pins only (SDA, SLC) and get 16 digital I/O ports. Furthermore, you can connect up to eight expanders in series and get 128 digital ports, again using two pins. In this instructable we’ll see how to connect and use it. Let’s get it started!


The essential components for the use of the MCP23017 chip are:

  • Linkit ONE
  • MCP23017
  • Breadboard
  • Jumper wires
  • 10Kohm resistor
  • 2x 4.7Kohm resistors

If you want to reproduce the examples I did and I’ll show you in this instructable, you’ll also need the following components:

  • LCD Display 16x2
  • 10Kohm trimmer
  • 10x 100ohm resistor
  • 10x LEDs
  • Jack audio 3,5mm


I propose you a simple circuit in order to explain how to connect and use the MCP23017 chip. We’ll use the classic program Blink.


  • The expander’s VDD port to the LinkIt One’s 3,3V pin
  • The expander’s VVS port to the GND
  • The expander’s SLC port to a SCL pin
  • The expander’s SDA to a SDA pin
  • The expander’s ports A0, A1, A2 to the GND
  • The expander’s RESET port to the LinkIt One’s 3,3V pin by a 10Kohm resistor
  • The expander’s GPA0 port to the LED’s anode
  • The LED’s cathode to the GND by a 100ohm resistor

Above you’ll find the simulation on breadboard.

The pins 15, 16 and 17 of the MCP integrated circuit (that is to say the ports A0, A1 e A2) are really important because, depending on how you connect them, you set the expander’s I2C address; if you connect more than one expander in series, you can assign a unique address to each one of them.

Let’s move on to the sketch. In order to easily use the MCP23017 chip, you’ll need to download and install a library created by the Adafruit team. You can find it in their GitHub or in the attachment I added to this instructable. Now download and open the sketch. The comments in the program explain every single code line. Finally, set the switches to UART/SPI and load the program.

Easy? Now let’s move on something harder.

Step 3: VU METER

As seen in the previous example, the MCP23017 chip can directly drive an LED, so we don’t need a transistor. The chip can deliver 20mA per each output. Now we’ll see how to create a simple Vu Meter using the MCP23017 chip. Follow these steps:

  • Connect the expander’s outputs to the respective LED’s anodes by a 100ohm resistor
  • Connect all the LED’s cathodes to the GND
  • Connect the sleeve of the jack to the GND
  • Connect a channel audio of the jack to the LinkIt One’s A0 pin
  • Download and open the sketch that you find in the attachment
  • Load it on the LinkIt One board


Yes, we can also drive a LCD display using 2 pins only instead of 7. Take a look at the simulation on breadboard to see how to connect the components. You’ll notice that I used the 5V output in order to supply power to the display and to its contrast and the 3.3V output to supply power to MCP23017 chip. To move on with the programming, you’ll also need another library, which I attached to this instructable. Download and install it.

Now you can go on with the loading of the sketch, which you’ll find in the attachment as well.

You can also change the backlight, connecting the A pin to the 5V output and the K pin to the GPA6. Use the lcd.setBacklight(HIGH) and lcd.setBacklight(LOW) to switch on or switch off the backlight.

Step 5: END

I showed you some examples of the use of dell’MCP23017 chip, now try to use it for your project.

If you have any questions or doubt drop a comment below and I’ll be glad to help you.

Till next time!

Thanks to Pamela Pandolfi for the translation

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest