Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

No Humidity Reading from AHT20
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

No Humidity Reading from AHT20

by djotaku on Wed Aug 05, 2020 9:11 pm

I purchased the AHT20 breakout board: https://www.adafruit.com/product/4566

To start off, I connected it to an Onion Omega2+ via their Qwiic Exp board and STEMMA QT connector. I used the code that can be found here: https://gist.github.com/djotaku/d1a0613 ... acf1107955 -> this is the same code as https://learn.adafruit.com/adafruit-aht ... cuitpython, but with f-strings. (However, it's important to note that when I used EXACTLY the code from that site - as in no f-strings - it did not work)

I get a temperature reading, but not a humidity reading.

I went on the Adafruit discord to see if others could offer some help. After speaking on there, I tried the following:
  • Tried touching the sensor with my finger. In my experience, doing this with the enviro phat or Arduino ENV shield would cause the reading to go up from the humidity in my skin. This did not work. Also, the Clue Adabox Demo was reporting a 30% humidity in my room.
  • Next I tried a different Stemma/Qwiic port on the Onion Omega2+ in case the port I was using was bad. This still resulted in a temperature reading, but not Humidity.
  • Next I tried the OTHER stemma/Qwiic port on the AHT20 breakout. Same result again.
  • Next I tried a different cable in case the Stemma/Qwiic cable I was using was bad. Same result. Also, since the stemma is I2C, I imagine if I can get temp, everything is OK on the connection?
  • Then I was advised on the Adafruit Discord to try a different device in case it's the Onion Omega2+'s fault. So I tried my brand new Adafruit Clue from the Adabox 15. I first tried in CircuitPython as that is easy to do with that board. Once again, temperature, but not humidity.
  • Finally, I was asked to program it via the Arduino IDE. I did that, using the example code (I will list below so you can be confident in what I did). Once again, it did not work.

At this point, I was advised to post on this forum.

Appendices:

Code from Arduino programming:

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_AHTX0.h>

Adafruit_AHTX0 aht;

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit AHT10/AHT20 demo!");

  if (! aht.begin()) {
    Serial.println("Could not find AHT? Check wiring");
    while (1) delay(10);
  }
  Serial.println("AHT10 or AHT20 found");
}

void loop() {
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
  Serial.print("Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");
  Serial.print("Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");

  delay(500);
}


Output from serial monitor in Arduino mode:

Code: Select all | TOGGLE FULL SIZE

21:00:16.352 -> Temperature: 24.31 degrees C
21:00:16.352 -> Humidity: 0.00% rH
21:00:16.885 -> Temperature: 24.29 degrees C
21:00:16.885 -> Humidity: 0.00% rH
21:00:17.446 -> Temperature: 24.30 degrees C
21:00:17.446 -> Humidity: 0.00% rH
21:00:18.009 -> Temperature: 24.30 degrees C
21:00:18.009 -> Humidity: 0.00% rH

and so on and so forth


djotaku
 
Posts: 7
Joined: Tue Jul 14, 2020 6:40 pm

Re: No Humidity Reading from AHT20

by adafruit_support_carter on Thu Aug 06, 2020 12:36 pm

Let's continue to use the CLUE for testing.

How did you connect the CLUE and AHT20 together?

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: No Humidity Reading from AHT20

by djotaku on Thu Aug 06, 2020 6:28 pm

I used the Stemma/Qwiik connector between the board and the Clue

djotaku
 
Posts: 7
Joined: Tue Jul 14, 2020 6:40 pm

Re: No Humidity Reading from AHT20

by adafruit_support_carter on Thu Aug 06, 2020 6:59 pm

Excellent. Nice and easy.

OK, load CircuitPython back on to the CLUE and try running through these commands via the REPL and see what you get:
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CLUE nRF52840 Express with nRF52840
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> i2c.scan()
[28, 56, 57, 68, 106, 119]
>>> i2c.unlock()
>>> import adafruit_ahtx0
>>> sensor = adafruit_ahtx0.AHTx0(board.I2C())
>>> sensor.temperature
21.7892
>>> sensor.relative_humidity
50.025
>>>

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: No Humidity Reading from AHT20

by djotaku on Thu Aug 06, 2020 8:37 pm

OK, the first difference I got was on the scan.

Code: Select all | TOGGLE FULL SIZE
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> i2c.scan()
[8, 28, 56, 57, 68, 106, 119]


Then again a rel_hum of 0.0:

Code: Select all | TOGGLE FULL SIZE
>>> i2c.unlock()
>>> import adafruit_ahtx0
>>> sensor = adafruit_ahtx0.AHTx0(board.I2C())
sensor.temperature
24.2733
>>> sensor.relative_humidity
0.0

djotaku
 
Posts: 7
Joined: Tue Jul 14, 2020 6:40 pm

Re: No Humidity Reading from AHT20

by adafruit_support_carter on Thu Aug 06, 2020 8:46 pm

Interesting. Run the scan again a couple of times. Does that address of 8 keep showing up?

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: No Humidity Reading from AHT20

by djotaku on Thu Aug 06, 2020 8:54 pm

It goes away after the first scan:

Code: Select all | TOGGLE FULL SIZE
>>> i2c.try_lock()
True
>>> i2c.scan()
[8, 28, 56, 57, 68, 106, 119]
>>> i2c.scan()
[28, 56, 57, 68, 106, 119]
>>> i2c.scan()
[28, 56, 57, 68, 106, 119]
>>> i2c.scan()
[28, 56, 57, 68, 106, 119]
>>> i2c.scan()
[28, 56, 57, 68, 106, 119]


djotaku
 
Posts: 7
Joined: Tue Jul 14, 2020 6:40 pm

Re: No Humidity Reading from AHT20

by adafruit_support_carter on Thu Aug 06, 2020 9:00 pm

OK, thanks. I think that's unrelated to the humidity issue. Let's just replace your sensor.

Send an email to support@adafruit.com with a link to this thread and your order number and they can send you a replacement AHT20 sensor breakout board.

adafruit_support_carter
 
Posts: 16846
Joined: Tue Nov 29, 2016 2:45 pm

Re: No Humidity Reading from AHT20

by djotaku on Thu Aug 06, 2020 9:22 pm

OK. Thank you for your help. I have a new arsenal for debugging for the future.

djotaku
 
Posts: 7
Joined: Tue Jul 14, 2020 6:40 pm

Please be positive and constructive with your questions and comments.