DHT11 Assistance

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

DHT11 Assistance

Post by cpeters1968 »

Hello,
I am trying to implement a DHT11 on my project for my students. I am using a Feather M4 Express, using CircuitPython 4.1, and using the latest libraries for that version. At the REPL, I typed in the following:

>>> import board
>>> import adafruit_dht
>>> a=adafruit_dht.DHT11(board.D5)
>>> a.temperature

I got the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/travis/build/adafruit/Adafruit_CircuitPython_Bundle/libraries/drivers/dht/adafruit_dht.py", line 227, in temperature
File "/home/travis/build/adafruit/Adafruit_CircuitPython_Bundle/libraries/drivers/dht/adafruit_dht.py", line 219, in measure
RuntimeError: DHT sensor not found, check wiring

I checked the wiring (tried both 3.3V and 5V at separate times to power the DHT11), and had the technician and another colleague verify the wiring. We also did a check on the pin D5, and it produced the proper timing (went from high to low for about 40 ms, and then went high . However, the data pin did not send out a response signal. I tested this with three DHT11s, and got the same result. Additionally, I used the previous 4.x library, and got the same result, except without the "/home/travis/build/adafruit/Adafruit_CircuitPython_Bundle/libraries/drivers/dht/ directory listing.

Any assistance would be greatly appreciated. Thank you for your time.
Best Regards,
Chris

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

Do you have a pull-up resistor installed on the data line?

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

Yes. I have it connected between the power and data lines.

Thank you for your rapid response.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

hmm - I realize that "it works for me" is not the most helpful response, but:

Code: Select all

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.1.0 on 2019-08-02; Adafruit Feather M4 Express with samd51j19
>>> import board
>>> import adafruit_dht
>>> a=adafruit_dht.DHT11(board.D5)
>>> a.temperature
26
>>> 
a few suggestions ... (from my own experiences)

Inspect all solder joints on the feather headers (the header is soldered, correct?)
Make sure your jumper wires are OK --try new ones.
If using breadboard - try different locations.
Make sure the DHT11 is oriented properly.

edited to add:
It may help to post a photo showing your wiring.
also note: I do not represent Adafruit - I'm another customer.

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

dht.jpg
dht.jpg (158.68 KiB) Viewed 3008 times
Thank you again for your response.
I used a new board, new wires, and verified the digital port was working by using an LED to test it. I still got the same result:

>>> a.temperature
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/travis/build/adafruit/Adafruit_CircuitPython_Bundle/libraries/drivers/dht/adafruit_dht.py", line 227, in temperature
File "/home/travis/build/adafruit/Adafruit_CircuitPython_Bundle/libraries/drivers/dht/adafruit_dht.py", line 219, in measure
RuntimeError: DHT sensor not found, check wiring

Attached is a photo of my circuit. Thank you again.
Best Regards,
Chris
Attachments
dht.jpg
dht.jpg (120.28 KiB) Viewed 3008 times

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

You need to connect a Ground wire.
I'm not sure your wiring is correct at all. see this page -- dht22 is the same as dht11 wiring
https://learn.adafruit.com/dht/dht-circuitpython-code

the pullup goes between data (pin2) and Power Pin1
pin 1 to 3.3V
pin 2 to D5
Pin 4 to ground

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

Thanks for the reply. I guess the photo I attached was the three-pin version (with pins from left to right: data, power, and ground). I tried the four-pin version too, and had it connected as you said, but got the same thing.

It's weird, as I got the other two sensors working (CdS photoresistor and moisture sensor), but this one just seems to be giving me some issue.

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

So I did another diagnostic. I hooked up my 3-pin DHT11 to my Feather M0 Express, and got a good readout. Since both feathers use CircuitPython 4.1, I copied the libraries from the feather M0 to the M4. However, it came up with the following errors:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_dht.py", line 227, in temperature
File "adafruit_dht.py", line 219, in measure
RuntimeError: DHT sensor not found, check wiring

I either get that error, or I get "None" at the readout.

I don't think I damaged my digital pins, as I can get a LED to light up.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

odd, but that verifies the output, not the input. You may want to see if it can read a 0 and 1 when connected to GND and 3.3V on D5.
Otherwise, I'm out of ideas. Sorry, I was not familiar with the 3 Pin DHT11.

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

Thank you for your time. What library version are you using? I'm using the latest 4 that was released two or three days ago.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

Yes -- it is the latest released version of adafruit_dht.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

I forgot to check, Are the headers soldered to the feather m4?
Do you have link for the source of the 3 pin DHT?

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

DHT11-Pinout-for-three-pin-and-four-pin-types-2.jpg
DHT11-Pinout-for-three-pin-and-four-pin-types-2.jpg (35.24 KiB) Viewed 2973 times
Yes, the headers are soldered. I'm attaching an image for both 3 and 4 pin versions of the DHT. I did get the 3-pin to work on the M0. It's just when I replace the M0 with the M4 it doesn't work.

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: DHT11 Assistance

Post by jerryn »

Sorry - I'm stumped.... I wish I had something else to offer other than verifying that the M4 input is working. You could just try a different input Pin.

User avatar
cpeters1968
 
Posts: 16
Joined: Fri Sep 06, 2019 9:16 am

Re: DHT11 Assistance

Post by cpeters1968 »

I just had pin 13 send a 0 and 1 to pin 5, and pin 5 got the right value.

It's weird that this isn't working.

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”