0

I have two DHT22 sensors, connected to GPIO 4 AND GPIO 22 and 3.3V. It randomly shows -11.1 or 11.1 as output occasionally. See the sample log of polling it every few seconds using the "AdafruitDHT.py" which is modded to only show temperature for each sensor. The values are in Celsius.

Why is this and is it a coincidence that 11.1 is exactly half of 22.2?

It seems to happen more when I just started polling it, and less after running for a while, but it still happens

# Sensor log every 3 seconds 4: 22.3 - 22: 22.2 4: 22.2 - 22: 22.2 4: 22.2 - 22: 22.2 4: 22.2 - 22: -11.1 4: 22.2 - 22: 22.2 4: 22.2 - 22: 22.2 4: -11.1 - 22: 22.2 4: 22.2 - 22: 22.2 4: 22.2 - 22: 22.2 4: -11.1 - 22: 22.2 4: 22.2 - 22: 22.2 4: -11.1 - 22: 22.2 4: 22.2 - 22: 22.3 4: 22.2 - 22: 22.3 4: 22.2 - 22: 22.3 4: 22.2 - 22: 11.1 4: 22.2 - 22: 22.3

EDIT: When the temperature was different, it was exactly the half shown. 22.6, then 11.3 or -11.3. Also I ran it to thingspeak every 30 seconds, so I'm not polling it every 3 seconds normally, but it still happens.

  • It seems like the software is not validating the data and hasn't noticed it has missed a bit. – joan Sep 4 '17 at 21:54
  • Interesting! However, it has been running in cron every 30 seconds for 8 hours now, and haven't had one error. I had a new theory, that the cron was running at the same time as i manually run it, and that it somehow made it get wrong values. Does the DHT22 have some kind of "warmup time", that makes it stable after some hours of usage? – Niclas Sep 5 '17 at 5:01
  • Nope, the issue remains, and it's definitely half of the actual value. Is this a software issue? What other software can I try for this? – Niclas Sep 5 '17 at 8:57
  • You could try my abyz.co.uk/rpi/pigpio/examples.html#pdif2_DHTXXD – joan Sep 5 '17 at 9:01
  • Thanks, it was a little harder setting up, but it's very fast, and gives great error handling! I get error 3 from time to time, and I guess that's what would give the half/bad values using the other software. – Niclas Sep 5 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.