-
Notifications
You must be signed in to change notification settings - Fork 62
DHT sensor not found, check wiring #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, i'm facing the same problem. This does not run .... $ cat dev/simpletest.py #!/usr/bin/python3
import time
import board
import adafruit_dht
# Initial the dht device, with data pin connected to:
dhtDevice = adafruit_dht.DHT22(board.D18)
# you can pass DHT22 use_pulseio=False if you wouldn't like to use pulseio.
# This may be necessary on a Linux single board computer like the Raspberry Pi,
# but it will not work in CircuitPython.
#dhtDevice = adafruit_dht.DHT22(board.D18, use_pulseio=False)
while True:
try:
# Print the values to the serial port
temperature_c = dhtDevice.temperature
temperature_f = temperature_c * (9 / 5) + 32
humidity = dhtDevice.humidity
print(
"Temp: {:.1f} F / {:.1f} C Humidity: {}% ".format(
temperature_f, temperature_c, humidity
))
except RuntimeError as error:
# Errors happen fairly often, DHT's are hard to read, just keep going
print(error.args[0])
time.sleep(2.0)
continue
except Exception as error:
dhtDevice.exit()
raise error
time.sleep(10.0) which end up in "DHT sensor not found, check wiring" $ sudo python3 simpletest.py
DHT sensor not found, check wiring
DHT sensor not found, check wiring
DHT sensor not found, check wiring
received SIGINT
Traceback (most recent call last):
File "simpletest.py", line 18, in <module>
^C temperature_c = dhtDevice.temperature
File "/usr/local/lib/python3.8/dist-packages/adafruit_dht.py", line 253, in temperature
self.measure()
File "/usr/local/lib/python3.8/dist-packages/adafruit_dht.py", line 205, in measure
raise RuntimeError("DHT sensor not found, check wiring")
RuntimeError: DHT sensor not found, check wiring while $ cat PiTemp.py __version__= "0.1"
import sys
if sys.version_info < (3, 0):
sys.stdout.write("Sorry, requires Python 3.x, not Python 2.x\n")
sys.exit(1)
import time
import Adafruit_DHT
DELAY_SECONDS=15 # 15 Sec
DHT_SENSOR=Adafruit_DHT.DHT22
DHT_PIN=18
if __name__ == "__main__":
print("Um das Programm anzubrechen, drücke STRG+C ...")
while True:
try:
# Print the values to the serial port
humidity, temp = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
print("Temp: {0:0.1f} °C Humidity: {1:0.1f} % ".format(temp, humidity))
except RuntimeError as error:
print(error.args[0])
time.sleep(5.0) # In case of error retry after 5.0 seconds
continue
time.sleep(DELAY_SECONDS) works like a charm.
Any ideas? |
Same issue except my GPIO pin is 4. At this point I don't think the DHT11 even works with an RPi4...any solutions would be nice |
Can you try GPIO 18? That's Pin 12 on the 40-pin header. That one has Hardware-based PWM, so it's usually good for testing. If it does work with GPIO 18, then the issue may be that it isn't working with software PWM. |
Doesn't work on GPIO 18 either, I'm assuming the sensor is just faulty at this point and ordered a different brand of sensor. |
Try this one -> Adafruit_Python_DHT? DHT11 work well with my RPi4 when I use this library. |
I think it wrong to solve a problem by using a deprecated libraray which links to this (CircuitPython) library. However it's a dirty but working hack. |
I'm having the same issue. However, I can't get the deprecated library to work either... First I got an error due to the PI 4 not being supported, which I fixed with this dirty hack. I no longer get errors, but I'm stuck with I really hope someone comes up with a solution! Edit I'm embarrassed to say so, but my wiring actually turned out to be wrong. I'm happy to report that after fixing it, the sensor worked fine with the new library 😃 I would recommend checking the wiring for the 100th time, then try to run something else over the same pins. |
I get the same error on a raspberry pi 3 B. On my Raspberry Pi 4 with the same wiring everything works perfect with the circuit python library. On my Pi 3 I have to use the old deprecated one, but that works! |
I've been struggling with this issue too. I know the wiring is right because it works sometimes. However, I'm trying now a DHT22 and it is extremely temperamental, sometimes taking several minutes before correct readings. I've also encountered a few instances of "A full buffer was not returned. Try again.". I have modified the code to actually show the number of pulses received, and oddly enough it usually doesn't receive any pulses. As an example, I have this code that checks the sensor every two seconds. I'm using here a DHT22 sensor on a RaspberryPi Zero W, pin 4, and using the pulseio method. I've also tried pin 18 (as recommended above), with similar results.
I used to have a DHT11 sensor, and that one also had this issue often, but not as frequently. I could usually get 5 correct readings in 1 or 2 minutes. Unfortunately, it seems I've burned it so I can't do tests with it anymore. For reference, my pip list:
|
Please try the latest version from the repo. #62 just refined the bitbang version and should improve reliability. |
Unfortunately, that only changes it for the worse in my case. The bug should not have affected me (I was already using a DHT22 sensor), and using bitbang seems completely unable to return a result. In ~10 minutes, not a single pulse was seen. |
@bsolino Hello, I did a little investigation into this, you can follow my results here https://github.com/jposada202020/DHT_Investigation |
@jposada202020 I have also tried pins 4 and 17 with similar results (works but very infrequently), and both DHT11 and DHT22. I have done a quick test (just 3 minutes) on a Raspberry Pi 3 and I couldn't get a reading at all, always the "Check wiring" error. This is very odd, I will have to do a check at some point with different wires, or testing more ports on the Pi3. But it's weird that it's so inconsistent. |
@bsolino Agree with this kind of sensor everything could go wrong, and is very difficult to troubleshoot. These Sensor are very time dependent, and this is something that the RP is not very good at. At least in my experience. But the RP3 is indeed strange both have worked in my case, inconsistent but worked. |
FWIW I'm using the below code that I set up last week (13 Feb) and it works perfectly with a DHT22 connected to pin 4. Swap out the 22 for an 11 and change the dhtDevice setting to DHT11 and it gives me DHT sensor not found (same wiring - literally just changed out the 22 for an 11). I've tried it with 4 different DHT11's and 2 DHT22's - the 22's both work fine (about 50/50 valid reading + error messages various) but the 11's don't work at all.
from https://tutorials-raspberrypi.com/raspberry-pi-measure-humidity-temperature-dht11-dht22/ |
@john0sweet Are you using the new library there was a change in the library last week, could you try it and let us know, the change was to improve the trigger time int he DHT11 sensors. It would be helpful it you could try it. Thanks for your comments |
Pretty sure I'm on the new one - ran a pip update thisavo on it and ran the code again - same result. Still works fine with the 22 on any of the normal pins, but the 11s don't work on any pin - left one running for 5 minutes just to be sure. No valid data.
…________________________________
From: jposada202020 <notifications@github.com>
Sent: 20 February 2021 16:54
To: adafruit/Adafruit_CircuitPython_DHT <Adafruit_CircuitPython_DHT@noreply.github.com>
Cc: john0sweet <john0sweet@hotmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [adafruit/Adafruit_CircuitPython_DHT] DHT sensor not found, check wiring (#49)
@john0sweet<https://github.com/john0sweet> Are you using the new library there was a change in the library last week, could you try it and let us know, the change was to improve the trigger time int he DHT11 sensors. It would be helpful it you could try it. Thanks for your comments
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#49 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOWGRPMUYSQ3TDC7CW4WJLDS77SMFANCNFSM4RGYJYYA>.
|
@john0sweet interesting, do you know if this happens with this library only. have you test the DHT11 with other logic or board? As these DHT11 using a Pull-up resistor |
On my side (DHT22 with latest pip3 install of the dht library), the thing with |
I make the same observation: |
@Tob1as I was reviewing the changes from 3.5.3 I could see anything that badly affect the behavior. The revision introduced in 3.5.6 would improve the readings in the DHT11 sensor. It would not affect to the best of my knowledge the DHT22 readings. I just tested the new library with a DHT22 in pin D17 in a RP3. With some missing reading, but I got 15/20 readings taking the measure every 5 seconds. |
@Tob1as I review the PR, and I was wrong. Sorry about that. The intended change in 3.5.6 was to addresses mentioned the trigger time for DHT11. However in doing so, I used the '//' division instead of the / division, given a 0 every time. I have just submitted a new PR #64 to correct this. Thank you for pointing that out. |
@jposada202020 No problem, thanks for the fix 👍 |
@Tob1as Thanks, Changes are merged, they will be released soon!, and thanks fr the feeback and testing on the changes (y) |
Sorry, I forgot I had submitted this issue, and since I don't have the hardware to test whether the new version works and it looks like someone can already use it, I decided to close this issue, if you encounter the same problem you can open an issue yourself. |
I still have this problem: (installed adafruit lib with pip3) on my raspberry pi ZERO WH using DHT22 sensor import adafruit_dht
import board
import time
dht_device = adafruit_dht.DHT22(board.D4)
sleep_secs = 2
while True:
try:
temp = dht_device.temperature
hum = dht_device.humidity
print(temp, hum)
except Exception as e:
print(e)
time.sleep(sleep_secs) Output: on pin18 I only get DHT sensor not found. Any hints for me? |
Well this is not an answer to my question cause with the old lib all works (except for negative values -> That is why I considered switching at all....) |
So I have a new problem:
|
Same problem here, after some time the sensor gives no more data. Only a reboot solves this. Then it works again for some time until it dies again. |
Same problem here - except I am running the RPi 5, which as I'm finding out, is not compatible with many of the python modules written and used with older gen Pi's such as 4, and 3. Currently trying to get the DHT11 sensor running with the Adafruit_CircuitPython_DHT module, but have yet to get any output other than: "DHT sensor not found, check wiring" I tried two different DHT11 sensors, each a different brand, both display the same results. Anyone actually managed to get a reading using a Raspberry pi 5? |
I understand that is this a post from last year but did anyone figure out the issue on a Pi5? |
Maybe it works this way (see my post at the end): |
I'm using DHT11 on Rpi 4B and I turn to using Adafruit_CircuitPython_DHT today from Adafruit_Python_DHT. I had changed my code to fit the Adafruit_CircuitPython_DHT, but when I run it I meet this error:
I am sure the connection is fine, because after this error I run the former code and it work perfectly.
Here is the code that has been change to fit Adafruit_CircuitPython_DHT
And here is the former code
I am new to python and Rpi, and thanks for any help!
The text was updated successfully, but these errors were encountered: