letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.28k stars 2.22k forks source link

DHT22 stopped working after 20190830 update #2585

Closed Quart666 closed 4 years ago

Quart666 commented 5 years ago

I updated two of my ES8266 Wemos D1 today. Both of them have a DHT22. And after upgrade the values says NaN on both Wemos D1

TD-er commented 4 years ago

Any chance to get this fixed in an actual release?

There is quite a big chance it will be fixed, but not sure when, as I'm also working on a lot of other issues myself.

uzi18 commented 4 years ago

@dpomt please try to change gpio and save new settings and/or delete dht task and configure it one more time waiting for feedback

uzi18 commented 4 years ago

try this build: normal_ESP8266_4M1M.bin.zip

haldi4803 commented 4 years ago

Update here... I've updated to the "ESP_Easy_mega-20191119_normal_ESP8266_1M.bin". No Reset, kept settings. On one of my 3 ESP8266 DHT22 sensors and it works fine. Maybe the issue can be circumvented if you flash the old version and if it works update to a newer one. Or it just works with this version. It's running fine now for 1day 12 hours.

BUT Same as on the old version if i press the reset button, OR use software reset via Web Interface i get NaN until i replug the Power. Not sure if this is a hardware specific issue of this chinese board.

uzi18 commented 4 years ago

have tested on my own with DHT22 and after reboot from website have no NaN values

TD-er commented 4 years ago

BUT Same as on the old version if i press the reset button, OR use software reset via Web Interface i get NaN until i replug the Power.

And what if you just press submit on the task configuration page? This does trigger a new init of the plugin. Maybe the sensor is brought into some undefined state it can only get out of by power cycle, or more time to initialize?

haldi4803 commented 4 years ago

Nope, pressing Submit doesn't help. Only Powercirlce helps. Is Probably a Hardware issue and not Software related.

Roos-AID commented 4 years ago

@uzi18

try this build: normal_ESP8266_4M1M.bin.zip

After loading this build, the ESP is dead. It cannot connect to Wifi anymore. I had to flash blank_1MB.bin and an older version to get the chip up and running again.

ESP board ESP Chip ID: | 2497917 (0x261D7D) ESP Chip Frequency: | 80 MHz ESP Board Name: | PLATFORMIO_ESP01_1M

With this ESP01S board and the DHT22 as mentioned here https://www.ebay.ch/itm/AM2302-DHT22-ESP8266-Temperature-Humidity-Sensor-Wifi-Wireless-Module-ESP-01-01S/273598617288 the problem of NaN after Warm Boot remains with all latest firmwares.

Only a Power off-on cycle makes it working. Pressing the reset button on the DHT22 board does not help.

I strongly believe this is a hardware problem with this DHT22 module.

@uzi18 if you want I can mail the ESP01 and DHT22 board to you for your testing. I have multiple on stock (Netherlands).

Regards, Rob

uzi18 commented 4 years ago

@Roos-AID please contact me via https://gitter.im/uzi18

my image was for module with 4M flash

Roos-AID commented 4 years ago

I have been debugging this issue and found something interesting.

The problem is with the GPIO 2 line on the ESP01.

When a (cold or warm) boot is performed, then the GPIO 2 line gives exactly the same data as the TX line for the first 36 msec. After this the GPIO 2 line is polling the DHT22 with a 2mS low after which the DHT22 correctly responds.
The strange thing is, that after a cold boot, the DHT22 responds correctly to the 2mS low signal. After a warmboot, the DHT22 is with the TX data set in a strange state and cannot be reset other than with a power off-on.

So, I decided to use the GPIO0 line available on the ESP01. This does not get the TX data when booting. When we use GPIO0 on the ESP01 the DHT22 gives the correct data and no NaN after warmboot.

I hope above is clear. I can make some pics from my logic analyser show this.

TD-er commented 4 years ago

@Roos-AID Does look like the same findings as reported here

haldi4803 commented 4 years ago

So, I decided to use the GPIO0 line available on the ESP01. This does not get the TX data when booting. When we use GPIO0 on the ESP01 the DHT22 gives the correct data and no NaN after warmboot.

Makes sense now thanks. Any idea how i'd do that on this cheap boards that are hard wired? https://www.ebay.ch/itm/AM2302-DHT22-ESP8266-Temperature-Humidity-Sensor-Wifi-Wireless-Module-ESP-01-01S/273598617288?_trksid=p2485497.m4902.l9144

TD-er commented 4 years ago

The strange thing is, that after a cold boot, the DHT22 responds correctly to the 2mS low signal. After a warmboot, the DHT22 is with the TX data set in a strange state and cannot be reset other than with a power off-on.

I just re-read your comment and this part now does kinda make sense to me. From a cold boot, the DHT22 is probably not yet "booted" in the first several msec. Maybe the change in 20190830 was also a change of the core library, which now outputs a different string in the first 36 msec or the GPIO2 was in other builds switched sooner to "normal" behavior.

CONSULitAS commented 4 years ago

Maybe the change in 20190830 was also a change of the core library, which now outputs a different string in the first 36 msec or the GPIO2 was in other builds switched sooner to "normal" behavior.

No, this is output of the boot rom and is found on every ESP8266 device. 😢

Analysis and solution (hardware) see https://github.com/letscontrolit/ESPEasy/issues/2569#issuecomment-688901549

TD-er commented 4 years ago

This can also be closed. See #2569 for more information.