I went through many other discussions but still couldn't find any solution.
I am trying to connect an SHT45 sensor (from Sensirion) via I2C to an ESP32.
When running my program the variables for temperature and humidity never changed (but program was workig).
So I tried to use an I2C scanner (used different ones I found on the internet and different forums) and it never finds any attached I2C device. (When trying to write data on a Sd card it works).
Following an I2C scanner code I used (get result "Found 0 devices(s)."):
Also, I am using an ESP32 - WROOM - 32.
SDA | SCL pin as in the code and I use 10k pull-up resistors as in the SHT4x Datasheet recommended (tried 4.7k; 14.7k and 20k as well).
The sensor is connected directly to a Litz wire and is following attached:
SDA -> Black
SCL -> Brown
GND -> Blue
3.3V -> RED
I am not an expert regarding these thematics, went through everything I found in the Internet regarding that topic, but am not sure if I maybe oversee anything stupid.
Thanks for the help
Has the I2C bus worked for this ESP32 board ?
Can you give a link to where you bought the ESP32 dev V4 board ?
Can you give a link to where you bought the SHT45 with that cable ?
Who added such a cable ? It is not allowed for the I2C bus. How long is it ?
Do you use the newest Arduino board definition for the ESP32 ?
Please use the common settings and default values, don't try to do something fancy. Use the SHT45 sensor without cable. Check the voltages with a multimeter. Use Wire.begin(); without specifying the pins:
void setup()
{
Serial.begin (115200);
Serial.println("The sketch has started, SDA and SCL are: ");
Serial.print(SDA);
Serial.print(", ");
Serial.println(SCL);
Wire.begin(); // Use the default pins
...
Then you see that SDA is 21 and SCL is 22. You already knew that
This is the official standard for the I2C bus: https://www.nxp.com/docs/en/user-guide/UM10204.pdf
In paragraph 7.5, page 54, you can read that the maximum length is 10 cm if you do it wrong.
The Litz wire is not just wrong, it is really bad for the I2C bus. The 10 cm can be 5 cm or 20 cm for Litz wire, no one knowns. You had it working for 50 cm, that was pure luck.
Do you have Cat5 cable ? Then use a twisted pair for SDA with GND and another twisted pair for SCL with GND and another twisted pair for Power and GND. Lower the impedance of the I2C bus with more pullup. Lower the bus speed. Then you "might" get to 120cm, even if the I2C bus is not meant for that.
Yes
Maybe the Cat5 cable will dampen the crosstalk by the Litz wire a little.
Can you use two Litz wires ?
The goal is that SDA is not near SCL. The I2C bus can not deal with crosstalk between SDA and SCL.