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.

3
  • Is the pigpio daemon running? You need to start it with sudo pigpiod.
    – joan
    Commented Dec 6, 2017 at 10:15
  • yes, after sudo pigpiod it worked. Commented Dec 6, 2017 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
    Commented Dec 6, 2017 at 10:48

1 Answer 1

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

3
  • 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
    Commented Dec 6, 2017 at 9:14
  • added a photo of my configuration. and command is given in my code. Commented Dec 6, 2017 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
    Commented Dec 6, 2017 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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