AM2320 returns "nan" from humidity reading

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

AM2320 returns "nan" from humidity reading

Post by redgekko »

Hello all,

I recently purchased 20x AM2320 sensors. In circuit, almost all of them return "nan" when polled for humidity.

This was tested with the circuit provided in the Adafruit technical page for the sensor. The code was tested using the example code installed with the library. All libraries (AM2320 and dependencies) are up to date (1.2.0 for AM2320). I also rolled back the library to the previous (1.4.1 for AM2320) and had the same issue.

We found some AM2320 sensors that work and in the same circuit, with the same code, actually return numbers. This was tested by swapping out sensors from the circuit with that example code.

I'm not sure if the entire batch has this issue, but I can confirm that at least 17 of them do. (I'm a classroom teacher and am trying to track down the remaining ones.)

Just looking to see if anyone else has this issue and if it is solvable on my end or may be an issue with the sensor, itself.

Thank you.

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Can you post a photo of sample setup showing how these are being used? Could be related to something with connections.

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

Here is the circuit. Please note that pins (from left) are connected as follows:
1. Vcc (5v)
2. SDA on an Adafruit Metro (also connected to Vcc via a 10k pullup resistor)
3. GND
4. SCL on an Adafruit Metro (also connected to Vcc via a 10k pullup resistor)

I should have noted that this batch of AM2320's will properly return the temperature, just not the humidity. When I replace them with some previous AM2320's that I purchased, they return both temperature and humidity.

Again, all have been tested with the same code in this same circuit.
Attachments
AM2320-Circuit.jpg
AM2320-Circuit.jpg (326.32 KiB) Viewed 1053 times

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Thanks for the photo. That looks fine.

Which specific Metro board is being used?

These AM2320's are 20 units of this item?
https://www.adafruit.com/product/3721

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

These are the Metro 328's.

Yes, that link is the correct product link and I'm more than happy to share an order number with you if needed.

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Let's see if we can recreate the same issue here. Are you seeing this behavior running the example sketch from the library?
https://github.com/adafruit/Adafruit_AM ... am2320.ino

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

Yes, this is the code that I've been testing with.

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

It seems to be working fine here:
Screenshot from 2022-02-09 11-29-33.png
Screenshot from 2022-02-09 11-29-33.png (45 KiB) Viewed 1049 times
Do you have any 4.7k resistors you can try using for the pull ups? That's the only difference with the setup here. Using those values since they are shown in datasheet.
pullup.jpg
pullup.jpg (63.56 KiB) Viewed 1049 times

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

Thank you for this information.

I did not have any 4.7 k-ohm resistors so I put two 10k-ohm resistors in parallel, Hopefully 5 k-ohm is close enough.

I'm still getting the same results, shown below.
Attachments
Capture.JPG
Capture.JPG (44.29 KiB) Viewed 1046 times

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Thanks for trying. Seems like it's something else.

Really weird. You're seeing that same behavior on 17 AM2320's? Can swap out sensors, rerun same sketch, and get NANs?

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

I have a few of these sensors from a previous purchase and those work just fine, returning both temp and humidity. As far as I know (I've been able to test 17 of the 20... students have the others.) all the sensors from that latest purchase have this issue.

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Were these sensors ever used by the students? Is there a chance they were mis-wired at any point?

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

Three students built the circuit (with 10k pullups) and got that message. I checked their circuits, had them compile and download the provided code and they received the "nan" result for humidity, while receiving proper temperature readings.

I then collected the 14 others that I had in storage and ran them through the circuit that I snapped a photo of earlier. All the same result. I had some on hand from a previous purchase and as far as I can tell, all those worked.

Because the batches got mixed, it could be that 17 units from that order did not work, and 3 did. I do not recall how many I had left on hand, but it was less than five and all of those had worked in previous years as students used them in circuits.

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

Re: AM2320 returns "nan" from humidity reading

Post by adafruit_support_carter »

Could they be different sensors maybe? Are they labeled AM2320 on the front?

User avatar
redgekko
 
Posts: 13
Joined: Tue Apr 10, 2012 7:28 am

Re: AM2320 returns "nan" from humidity reading

Post by redgekko »

All the sensors that I have are labelled AM2320.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”