General

AHT20

userHead Pieter.Verhoeven 2025-05-04 16:46:04 446 Views1 Replies

I am using raspberry pi4 and a grove hat to connect with AHT20 temp/RH sensor.

I try to use your DFRobot_AHT20.py and demo_read_aht20.py software but by running it I get the message “AHT20 is busy!”

 

I can read the 3, 4, 5 bytes so the temperature can be read.

The 1,2 bytes read 152,66 and do not change so the humidity cannot be read.

 

What can I change in the software?

2025-05-04 20:29:33

In the DFRobot_AHT20.py, ensure that after sending the trigger measurement command, you add a short delay (typically 75ms or more as per datasheet) before trying to read the results:

Find the section like this in DFRobot_AHT20.py:

self.i2cbus.write_i2c_block_data(self._address, 0xAC, [0x33, 0x00])
 

Make sure it's followed by a delay:

time.sleep(0.08)  # wait 80 ms for measurement
 

If there's no delay or a shorter one, increase it to 0.08 or even 0.1.

userHeadPic ahsrab.rifat