[Errno 121] Remote I/O error - AHT25 Sensor
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
Oh just saw this is the wrong repo. But anyway ... The error is the same. Can´t get your code working with your provided example ... Will also post this in the smbus2 repo.
Hi @DrKlipper! Indeed this repo is only for the AHT20, and as I don't own a AHT25 I won't be able to help you there. If your i2c commands work, I guess it means that something is probably wrong on your python script, not on the physical side of things (resistors). I'll close this issue for now, but feel free to fork this repo and develop a script for the AHT25!