0

I have followed the given instruction in this site.

I got no error during installation. But when I try to execute sudo ./AdafruitDHT.py 2302 4

Failed to get reading. Try again!

Sometimes I get reading, but temperature and humidity values are wrong. Humidity around 3200%.

This is my pin configuration I have tested DHT22 without any error.

When I try joan's answer , my output is enter image description here

Thanks in advance.

  • Is the pigpio daemon running? You need to start it with sudo pigpiod. – joan Dec 6 '17 at 10:15
  • yes, after sudo pigpiod it worked. – Sachith Dec 6 '17 at 10:28
  • Correctly I hope. It is poor of me not to provide an error message if it fails to connect to the daemon. When I find time I will update the software. – joan Dec 6 '17 at 10:48
1

Perhaps your system is busy. The DHT22 supplies 40 bits of data each of which need to be accurately timed to determine if they are 0 or 1.

Most libraries seem to use busy waits to accumulate and time the bits. They try multiple reads until one seems correct.

(My) pigpio library is pretty immune from the system being busy.

I would use http://abyz.me.uk/rpi/pigpio/examples.html#pdif2_DHTXXD

  • Which (Broadcom numbered) GPIO are you using and what command are you using? Perhaps edit your question and add a photo of your set-up? – joan Dec 6 '17 at 9:14
  • added a photo of my configuration. and command is given in my code. – Sachith Dec 6 '17 at 9:43
  • I am suggesting you use my software. If you do and it doesn't work I need to see the command you issued and the response. – joan Dec 6 '17 at 9:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.