0

How to know if Temperature and humidity sensor DHT11 is working. I am trying to read data from DHT11, when I read data using Adafruit library it just keeps waiting for data. When I tried using https://github.com/szazo/DHT11_Python it gives me error code 1, which means missing data.

Please help me out.

2

I suggest you try with my example DHTXX code.

Extract the zip to a directory and then compile/link with

gcc -Wall -pthread -o DHTXXD test_DHTXXD.c DHTXXD.c -lpigpiod_if2

The start the daemon

sudo pigpiod

and run the code

/DHTXXD -g4 # assuming you are using Broadcom GPIO 4

pigpio is pre-installed on recent Raspbians, otherwise try sudo apt-get install pigpio or see http://abyz.me.uk/rpi/pigpio/download.html

  • Thanks for the suggestion but my code suddenly started to work, dont know why it was not working earlier. But my question is still not answered because what you have provided is code to receive data as humidity and temperature. I was hoping there would be some way other than this to check the sensor. – Shubham Tayal Jun 25 '16 at 17:45
  • @ShubhamTayal Check in what sense? It's a digital sensor. You send a trigger and it sends a series of pulses in response. – joan Jun 25 '16 at 18:51
  • @joan Please let me thank you for that sample code, sir. Better than any other I tried; better than what I did so far; to-the-point frontend code. – Eric Platon May 16 '17 at 7:13

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.