Potentially Faulty AHT20s

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

Hello!

I bought three AHT20 sensor breakout boards, and it seems they could be faulty. I've tried all three with both the adafruit_ahtx0 Python library on a Raspberry Pi, and a Wemos Mini D1 clone flashing with ESPHome. I've attached pictures of the wiring, as well as my ESPHome config and the demonstrated output for each.

I tried each of the three with both setups, but no scenario succeeded. After I tested them all, I also tried them with 5V in, but with the same result. I know the AHT20 chip itself doesn't support it, but the documentation for the Adafruit board says it supports 3-5V, and they had already failed with 3.3V anyway.

The RPI and the D1 board are known to work correctly with other sensors.

Of course I could be doing something wrong, particularly since I haven't used this sensor before, but with a simple I2C interface, I wouldn't think there's much to mess up.

Thanks!
Attachments
humidity-1.yaml.txt
(684 Bytes) Downloaded 2 times
esphome-out.txt
(3.76 KiB) Not downloaded yet
230914-205440.jpg
230914-205440.jpg (59.89 KiB) Viewed 176 times

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

Missed some attachments
Attachments
PXL_20230914_093734190.jpg
PXL_20230914_093734190.jpg (207.79 KiB) Viewed 175 times
PXL_20230914_093652979.jpg
PXL_20230914_093652979.jpg (183.85 KiB) Viewed 175 times

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

Vin should be the same as the logic level for the board:
https://learn.adafruit.com/adafruit-aht ... ns-3064408

Both the Pi and the Wemos are 3.3V logic level boards. Do not connect 5V to Vin.

Try going back to the Raspberry Pi setup, using 3.3V for power on Vin, and then try running an I2C scan:
https://learn.adafruit.com/scanning-i2c ... spberry-pi

Post the scan results here.

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

Hi!

Thanks for clarifying about the voltage.

The chip powers up and is visible, I'm having trouble getting it to communicate. The i2cdetect output is

Code: Select all

david@raspberrypi:~ $ 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: -- -- -- -- -- -- -- -- 

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

The I2C scan looks fine.

If you run the library example:
https://github.com/adafruit/Adafruit_Ci ... pletest.py
immediately after that scan, you get the same code error?

Is the error consistent? It's always an I/O error originating from line 96?

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

Hello Carter!

The call to AHTx0 is consistently failing at line 96 from the Remote I/O OSError. Here's the output from running the whole example script.

Code: Select all

(pyenv) david@raspberrypi:~/src/Adafruit_CircuitPython_AHTx0/examples $ python3 ahtx0_simpletest.py 
Traceback (most recent call last):
  File "/home/david/src/Adafruit_CircuitPython_AHTx0/examples/ahtx0_simpletest.py", line 15, in <module>
    sensor = adafruit_ahtx0.AHTx0(i2c)
  File "/home/david/pyenv/lib/python3.9/site-packages/adafruit_ahtx0.py", line 96, in __init__
    if not self.calibrate():
  File "/home/david/pyenv/lib/python3.9/site-packages/adafruit_ahtx0.py", line 114, in calibrate
    i2c.write(self._buf, start=0, end=3)
  File "/home/david/pyenv/lib/python3.9/site-packages/adafruit_bus_device/i2c_device.py", line 100, in write
    self.i2c.writeto(self.device_address, buf, start=start, end=end)
  File "/home/david/pyenv/lib/python3.9/site-packages/busio.py", line 202, in writeto
    return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=stop)
  File "/home/david/pyenv/lib/python3.9/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 52, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/home/david/pyenv/lib/python3.9/site-packages/Adafruit_PureIO/smbus.py", line 303, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

And that exact same behavior is being seen with all three AHT20 breakouts?

They show fine in scan. But then fail with same stack trace shown above when trying to run example?

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

Yes, correct.

User avatar
adafruit2
 
Posts: 21725
Joined: Fri Mar 11, 2005 7:36 pm

Re: Potentially Faulty AHT20s

Post by adafruit2 »

carter can you merge and have them test the updated release of
https://github.com/adafruit/Adafruit_Ci ... x0/pull/16
?

User avatar
adafruit2
 
Posts: 21725
Joined: Fri Mar 11, 2005 7:36 pm

Re: Potentially Faulty AHT20s

Post by adafruit2 »

for arduino, make sure you are running 2.0.5
https://github.com/adafruit/Adafruit_AHTX0/releases

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

Done. Please try updating to the 1.0.19 release of the library:
https://github.com/adafruit/Adafruit_Ci ... tag/1.0.19

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

The update worked, thank you!

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

Cool. Glad that fixed it.

Is it working on Arduino as well? Or whatever you were using on the ESPHome setup. As mentioned above, the Arduino library needs to be latest to also fix the same underlying issue.

User avatar
3w9qlts3h9ww
 
Posts: 7
Joined: Fri Sep 15, 2023 12:02 am

Re: Potentially Faulty AHT20s

Post by 3w9qlts3h9ww »

No, it's a D1 clone, and I think the component module is part of ESPHome, rather than using a library. I put in a bug report to see about getting it updated: https://github.com/esphome/issues/issues/4899

User avatar
adafruit_support_carter
 
Posts: 27435
Joined: Tue Nov 29, 2016 2:45 pm

Re: Potentially Faulty AHT20s

Post by adafruit_support_carter »

OK, that looks good. Sounds like in the ESPhome case they have their own separate copy of the driver. So that's the correct place to open the issue. Hopefully the fix there can be as simple as the patch to the Arduino lib.

Post Reply
Please be positive and constructive with your questions and comments.

Return to “General Project help”