Arduino and i2c


I'm using tutorial: to interface a 8 pin dip switch and an Arduino.

I'm using a PCA9674:

I have one side all the dips grounded, the other side is connected to +5v with 10K resistors, and also connected to the input pins on the I2C.

The rest of the I2C is connected like the tutorial says. I have connected the interrupt pin to ground, +5 and to the Arduino (not all at the same time).

The problem I'm having is I am unable to pull any data off using the Arduino code from the playground. I was hoping someone could help me. I wanted to use the dip and i2c to set a ID for wireless Arduino,Xbee combination's.

Thanks Kevin

I do it the other way around.

I connect one side of the switch to 5 volts and the other to the chips I/O and a 10k resistor connected to the chips I/O pulling it down.

5v ---/ --------:--------- the chips i/o : Gnd -–(10k)-----

I have one side all the dips grounded

What does that mean please? It doesn't sound right.

I have connected the interrupt pin to ground,

That is defiantly not right.

What are you doing with the reset pin on the 967? What address are you using in the software you are running? Have you connected AD0, AD1, AD2 to ground?

It matters not which way round you have the buttons but pulling down with 10K is a bit too high for my liking. Pull up with 10K and ground through your push switch is what I would do.

I have A0, A1, A2 grounded

I'm using address 0x50

and have ground-> ---o/ o-- -> ---\/\/\10k/\/--- vcc |--> input pin on i2c

so I'm using the 10K as a pull up

There is no reset pin, but i've tried connecting the interupt pin to ground, vcc, nothing...

Also, it the program freeze on the

 temp = i2c_eeprom_read_byte( 0x50, 1 );

so it feeld like i'm just missing something

Thanks Kevin

it feeld like i'm just missing something

I think so. Why would you expect code for a microchip EEPROM do anything useful with a Phillips IO expander?

Write (or find) some code that talks to the PCA9674 and you'll have a bit more luck.


well now don't i feel dumb

Thanks for your Help Kevin

I can see where one could be misled by the idea of a “standard”, but I2C just dictates electrical properties, etc up to how a byte flies across the wire. What the devices do with the bytes are still up to the device manufacturer.

I2C only removes part of the interfacing puzzle.

You wouldn’t want it to actually be easy, would you? :slight_smile:


I2C really does require you to become well acquainted with the device's data sheet.