Closed DemiVis closed 10 months ago
I got this error too. Then I went to the github repo:
github.com/adafruit/Adafruit_CircuitPython_AHTx0.
---> In commit fe1abce dated Aug 15 (2023), a change was made to the calibrate command. The comment associated with the change was:
"# Newer AHT20's may not succeed, so wrapping in try/except"
When I downloaded this code and used it, the part worked.
BTW, new AHT20's from Adafruit have a RED led instead of GREEN led, which adds to the confusion :)
@berarduc I saw that try/except, but it still seemed to be failing for me. Maybe I'm misunderstanding something but I thought regardless it should've just pass if that write doesn't work, I still want my sensor to do the calibration if that's an option from the sensor manufacturer! :)
thank you!!! <3
hopefully resolved by merging https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/pull/19 mpy and pypi will take a day to update!
Relevant line: https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/blame/e7b71a57a769c57ce4efb95491dffc32e5940132/adafruit_ahtx0.py#L48
While trying to initialize a new AHT20 device ( shop link ) using a QT Py ESP32-S2 WiFi Dev Board with STEMMA QT ( shop link ) connected using a breadboard and wires (not STEMMA) between labelled QT Py
SCL
/SDA
and AHT20SCL
/SDA
, labeledGND
pins connected, and AHT20VIN
tied to QT Py3V
I was getting an error using the above code library on intial call with the following traceback:Upon further investigation using an analog discovery, I found the AHT20 was NACK-ing the first word of calibrate command (defined in this library as
AHTX0_CMD_CALIBRATE
). Initial soft reboot: followed by NACK of Calibrate command first word:I tried various other things, including manually emulating the library step by step to find the issue, and continually got NACK on that first word. Digging into the AHT20 documentation, I found this document that shows a different calibrate word in section 5.4
I modified my manual recreation of this library to use
0xBE
as the first word instead and it worked. So I downloaded this file directly, modified only line 48 (above) to readand the library works exactly as intended. Further calls to the returned object as shown in the guide work as expected for as long as I tested it.
I didn't want to submit a pull request as I'm not sure this update would be valid for all uses of the library, but wanted to report the issue I saw and subsequent solution.