Hi;
I'm using a Raspberry Pi 4 to control a small greenhouse. I have 3 SHT-30 Mesh-protected Weather-proof Temperature/Humidity Sensors and 1 VEML7700 Lux Sensor connected to a TCA9548A I2C Multiplexer. I check the readings every 5 seconds and perform various tasks based on the readings. I get occasional [Errno 121] Remote I/O errors from the VEML7700, maybe 2 per hour or so. Otherwise it returns correct readings. The 3 SHT-30s never error. This did not occur with the shorter wiring I was using when testing on my bench, but after installing in the greenhouse. I used the same type 4 conductor wire for all 4 sensors. I've switched out the 7700 but still get the errors at about the same rate. If it was a wiring issue, then I wouldn't get any valid readings, but most of the readings are good. Everything works, it's mostly just an irritation in the logs and display, but I would like to find a solution. I've updated the libraries, etc. I'm just wondering if there's some issue in the VEML7700 library that does not exist in the SHT-30 library since I get no errors with those.
intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
- adafruit_support_bill
- Posts: 88136
- Joined: Sat Feb 07, 2009 10:11 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
I2c was designed for short-range communication - originally between chips on the same board. Longer runs are more susceptible to interference and the added capacitance tends to round off the corners of the signals leading to marginal signals and increased communication errors.This did not occur with the shorter wiring I was using when testing on my bench, but after installing in the greenhouse.
You can slow down the bus clock, or use an active terminator to extend the range.
https://www.adafruit.com/product/4756
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Thanks for the info!
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
I purchased 4 LTC4311 I2C Extender / Active Terminator. I put one on each connection coming off of the TCA9548A I2C Multiplexer. So the connections go like this TCA9578A->LTC4311->long run of wire->Sensor. The long run of wire is not super long, maybe 10 to 15 feet. I have 3 temperature/humidity sensors and 1 light sensor connected to the TCA9578A.
I get more errors now than before and on pretty much all 4 sensors not just the light sensor.
I also replaced the TCA9548A when I did this as I had directly soldered the connections before and this time I used the connectors on the qwiic cables I purchased.
Like before, I get good readings between the errors, so it's not like it's wired incorrectly.
I wish there existed a back to back adapter so that I could easily bypass the LTC4311s but I can't seem to find one.
Here's an example of the errors I'm getting now:
2022-09-25 16:02:09.897650: fnReadTemp2: Top Near Middle, [Errno 121] Remote I/O error
2022-09-25 16:02:49.961721: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:02:59.920847: fnReadLUX1: [Errno 121] Remote I/O error
2022-09-25 16:02:59.958480: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:09.944088: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:19.943896: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:29.963086: fnReadOutsideTemp: [Errno 121] Remote I/O error
2022-09-25 16:03:39.886585: fnReadTemp2: Top Near Middle, [Errno 121] Remote I/O error
2022-09-25 16:03:44.922528: fnReadTemp2: Top Near Middle, CRC mismatch
2022-09-25 16:03:59.947106: fnReadOutsideTemp: CRC mismatch
How do I slow the buses down in Python? I can't seem to find an example of that. I think I may have been better off w/o the LTC4311s and just slowing the bus down. Maybe they don't work well with the TCA9578A.
Thanks for any input.
Fred
I get more errors now than before and on pretty much all 4 sensors not just the light sensor.
I also replaced the TCA9548A when I did this as I had directly soldered the connections before and this time I used the connectors on the qwiic cables I purchased.
Like before, I get good readings between the errors, so it's not like it's wired incorrectly.
I wish there existed a back to back adapter so that I could easily bypass the LTC4311s but I can't seem to find one.
Here's an example of the errors I'm getting now:
2022-09-25 16:02:09.897650: fnReadTemp2: Top Near Middle, [Errno 121] Remote I/O error
2022-09-25 16:02:49.961721: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:02:59.920847: fnReadLUX1: [Errno 121] Remote I/O error
2022-09-25 16:02:59.958480: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:09.944088: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:19.943896: fnReadOutsideTemp: CRC mismatch
2022-09-25 16:03:29.963086: fnReadOutsideTemp: [Errno 121] Remote I/O error
2022-09-25 16:03:39.886585: fnReadTemp2: Top Near Middle, [Errno 121] Remote I/O error
2022-09-25 16:03:44.922528: fnReadTemp2: Top Near Middle, CRC mismatch
2022-09-25 16:03:59.947106: fnReadOutsideTemp: CRC mismatch
How do I slow the buses down in Python? I can't seem to find an example of that. I think I may have been better off w/o the LTC4311s and just slowing the bus down. Maybe they don't work well with the TCA9578A.
Thanks for any input.
Fred
- adafruit_support_bill
- Posts: 88136
- Joined: Sat Feb 07, 2009 10:11 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
I would not expect interaction problems between the multiplexer and the active terminators. But I have not tested that configuation.
Here is an example of speeding up the bus in CircuitPython. You should also be able to slow it down by specifying a lower frequency:
https://github.com/todbot/circuitpython ... up-i2c-bus
Here is an example of speeding up the bus in CircuitPython. You should also be able to slow it down by specifying a lower frequency:
https://github.com/todbot/circuitpython ... up-i2c-bus
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Thanks for the info. I tried slowing the bus to 50,000 and it did reduce the errors other than crc. I still get some others, but mostly now it's crc errors and lots of them.
I did find this board "1568-1785-ND DEV-14495 QWIIC ADAPTER" which will let me quickly bypass the LTC4311s to see if that gets me back to where I was before. I've ordered some.
Fred
I did find this board "1568-1785-ND DEV-14495 QWIIC ADAPTER" which will let me quickly bypass the LTC4311s to see if that gets me back to where I was before. I've ordered some.
Fred
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Well... it seems no matter what I try I find no success.
What I decided to do, as I have a RPi4 was to stop using the TCA9548A since I can have 6 i2c busses. So I reconfigured my wiring for the relays and such so that I could free up the necessary pins.
I have 4 busses for each of the 4 sensors and 4 of the LTC4311. I have a 4.7k pull-up on each of the scl and sda pins of each LTC4311 terminators going to vin.
I spent hours trying to get access to the busses in Python. I could see them from i2cdetect -l, and when I would execute i2cdetect -y 6, for example, I see 44 (6 has one of the sht31d temp sensors attached).
So, finally after hours of reading I came across this: Adafruit Extended_Bus Library to all the busses from Python.
But, it seems to only work for the VEML7700 light sensor. The 3 sht31d sensors refuse to work. I don't notice any errors but it just does not find them.
In my config.txt
dtparam=i2c_arm=on
dtoverlay=i2c6,pins_22_23
dtoverlay=i2c5,pins_10_11
dtoverlay=i2c4,pins_8_9
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c1,pins_2_3
In my Python script:
from adafruit_extended_bus import ExtendedI2C as I2C
import adafruit_sht31d
import adafruit_veml7700
...
i2c6 = I2C(6) #Outside Temp TH_sensor_outside
i2c5 = I2C(5) #Light Sensor LUX_sensor1
i2c4 = I2C(4) #Temp sensor 2 TH_sensor2
i2c3 = I2C(3) #Temp sensor 1 TH_sensor1
TH_sensor_outside = adafruit_sht31d.SHT31D(i2c6)
LUX_sensor1 = adafruit_veml7700.VEML7700(i2c5)
TH_sensor2 = adafruit_sht31d.SHT31D(i2c4)
TH_sensor1 = adafruit_sht31d.SHT31D(i2c3)
Is there an issue with the adafruit_extended_bus lib and the sht31d lib?
Any clues or suggestions? It's very hard to locate examples of what I'm trying to do.
Thanks,
Fred
What I decided to do, as I have a RPi4 was to stop using the TCA9548A since I can have 6 i2c busses. So I reconfigured my wiring for the relays and such so that I could free up the necessary pins.
I have 4 busses for each of the 4 sensors and 4 of the LTC4311. I have a 4.7k pull-up on each of the scl and sda pins of each LTC4311 terminators going to vin.
I spent hours trying to get access to the busses in Python. I could see them from i2cdetect -l, and when I would execute i2cdetect -y 6, for example, I see 44 (6 has one of the sht31d temp sensors attached).
So, finally after hours of reading I came across this: Adafruit Extended_Bus Library to all the busses from Python.
But, it seems to only work for the VEML7700 light sensor. The 3 sht31d sensors refuse to work. I don't notice any errors but it just does not find them.
In my config.txt
dtparam=i2c_arm=on
dtoverlay=i2c6,pins_22_23
dtoverlay=i2c5,pins_10_11
dtoverlay=i2c4,pins_8_9
dtoverlay=i2c3,pins_4_5
dtoverlay=i2c1,pins_2_3
In my Python script:
from adafruit_extended_bus import ExtendedI2C as I2C
import adafruit_sht31d
import adafruit_veml7700
...
i2c6 = I2C(6) #Outside Temp TH_sensor_outside
i2c5 = I2C(5) #Light Sensor LUX_sensor1
i2c4 = I2C(4) #Temp sensor 2 TH_sensor2
i2c3 = I2C(3) #Temp sensor 1 TH_sensor1
TH_sensor_outside = adafruit_sht31d.SHT31D(i2c6)
LUX_sensor1 = adafruit_veml7700.VEML7700(i2c5)
TH_sensor2 = adafruit_sht31d.SHT31D(i2c4)
TH_sensor1 = adafruit_sht31d.SHT31D(i2c3)
Is there an issue with the adafruit_extended_bus lib and the sht31d lib?
Any clues or suggestions? It's very hard to locate examples of what I'm trying to do.
Thanks,
Fred
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Ok, a little more info.
I made a test program that was easier to test with vs my full controller program.
It turns out it's only I2C bus 6 that's having an issue. I switched 2 of the adafruit_sht31ds between bus 6 and 3 and the issue stays on bus 6.
The reason I thought they all failed was because I setup 6 first and had remarked out all the adafruit_sht31ds and the adafruit_veml7700 light sensor worked. The I just uncommented 6 to see if it would work and it failed so I thought they all did.
So it's not a wiring issue with the wiring to the adafruit_sht31d or the adafruit_sht31d itself, it's either a wiring issue internal to the plastic box I have this all in, or, a bad LTC4311 I2C terminator.
Or, is there an issue with I2C Bus 6 itself? I could move it to Bus 1 to see what happens, but that will have to wait until, if I have time tomorrow or next week.
Fred
I made a test program that was easier to test with vs my full controller program.
It turns out it's only I2C bus 6 that's having an issue. I switched 2 of the adafruit_sht31ds between bus 6 and 3 and the issue stays on bus 6.
The reason I thought they all failed was because I setup 6 first and had remarked out all the adafruit_sht31ds and the adafruit_veml7700 light sensor worked. The I just uncommented 6 to see if it would work and it failed so I thought they all did.
So it's not a wiring issue with the wiring to the adafruit_sht31d or the adafruit_sht31d itself, it's either a wiring issue internal to the plastic box I have this all in, or, a bad LTC4311 I2C terminator.
Or, is there an issue with I2C Bus 6 itself? I could move it to Bus 1 to see what happens, but that will have to wait until, if I have time tomorrow or next week.
Fred
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Well I had to make one more post, because in my frustrated state I thought I'd reversed the temp sensors between I2C busses 3 and 6 but didn't. Something is wrong with the sensor that was on 6, because when I actually switched them the problem followed the sensor.
Anyway, I have 3 out of 4 I2C things working now.
When time allows I'll track down if it's one the weatherproof connectors, the sensor, or the wire.
Fred
Anyway, I have 3 out of 4 I2C things working now.
When time allows I'll track down if it's one the weatherproof connectors, the sensor, or the wire.
Fred
- adafruit_support_bill
- Posts: 88136
- Joined: Sat Feb 07, 2009 10:11 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Sounds like you are closing in on the source of the problem. Let us know what you find.
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Update: so it turns out that when using cable of ANY length at all, it's best to use Ethernet cable, Cat5e or above. Use patch cables and cut and solder them if needed, patch cables have stranded connectors which tolerate flexing more than solid conductors that are used in Ethernet cable used for wiring buildings. Ethernet cable has 4 twisted pairs which are then themselves twisted together: this reduces EMI a lot, which is why they do it. Solder one of each twisted pair to ground.
This fixed my issues, together with the Adafruit I2C terminators.
I found it difficult to find good examples of configuring the RPi4 for multiple I2C buses, I'll paste in my config below.
I still have one issue which I find puzzling: The veml7700 light/lux sensor gives "[Errno 121] Remote I/O error", but ONLY when reading LUX, it gives NO errors when reading light value. I've slowed it's bus to 10,000, the buses with the sht31d temp/humidity sensors are running at 100,000 with no issues at all, and longer cables. I read it every 5 seconds. The faster I try to read the 7700 the more it gives errors (when reading LUX). The longer I space it out the fewer errors. Why would it matter which value I read?
Fred
How to make multiple I2C buses work... hope this helps someone!
In my RPi4 config.txt
#assign additional I2C busses
#10000 appears to be slowest baudrate, 400000 fastest
dtoverlay=i2c6,pins_22_23,baudrate=100000
dtoverlay=i2c5,pins_10_11,baudrate=10000
dtoverlay=i2c4,pins_8_9,baudrate=100000
dtoverlay=i2c3,pins_4_5,baudrate=100000
#dtoverlay=i2c1,pins_2_3,baudrate=50000
In my python app (leaving out normal stuff, just referencing what is needed to make the multiple I2C buses work)
from adafruit_extended_bus import ExtendedI2C as I2C
# Create I2C bus
i2c6 = I2C(6) #Outside Temp
i2c5 = I2C(5) #Light Sensor LUX_sensor1
i2c4 = I2C(4) #Temp sensor 2 TH_sensor2
i2c3 = I2C(3) #Temp sensor 1 TH_sensor1
#
TH_sensor_outside = adafruit_sht31d.SHT31D(i2c6)
LUX_sensor1 = adafruit_veml7700.VEML7700(i2c5)
TH_sensor2 = adafruit_sht31d.SHT31D(i2c4)
TH_sensor1 = adafruit_sht31d.SHT31D(i2c3)
This fixed my issues, together with the Adafruit I2C terminators.
I found it difficult to find good examples of configuring the RPi4 for multiple I2C buses, I'll paste in my config below.
I still have one issue which I find puzzling: The veml7700 light/lux sensor gives "[Errno 121] Remote I/O error", but ONLY when reading LUX, it gives NO errors when reading light value. I've slowed it's bus to 10,000, the buses with the sht31d temp/humidity sensors are running at 100,000 with no issues at all, and longer cables. I read it every 5 seconds. The faster I try to read the 7700 the more it gives errors (when reading LUX). The longer I space it out the fewer errors. Why would it matter which value I read?
Fred
How to make multiple I2C buses work... hope this helps someone!
In my RPi4 config.txt
#assign additional I2C busses
#10000 appears to be slowest baudrate, 400000 fastest
dtoverlay=i2c6,pins_22_23,baudrate=100000
dtoverlay=i2c5,pins_10_11,baudrate=10000
dtoverlay=i2c4,pins_8_9,baudrate=100000
dtoverlay=i2c3,pins_4_5,baudrate=100000
#dtoverlay=i2c1,pins_2_3,baudrate=50000
In my python app (leaving out normal stuff, just referencing what is needed to make the multiple I2C buses work)
from adafruit_extended_bus import ExtendedI2C as I2C
# Create I2C bus
i2c6 = I2C(6) #Outside Temp
i2c5 = I2C(5) #Light Sensor LUX_sensor1
i2c4 = I2C(4) #Temp sensor 2 TH_sensor2
i2c3 = I2C(3) #Temp sensor 1 TH_sensor1
#
TH_sensor_outside = adafruit_sht31d.SHT31D(i2c6)
LUX_sensor1 = adafruit_veml7700.VEML7700(i2c5)
TH_sensor2 = adafruit_sht31d.SHT31D(i2c4)
TH_sensor1 = adafruit_sht31d.SHT31D(i2c3)
- adafruit_support_bill
- Posts: 88136
- Joined: Sat Feb 07, 2009 10:11 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
For longer runs, good cabling is important. Ethernet cabling is readily available and reasonably priced.
How fast are you trying to read the Lux values? The Lux value is calculated from the raw light reading. There is no more IO overhead, just calculation overhead.
How fast are you trying to read the Lux values? The Lux value is calculated from the raw light reading. There is no more IO overhead, just calculation overhead.
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
Every 5 seconds. At that interval I get a few good reads and then an error (reading lux). If I go down to every 1 or 2 seconds it will give only errors.
Fred
Fred
- fwblack
- Posts: 13
- Joined: Wed May 25, 2022 11:45 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
The next chance I get, I'll try adding some parallel pull-up resistors to get the total pull-up resistance closer to the 2.2k the temperature/humidity sensors I'm using have: Adafruit product ID: 4099 SHT-30 mesh protected sensor has 2.2k pullups, the VEML7700 light sensor has 4.7k. Maybe that will help as the temp/humidity sensors are functionally flawlessly at 100,000MHz and I've slowed the I2C buss for the VEML7700 down to 10,000MHz and still having issues.
- adafruit_support_bill
- Posts: 88136
- Joined: Sat Feb 07, 2009 10:11 am
Re: intermittent [Errno 121] Remote I/O error w VEML7700 Lux Sensor
If you connect the VEML7700 sensors directly with a short length of cable, do you still see the I/O errors?
Please be positive and constructive with your questions and comments.