Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Maker and IoT Ideas
Published © CC BY-NC

Redesigned MCP23017 Breakout

A completely redesigned MCP23017 IO expander breakout, easy to use and breadboard friendly.

BeginnerFull instructions provided1 hour370
Redesigned MCP23017 Breakout

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1

Story

Read more

Schematics

Schematic

Please note that this is the updated schematic for the TSSOP28 package of the MCP23017.

This design features selectable addressing pins, as well as an enable /disable jumper on the I2C pullup resistors. These should be enable if the device is alone on the i2c bus, but disabled if other devices are present. In that case, it is recommended to add physical pullup-resistors as close as possible to the microcontroller in use. These resistors are typically in the range of 2k2 to 4k7

Code

Example Coding

Arduino
Standard Wire.H example for the MCP23017

Please retype the code below, as copy pasting can sometimes introduce unwanted "hidden" characters, making the code difficult to compile
// pins 15~17 to GND, I2C bus address is 0x20
#include "Wire.h"
void setup()
{
 Wire.begin(); // wake up I2C bus
// set I/O pins to outputs
 Wire.beginTransmission(0x20);
 Wire.write(0x00); // IODIRA register
 Wire.write(0x00); // set all of port A to outputs
 Wire.endTransmission();
Wire.beginTransmission(0x20);
 Wire.write(0x01); // IODIRB register
 Wire.write(0x00); // set all of port B to outputs
 Wire.endTransmission();
}
void binaryCount()
{
 for (byte a=0; a<256; a++)
 {
 Wire.beginTransmission(0x20);
 Wire.write(0x12); // GPIOA
 Wire.write(a); // port A
 Wire.endTransmission();
Wire.beginTransmission(0x20);
 Wire.write(0x13); // GPIOB
 Wire.write(a); // port B
 Wire.endTransmission();
 }
}
void loop()
{
 binaryCount();
 delay(500);
}

Credits

Maker and IoT Ideas

Maker and IoT Ideas

96 projects • 25 followers
I design custom PCB solutions, usually with an IoT or Automation twist, to solve problems in my daily life. Sometimes also for other people.

Comments