HOWTO using the I2C bus: #10827
Replies: 7 comments 7 replies
-
Thanks. |
Beta Was this translation helpful? Give feedback.
-
Thanks for usefull info! |
Beta Was this translation helpful? Give feedback.
-
An often used convention for selecting GPIO pins is Thus, this tends to be my selection on ESP8266, unless I have reasons to differ. For NodeMCU, I sometimes use a 6-way dupont wire shell (with 4 on the other end) to have an easy plugin matching a large part of the I2C sensors having SDA,SCL,GND,VCC. |
Beta Was this translation helpful? Give feedback.
-
Is TCA9548A still not supported in tasmota ? |
Beta Was this translation helpful? Give feedback.
-
Is there any other way to use 2 sensors with same i2c address in tasmota ? |
Beta Was this translation helpful? Give feedback.
-
I am not using I2C, so in my custom build I have commented out the line
I get a compiler error if I comment out these lines. I am worried that the I2C drivers 0 to 95 will be unnecessarily enabled - at least that is what the comments seem to indicate. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for this HOWTO. |
Beta Was this translation helpful? Give feedback.
-
About I²C (I2C, IIC) bus:
0.
About using the I²C bus:
SDA
on GPIO4 (D2) andSCL
on GPIO5 (D1). For ESP32 recommend using GPIO pins -SDA
on GPIO21 andSCL
on GPIO22.00:00:03.974 I2C: BME280 found at 0x76
00:00:03.985 I2C: BME280 found at 0x77
00:00:03.987 I2C: BH1750 found at 0x23
00:00:03.988 I2C: INA219 found at 0x40
00:00:03.989 I2C: INA219 found at 0x41
00:00:03.990 I2C: INA219 found at 0x44
i2cscan
command you can see the detected I²C devices.21:11:38.107 CMD: i2cscan
21:11:38.129 MQT: stat/Sonoff_Baro_1/RESULT = {"I2CScan":"Device(s) found at 0x23 0x40 0x41 0x44 0x76 0x77"}
I2cDriver
command (they are always enabled by default). More details (here).21:12:52.527 CMD: I2cDriver
21:12:52.534 MQT: stat/Sonoff_Baro_1/RESULT = {"I2CDriver":"3,4,5,7,10,11,14,47"}
21:13:45.850 CMD: I2cDriver14 0
21:13:45.857 MQT: stat/Sonoff_Baro_1/RESULT = {"I2CDriver":"3,4,5,7,10,11,!14,47"}
1.
Reserved I²C addresses:
2.
If it is necessary to "increase the capacity" of the I²C bus, then it is necessary to use - the PCA9515A repeater:
https://aliexpress.ru/item/32757561351.html
https://www.ti.com/lit...pdf?&ts=1589295453250
https://www.onsemi.com...lateral/PCA9517A-D.PDF
3.
If it is necessary to bypass the same addresses on the I²C bus, then it is necessary to use - TCA9548A multiplexer:
https://aliexpress.ru/item/4000067621113.html
https://www.ti.com/lit/ds/symlink/tca9548a.pdf
4.
If it is necessary to logically match the levels (for example 5V and 3.3V), then it is necessary to use - Level Translator PCA9306:
About logic level
no software support required (!).
https://www.ti.com/lit/gpn/PCA9306
https://www.sparkfun.com/products/15439
https://aliexpress.ru/item/4000507058874.html
https://aliexpress.ru/item/32805554320.html
5.
If you need to connect several sensors, you must use - I²C extender:
https://aliexpress.ru/item/4001116856790.html
https://aliexpress.ru/item/1005001351911782.html
https://aliexpress.ru/item/32964147782.html
https://aliexpress.ru/item/32965171426.html
https://www.ebay.com/itm/I2C-IIC-Extender-for-Arduino-Sensor-Shield-with-Cable/121200480686
6.
It is possible to combine different options (1+2+3+4).
7.
#UPD 1.
Manufacturer claims up to 100 feet (~ 30 meters) for each PCA9615 controller:
https://learn.sparkfun.com/tutorials/qwiic-differential-i2c-bus-extender-pca9615-hookup-guide
Sell here:
https://aliexpress.ru/item/33018940484.html
#UPD 2.
Here it is generally stated "up to 300 meters" on a twisted pair:
https://www.ebay.com/itm/RJ45-Differential-I2C-Long-Cable-Extender-PCA9600-with-Boost-Converter-Arduino/121765222831
https://www.ebay.com/itm/Differential-I2C-Long-Cable-Extender-PCA9600-with-Boost-Converter-for-Arduino/112580556568
#UPD 3.
The manufacturer claims up to 20 meters if you use two P82B715 controllers:
https://www.ebay.com/itm/I2C-IIC-Active-Long-Cable-Extender-P82B715-Module-for-Arduino-and-Other-MCUs/112292264539
Best regards,
TrDA.
Beta Was this translation helpful? Give feedback.
All reactions