The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

MCP23017 - i2c

by Rahatmaini on Thu Nov 29, 2012 4:32 pm

I understand that Adafruit has a library for this, however, I do not know how to assemble this and wire it correctly. Is there anyplace that has detailed instructions for utilization of this chip, I do not know much about arduino as I am very new to this.
Posts: 165
Joined: Wed Aug 29, 2012 4:15 pm

Re: MCP23017 - i2c

by tldr on Sun Dec 02, 2012 10:30 am

start with the datasheet. it's linked from the product page.

pin nine is power and pin ten is ground.

pins 15,16 and 17 are address pins. just them to ground.. if you are going to put multiple mcp23017's on the same bus you can connect some of these pins to 5v to form up to seven additional addresses.

pins 12 and 13 are your i2c bus. 12 is the clock line and 13 is data. you might want pullups on these lines, though the arduino is supposed to take care of that.

pins 21-28 will be referred to as pins 0-7 in your code. pins 1-8 on the chip will be pins 8-15 in your code.

aaaargh. what am i doing? all of this is explained in the example code in the library.

"If I had known it was harmless, I would have killed it myself." - Phillip K. Dick, A Scanner Darkly
User avatar
Posts: 466
Joined: Thu Aug 30, 2012 12:34 am

Re: MCP23017 - i2c

by Rahatmaini on Wed Dec 05, 2012 4:23 pm

Thanks so much! Very helpful indeed, so i2c is just a fancy word for A4 and A5 on the arduino, huh? Tricky.
Posts: 165
Joined: Wed Aug 29, 2012 4:15 pm