Micro and i2C on a MCP23017

This is my first time trying to use i2C and I cannot seem to get it going.

I have done basic troubleshooting down the line and have isolated it, seemingly, to just getting the i2C signal from the Arduino Micro to the MCP23017 chip.

At this point, I’m testing using an example code (the “Button” code from the MCP23017 library), so I know it’s a hardware problem. (Well…user problem, most likely.)

I’ve attached a picture of what I currently have set up. I have removed all other components just to try and isolate the issue.

The black wire coming out of pin #21 is going to a button to ground for testing. The larger breadboard is receiving external power further to the right.

Any thoughts? Thanks!

There is arduino code for an I2C address scanner. It will show the addresses of devices that it finds on the I2C bus.

E.g. Arduino playground - i2c_scanner

Does it find your device?

Do you have pull-ups on the SDA and SCL lines? 4k7 resistors?

Jimmy

Also I can't see any power being connected to the bread board.

Grumpy_Mike:
Also I can't see any power being connected to the bread board.

OP mentioned a power supply at the right :wink: But one can indeed not see it to check.

OP mentioned a power supply at the right

Yes but while the 5V rail might be connected beginners often forget the ground. :slight_smile:

Ground between Arduino and breadboard might indeed not be there.

Thanks everyone for the ideas!

sterretje:
There is arduino code for an I2C address scanner. It will show the addresses of devices that it finds on the I2C bus.

E.g. Arduino playground - i2c_scanner

Does it find your device?

Great tool! I just loaded it up and I ended up with the following:

Scanning...
Unknow error at address 0x20
No I2C devices found

Sometimes it would just say no devices found without the unknown error.

mixographer:
Do you have pull-ups on the SDA and SCL lines? 4k7 resistors?

Jimmy

I did not, but when I added them, the scanner would get stuck in the "Scanning" phase.

And, to all the power questions; yes, I do have it grounded as well. I even ran a multi-meter over everything to make sure I had consistent and correct voltage. Always worth double checking!

GOT IT.

The Arduino, the MCP23017, and the relay controller all have to be on the same power supply. I was trying to power the MCP and relay board separately from the Arduino, but it would seem that they require a common ground.

Thanks for all the help and especially to sterretje for the scanner. That's an awesome troubleshooting tool.

but it would seem that they require a common ground.

Well who would have thought it, just like every other piece of electronics equipment then.
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

jmellars:
. . . but it would seem that they require a common ground. . .

As was explicitly pointed out to you in post #6