DHT22 measure fails

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
dsaad
Posts: 6
Joined: Wed Sep 22, 2021 11:06 am

DHT22 measure fails

Post by dsaad » Mon Feb 21, 2022 7:24 pm

My esp32 is loaded with 'esp32-20220117-v1.18.bin' firmware. I have tried to read the DHT measurement, but every time it failed. I have tried one time GPIO 23 and one time 4 and both of them failed.

Worth mentioning it is not my first time, I have used the same code on other esp32 boards with the exact same DHT22 sensor and worked every time, but now I don't know why I'm failing here.

Code: Select all

import machine
import dht
PIN23 = machine.Pin(23, machine.Pin.IN, machine.Pin.PULL_UP)
sensor = dht.DHT22(PIN23)
sensor.mearure()

Code: Select all

Traceback (most recent call last): File "<stdin>",
line 1, in <module> File "dht.py",
line 23, in measure OSError: [Errno 116] ETIMEDOUT
Attachments
photo_2022-02-21_20-21-56.jpg
Pic
photo_2022-02-21_20-21-56.jpg (219.26 KiB) Viewed 1936 times

User avatar
OlivierLenoir
Posts: 126
Joined: Fri Dec 13, 2019 7:10 pm
Location: Picardie, FR

Re: DHT22 measure fails

Post by OlivierLenoir » Mon Feb 21, 2022 7:57 pm

I'm maybe wrong, but, can you check gnd braising on ESP32 board, it does not seem good on the picture.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: DHT22 measure fails

Post by Roberthh » Tue Feb 22, 2022 7:19 am

Are pull-up resistors present on the data line? At the DHT22 sample I have it is soldered to the backside of the sensor.

Shards
Posts: 39
Joined: Fri Jun 25, 2021 5:14 pm
Location: Milton Keynes, UK

Re: DHT22 measure fails

Post by Shards » Tue Feb 22, 2022 2:39 pm

I've tested it with an ESP-32,running v1.18. It works just fine with your code. However, if I disconnect ground, power or data I get exactly the error you are seeing.

This is with no additional pull-up resistor.

Looks like Olivier is right to suspect the solder joint(s).

dsaad
Posts: 6
Joined: Wed Sep 22, 2021 11:06 am

Re: DHT22 measure fails

Post by dsaad » Tue Feb 22, 2022 8:45 pm

I have re-soldered everything and added a 10 K ohm resistor and check the solders and connections with multimeter and tried the code and again same error.

Is it possible, there is a problem with the sensor?
Attachments
photo_2022-02-22_21-41-35.jpg
Second pic
photo_2022-02-22_21-41-35.jpg (253.57 KiB) Viewed 1855 times

Post Reply