6

I want to switch data reading from multiple sensors by line buffer IC (74F244). My problem is I can't read anything from sensor when I connect via IC but can when connect sensor to ESP32 directly. I found that endTransmission() in this code return 2 but return 0 when connect directly.

How can I use endTransmission via line buffer IC ?

void setBH1750Mode( byte i2c_addr, byte mode ) {
  Wire.beginTransmission( i2c_addr );
  Wire.write( mode );
  Wire.endTransmission();
  delay(200); // delay for 200 msec
}
Bence Kaulics
  • 7,843
  • 8
  • 42
  • 90
3ORZ
  • 61
  • 1

1 Answers1

2

I2C is a "bus", as in bi-directional. You signal the device at its address that you want some data from it, and it sends it back. Now I'm no electrical engineer graduate, but the 74F244 chips looks like a one-way buffer. You have "input" and "output" lines, and from the datasheet (link (pdf)), it does not look bi-directional to me.

What exactly are you trying to do? A normal I2C bus should be able to accommodate several devices, as long as their slave addresses are all different. The ESP32 has built in SDA/SCL pins, so you should just be able to hook up all your devices directly without having to use the buffer chip...unless there is some reason this won't work that you didn't mention :)

There is plenty of info about how I2C works on other Stack Exchange sites like this question that mentions the BH1750. Google for "ESP32 I2C" and it brings up a bunch of info that might help.

Helmar
  • 8,450
  • 6
  • 36
  • 84
JD Allen
  • 618
  • 4
  • 8