szazo / DHT11_Python

Pure Python library for reading DHT11 sensor on Raspberry Pi
MIT License
296 stars 225 forks source link

ERR_MISSING_DATA #7

Open ChaseErnst opened 6 years ago

ChaseErnst commented 6 years ago

I have installed the package, but the error code 1, which is the ERR_MISSING_DATA code constantly throws. Any ideas?

szazo commented 6 years ago

Dear @ChaseErnst Can you try it whether works with https://github.com/adafruit/Adafruit_Python_DHT ?

viniciusvieir commented 6 years ago

I keep getting this error too. Any solution?

john-sexton commented 6 years ago

I had the same issue and moved my ground wire from pin 9 to 39 and now it works! (for some reason) here's how my wires look now: https://cloud.githubusercontent.com/assets/420851/20246902/1a03bafc-a9a8-11e6-8158-d68928b2e79f.png

rphillips-quavant commented 5 years ago

I'm getting intermittent Error code 1 and 2, no clear patten. In comparing the DHT11.read() routine to a C variant, the C version indicates the initial HIGH on the pin should be for ~500 milliseconds. It looks to be only set to 50 milliseconds in the code or am i miss reading the code.

Also I should mention i'm trying this on the ASUS TinkerBoard and using the ASUS GPIO library which may be part of my problem. I altered the 0.05 to 0.5 and not seeing much improvement but wanted to call it out.

Lukebray commented 5 years ago

I just wanted to say that I am also getting this issue. However I will try what the user above has tried and move my ground pin as I am also using pin 9. Will report back

BirdDogBoo commented 5 years ago

I think there is some confusion between the Pin number in the code and where to hook it up on the Pi. The code is specifying a GPIO pin 14, which is pin number 8 on the board. Pin 14 on the board is a ground and will throw an error if you hook up to it.

f3270 commented 5 years ago

I'm facing the same issue. But to check what's going on I added the "else: print("Error: %d" % result.error_code)" that is on the readme file. I've checked the connections and GPIO more than a couple of times ... and somewhere between the endless "error 1" msg (ERR_MISSING_DATA) I got one correct data msg ... I'm talking of about 30mins

Screenshot from 2019-04-16 22-41-20

I'm working on a RPi rev 2 board; I also tried with 2 DHT11 sensors and on 2 different RPi boards ...

f3270 commented 5 years ago

I had the same issue and moved my ground wire from pin 9 to 39 and now it works! (for some reason) here's how my wires look now: https://cloud.githubusercontent.com/assets/420851/20246902/1a03bafc-a9a8-11e6-8158-d68928b2e79f.png

didn't work for me ...

chilin0525 commented 3 years ago

I'm facing same issue of error code 1 and Adafruit_Python_DHT is working.

yoyojacky commented 2 years ago

try to check the pin connection and that example code may miss the signal, just try this:

import RPi.GPIO as GPIO
import dht11

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.cleanup()

instance = dht11.DHT11(17)  # here i am using BCM GPIO17 - physical pin11 - wringPi Pin 0(GPIO0)

try:
    while True:
        result = instance.read()
        if result.is_valid():
            print("Temperature: %-3.1f C" % result.temperature)
            print("Humidity: %-3.1f %%" % result.humidity)
except KeyboardInterrupt:
    GPIO.cleanup()
    print("Quit the loop...")

and then execute it, it will get the right result. dht11163501