Answer the question
In order to leave comments, you need to log in
How to eliminate interference on i2c (Raspberry + pcf8574)?
Hello! Please do not kick hard, I just started getting acquainted with i2c. Not for work or production, but for self-knowledge and for the sake of a hobby.
A little background:
Two pcf8574s are connected to the Raspberry pi 4 via a level converter from 3.3v to 5v. The converter itself is connected close to the raspberry. And the devices going to it are connected with unshielded wires 20-30 cm long.
Everything seems to work, but only once. I specify LOW on pins 0 to 5, and HIGH on the 6th and 7th. Works but after a while. Sometimes the pins that pcf8574 HIGH should have randomly go to LOW when commanded, sometimes not. As if part of the team does not reach or does not reach as it should. Sometimes just like that, when idle, the pcf8574 resets and puts all the pins in the default state of HIGH
I soldered all the resistors from the level converter, both at the input and at the output (It makes no sense at the input, the raspberries already have 4.7k), I also soldered it with pcf8574 and set 28K for each. So in total it turned out 14K. Tell me what I'm doing wrong and what is the best resistor value? Where is the best place to put these resistors? Or reduce the value of the resistors? And where is it better to place, or evenly across all devices, including the converter itself, so that in total you get the desired rating or put resistors only at the very beginning on the level converter, and solder everything from the devices or vice versa? How is it better?
PS For manipulation, python + lib pcf8574_io is used, the i2c frequency is 100 kHz by default. I will add that there are a couple of other devices on the i2c line, but they work properly, the problem is the current with these pcf8574.
Upd. As time has shown, the reason is not in the cooler, but in the noise itself, static, etc., etc. the best solution to put after pcf8574 is uln2803 or optocouplers in general.
Answer the question
In order to leave comments, you need to log in
The pull-up resistors are probably not the issue.
If other I2C receivers work, then you should not play with pullup resistors.
It's probably a signal tracing issue.
It is necessary to analyze the entire entire chain, from the outlet and the raspberry power source to the specific loads to which the pcf8574 is connected.
Parasitic milliseconds and nanosecond switching currents in this circuit may well lead to chip failures if the routing allows these currents to pass through them.
put a pull-up resistor of 10 KΩ (by the way, I’m also on the raspberry now)
If it doesn’t work, put 1 KΩ
here is the datasheet:
https://static.chipdip.ru/lib/368/DOC004368150.pdf
but there is not a word about pull up pull up resistors
from sda and scl to the plus
I can't write comments (limit)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question