Help with pcf8574

I'm using arduino mega2560 to communicate with 4 i2c devices. 1 liquid crystal lcd, 1rtc, 2 pcf8574

Everything seems to work fine up until it dont. What seems to be happening is sometimes output on the pcf8574 just goes high state again. I'm trying to debug the issue.

My i2c connection is 1ft of 22gua stranded copper wire. The pcf8574 are within an inch from each other. They connect to 4 ch moosfet modules that are controlling solinoids and relays.

Just for testing I hooked up 10 amp inductive loads to the 120v realys and 10 amp inductive 12v loads to the mosfets, when I switch the loads really fast for a long time I didn't get and interference.

Does this sound like it could be interference problem? The arduino never hangs. It pretends as if nothing has changed and continues on

The pcf8574 devices don't have any resitors on the sda,scl lines.

The mosfet boards are using pc817 optocouplers. I have ran the 5v that powers the pcf8574 to the optocouplers and use set output of pcf8574 low to sink current and turn on mosfet.

It seems to just happen randomly. Could I benefit from using and pull up resistors? Do I need decoupling caps on the i2c devices?

I2C needs pullup resistors on SDA and SCL. Some I2C breakout boards include them.
Turn off the power and measure from SDA and SCL to the power supply + terminal
to see if they are there.

1 Like

I am showing 500ohm both sda to + and scl to +. does this mean i should add them?

Should i add them at the arduino or closer to the pcf8574?

500ohm sound pretty low?

that's unual. That is very low. Typical is 4.7k
If you can trace from those terminals to actual resistors that would be a start.
You can't add resistance because it would lower because it would be in parallel.
R(parallel=(R1*R2)/(R1+R2)

1 Like

yea i went right past me for a minute and then i was like wait a second.. Ill see what i can narrow it down to. thanks

Do you have other I2C devices you can do the same measurement on ?
Post a link for the pcf8574 so I can see what you are using.

1 Like

I have measured a brand new pcf8574 at the sda scl pins, they both measure 1k ohm. ,

my lcd measure 10k

https://www.amazon.com/dp/B01ICN5JB6?psc=1&ref=ppx_yo2_dt_b_product_details

i think i found the resistors on the pcf8674, should i remove them ?

Do they measure 500 ohms across the terminals ?
1k is still a bit low but may be ok. Did you try it with the one that measures 1k ?

1 Like

The board shows 6x 1K resistors. I guess 3 as pull-up/down for the dip switches, 2 for SCL/SDA pull-ups, and the final one for... pull-up for the INT line perhaps?

1K is much too low/strong for SCL/SDA lines. A bad design.

"102" = 10 X 10^2 = 1000 ohms

i have 2 of the pcf8574 with sda scl connected together, i took a brand new out of the the pack and they measure 1k, i think i found the resistor that pulling the sda scl pins up. should i remove them? does each chip need its own or should i just put them at the arduino side?

Also, what value would be appropriate do you think?

too high ? I would say too low, Typical , on every I2C circuit I've built that worked was 4.7k.
RECOMMENDED PULLUP FOR I2C

Is there a correct resistance for I2C pullups on SDA & SCL ?

Sorry!! I meant to say too low/strong. Corrected it before I saw your comment.

1 Like

YEAH, that's better

i am running the bus @100000 speed, but i have no way to measure capacitance that low

You don't need to. if you have less than 5 I2C devices they can each have 10k and it should
still work.
(five 10k resistors in parallel =2k)(the low end of the 2k to 10k acceptable range)

Do they measure 500 ohms across the terminals ?

1 Like

i replaced them now they measure 2.5k

I would recommend 10k since you have other I2C devices but you can go ahead and try it
like that and go from there.

I put 5kohm resistors in their place but I suspect the rtc clock module is the culprit now.