python_sensor_aht20 icon indicating copy to clipboard operation
python_sensor_aht20 copied to clipboard

[Errno 121] Remote I/O error - AHT25 Sensor

Open DrKlipper opened this issue 2 months ago • 1 comments

Hi !

I try to write some python code for reading the AHT25 sensor. The sensor is nothing special - only a humidity / temp sensor.

It´s connected to the Pi 4 directly with 15cm of wire cable to the I2C port of the Pi (Pin 3, 5).

If I use i2cdetect I can see the sensor:

pi@Pi4Test:~/python_sensor_aht20 $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Using i2ctransfer works also with no problems:

pi@Pi4Test:~/python_sensor_aht20 $ i2ctransfer -y 1 w3@0x38 0xac 0x33 0x00 r6
0x98 0x74 0xeb 0x35 0xe4 0x92

And if I decode the resulting bytes I get plausible readings. I even can see that the temp rises when I touch the sensor.

Now I tried to read the sensor with your python lib but without any luck ... I always got errors like this:

    i2cBus.write_i2c_block_data(AHT20_I2CADDR, 0x0, AHT20_CMD_SOFTRESET)
  File "/home/pi/messy/.virtualenvs/Source/lib/python3.11/site-packages/smbus2/smbus2.py", line 643, in write_i2c_block_data
    ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error

Sometime I see Error 5, too (Input Output error)

I tried pullups with 2k2, 4k7 and 10k. But nothing seems to help.

Do you have any idea what can cause this errors? It´s frustrating ... All other sensors I try work like a charm. But this sensor drives me crazy :-)

Hope on any hint.

Dominik

DrKlipper avatar May 06 '24 18:05 DrKlipper