How can I simultaneously connect a UART device and an I2C device to a Raspberry Pi via a Cat6 cable?
I have been researching related questions to this one for a while but decided I needed to ask this myself, as no one seems to be having quite the same issue and I am not knowledgeable enough yet to extrapolate an answer based on related discussions on this (and other) forums.
I am trying to use my RPi 3B to receive data from a I2C device (BME280 mudule) and a UART device (MH-Z19B). Due to logistical constraints, these two devices must be located in the same spot, approximately 25 ft away from the Pi. I have purchased a 50-foot (15.2 m) cat6 ethernet cable and a pair of surface mount boxes (see links below) for the purpose of connecting the two devices to the Pi.
What I’ve read so far seems to indicate that both I2C and UART struggle to send data reliably over a distance of more than a few inches, and that if I want to send them over this 50-foot cable, I will need a P82B715 bus extender for I2C and a RS232 (or RS485) for UART.
SO my question is, what is the best way for me to wire both of these devices, as well as the necessary drivers/extenders, through my cat6 cable? I am aware that one must be careful which signals are assigned to twisted pairs, so as to avoid crosstalk.
Equipment I’ve purchased:
-Surface mount boxes (x2): https://www.amazon.com/gp/product/B005E2Y9WY/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1i2cuartShareEditFollowCloseFlagasked 1 hour agoFishInTheDesert1122 bronze badges New contributor
- #FishInTheDesert, Welcome and nice to meet you. Ah let me see. Your question is interesting and well presented. Some two years ago, I played with Rpi3B+ and more than a couple of UART/serial and I2C sensors and actuators. For UART/serial at 9k68n1, 5V TTL, using dsub 9 pin, double sealed cables, usually you can do up to 30 meters without any problem. (2) For I2C, at 100kHz, usually you can easily talk reliably up to 2 meters. I did use P82B715 and CAT5 to do “a little bit” longer, if not overloading the I2C bus with too many devices, exceeding 400pF impedance limit. (3) / to continue, …. – tlfong01 16 mins ago
- You can search rpi.org.forum for more details: (4) Search query “I2C, tlfong01” found 180 matches: raspberrypi.org/forums/search.php?keywords=I2C+tlfong01 (5) Search query “P82B715, tlfong01” found 18 matches: raspberrypi.org/forums/search.php?keywords=P82B715+tlfong01 – tlfong01 9 mins ago
- You can also search RpiSE forum my other answers for I2C sensors. For example, (6) Rpi3 BMP180 Barometer Sensor Interface Problem – SO, Asked 11 months ago Active 8 months ago Viewed 757 times stackoverflow.com/questions/60274562/… (7) How can Rpi interface BME180/BMP280 pressure and humidity sensor? – Rpi SE, Asked 7 months ago Active 7 months ago Viewed 533 times raspberrypi.stackexchange.com/questions/113646/…. Have a nice project. Cheers. – tlfong01 41 secs ago Edit
I²C is designed to operate over short distances, typically on the same board.