arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.75k stars 4.72k forks source link

after upgrade to Tasmota 10.1.0 - DHT22 don't work #14088

Closed mkonsel closed 2 years ago

mkonsel commented 2 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. after update to 10.0.1.0, the AM2301 don't work. it's a "NULL" value debug logging: 12:32:35.888 DHT: Timeout waiting for start signal low pulse the DHT22 is power up with GPIO13 set to "OUTPUT HI": this configuration always works with tasmota 10.0.0 (tasmota32.bin)

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [ ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ ] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:
12:32:35.888 DHT: Timeout waiting for start signal low pulse

TO REPRODUCE

Steps to reproduce the behavior: wiring DHT22 sensor to board

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen. normally, tasmota display temperature e humidity from DHT22

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

mkonsel commented 2 years ago

Downgrade to release 10.0.0. DHT22 works, temperature and humidity shown on tasmota web homepage

sfromis commented 2 years ago

Just checked, my DHT22 works fine with Tasmota 10.1.0. In my case, I allow it to be powered from the start, instead of powering up a bit later during the boot.

During normal operation, some timeout messages does appear to be quite common, within a few seconds of enabling logging, I saw DHT: Timeout waiting for start signal high pulse

mkonsel commented 2 years ago

with Tasmota 10.1.0 stable release, the DHT work at boot, after 2-3 minutes: null value . With latest developer release 10.1.0.1 , null value immediately after boot

sfromis commented 2 years ago

My version 10.1.0 binary was already 10.1.0.1, but with a fresh source download and build (still 10.1.0.1), I'm now seeing null values too.

sfromis commented 2 years ago

Playing a bit more with DHT22 due to another issue, I've found that while it has worked nicely with ESP8266, it is at best flaky with ESP32, and during the test with negative temperatures, it completely stopped working, all I could get was the timeout message I already posted. Only after switching to ESP8266, I could run the test to get debug with negative temperatures.

I tend to suspect a timing issue, as the inherent delays due to execution speed will be different from ESP8266 to ESP32.

Even during "normal" operation, where it appears to work, for every reading (including the new debug message), I'm first getting a timeout message, this is a persistent pattern:

11:00:02.868 DHT: Read 0200000000
11:00:04.762 DHT: Timeout waiting for start signal low pulse
11:00:04.764 DHT: Read 0222020C33
11:00:06.762 DHT: Timeout waiting for start signal low pulse
11:00:06.763 DHT: Read 022A020C3B
11:00:08.769 DHT: Timeout waiting for start signal low pulse
11:00:08.771 DHT: Read 022C020C3D
11:00:10.774 DHT: Timeout waiting for start signal low pulse
11:00:10.776 DHT: Read 022E020C3F

And it did not take long till I started getting null instead of sensor values, even if the debug messages still appear to have reasonable data incoming (ignoring the timeout message).

arendst commented 2 years ago

I'm afraid we need an ESP32 special driver for the DHTxx sensors like I did for the DS18B20. The timings are very critical so tinkering with the current driver while keeping it functional for the ESP8266 is impossible.

The quick and easy way is porting a DHTxx driver for the ESP32 in the wild to Tasmota.

arendst commented 2 years ago

I'll have a go at it now.

arendst commented 2 years ago

Just released a new DHT driver specifically for the ESP32 based on the Adafruit DHT library. If it still doesn't work blame Adafruit ;-)

BTW both drivers work fine with me; they loose a reading once or twice a minute but that shouldn't be a problem for a slow device like a temperature sensor which is polled every four seconds.

00:00:00.001 HDW: ESP32-C3 
00:00:00.010 UFS: FlashFS mounted with 304 kB free
00:00:00.027 CFG: Loaded from File, Count 118
00:00:00.032 QPC: Count 1
00:00:00.035 ROT: Mode 1
00:00:00.036 BRY: GC from 1907 to 1907 bytes, objects freed 0/1 (in 0 ms)
00:00:00.041 BRY: GC from 3914 to 3346 bytes, objects freed 5/20 (in 1 ms)
00:00:00.082 CFG: no '*.autoconf' file found
00:00:00.085 BRY: GC from 5079 to 4390 bytes, objects freed 5/37 (in 1 ms)
00:00:00.086 BRY: Berry initialized, RAM used=4390
00:00:00.105 BRY: no 'preinit.be'
00:00:00.107 SRC: Restart
00:00:00.110 Project tasmota - Esp32-C3a Version 10.1.0.3(theo)-2_0_2(2021-12-29T15:24:15)
00:00:00.111 DHT: (v6) Sensors found 1
00:00:00.156 BRY: no 'autoexec.be'
00:00:00.218 WIF: Attempting connection...
00:00:00.600 WIF: Connecting to AP1 indebuurt_IoT Channel 11 BSSId 18:E8:29:CA:17:C1 in mode 11n as esp32c3a...
00:00:01.759 WIF: Attempting connection...
00:00:02.855 WIF: Connected
00:00:03.111 HTP: Web server active on esp32c3a with IP address 192.168.2.156
00:00:03.717 RTC: UTC 2021-12-29T14:25:55, DST 2021-03-28T02:00:00, STD 2021-10-31T03:00:00
15:25:56.105 MQT: Attempting connection...
15:25:56.117 MQT: Connected
15:25:56.122 MQT: tele/esp32c3a/LWT = Online (retained)
15:25:56.129 MQT: cmnd/esp32c3a/POWER = 
15:25:56.130 MQT: Subscribe to cmnd/esp32c3a/#
15:25:56.133 MQT: Subscribe to cmnd/tasmotas/#
15:25:56.137 MQT: Subscribe to cmnd/DVES_7611B8_fb/#
15:25:56.144 MQT: tele/esp32c3a/INFO1 = {"Info1":{"Module":"ESP32C3","Version":"10.1.0.3(theo)","FallbackTopic":"cmnd/DVES_7611B8_fb/","GroupTopic":"cmnd/tasmotas/"}}
15:25:56.162 MQT: tele/esp32c3a/INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"esp32c3a","IPAddress":"192.168.2.156"}}
15:25:56.180 MQT: tele/esp32c3a/INFO3 = {"Info3":{"RestartReason":"Software reset digital core"}}
15:25:56.186 MQT: stat/esp32c3a/RESULT = {"POWER":"ON"}
15:25:56.192 MQT: stat/esp32c3a/POWER = ON
15:25:56.196 TFS: File 'autoexec.bat' not found
15:25:58.685 QPC: Reset
15:26:00.686 APP: Boot Count 35
15:26:00.688 BRY: GC from 5816 to 4301 bytes, objects freed 17/39 (in 1 ms)
15:26:00.693 MQT: tele/esp32c3a/STATE = {"Time":"2021-12-29T15:26:00","Uptime":"0T00:00:10","UptimeSec":10,"Heap":197,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":61,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":39},"POWER":"ON","Dimmer":50,"Color":"4040","White":50,"CT":326,"Channel":[25,25],"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"indebuurt_IoT","BSSId":"18:E8:29:CA:17:C1","Channel":11,"Mode":"11n","RSSI":100,"Signal":-27,"LinkCount":1,"Downtime":"0T00:00:04"}}
15:26:00.750 MQT: tele/esp32c3a/SENSOR = {"Time":"2021-12-29T15:26:00","AM2301":{"Temperature":24.4,"Humidity":26.1,"DewPoint":3.7},"ESP32":{"Temperature":42.7},"TempUnit":"C"}
15:26:01.783 CFG: Saved, Count 119, Bytes 4096
15:27:10.693 DHT: Invalid reading
15:27:50.695 DHT: Invalid reading
15:28:34.698 DHT: Invalid reading
15:29:18.696 DHT: Invalid reading
15:30:06.691 DHT: Invalid reading
15:31:00.691 BRY: GC from 4923 to 4301 bytes, objects freed 2/39 (in 0 ms)
15:31:00.695 MQT: tele/esp32c3a/STATE = {"Time":"2021-12-29T15:31:00","Uptime":"0T00:05:10","UptimeSec":310,"Heap":195,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":99,"MqttCount":1,"Berry":{"HeapUsed":4,"Objects":39},"POWER":"ON","Dimmer":50,"Color":"4040","White":50,"CT":326,"Channel":[25,25],"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"indebuurt_IoT","BSSId":"18:E8:29:CA:17:C1","Channel":11,"Mode":"11n","RSSI":100,"Signal":-28,"LinkCount":1,"Downtime":"0T00:00:04"}}
15:31:00.753 MQT: tele/esp32c3a/SENSOR = {"Time":"2021-12-29T15:31:00","AM2301":{"Temperature":24.4,"Humidity":27.0,"DewPoint":4.2},"ESP32":{"Temperature":42.7},"TempUnit":"C"}
sfromis commented 2 years ago

Now, my DHT22 works a bit less bad on ESP32. Getting lots of "Invalid reading", and the outcome quickly changes to "null" for the values, but I've also seen it return to providing plausible values. Still pretty bad, I blame the sensor a bit more than Adafruit :-)

And the debugging messages with incoming data went away.

Jason2866 commented 2 years ago

Please try with latest DHT22 driver for ESP32

Jason2866 commented 2 years ago

Closing since no feedback.

estibi commented 2 years ago

I also get null values on ESP32 for AM2302, 10.1.0(tasmota) release. "AM2301":{"Temperature":null,"Humidity":null,"DewPoint":null} On ESP8266 the same sensor does work. Where can I find the latest driver @Jason2866 ?

estibi commented 2 years ago

I've just connected AM2302 to the ESP32-c3 with 10.1.0 and it does work here. However it gets null values on ESP-WROOM-32 board.

barbudor commented 2 years ago

You are using a version which is older than the implementation of the new driver Use latest development version from http://ota.tasmota.com/tasmota32/

estibi commented 2 years ago

OK, so version 2022.01.3 on ESP32-C3 with AM2302 works fine for me. I remember that version 10.1.0 reported too high humidity levels on C3 board however with 2022.01.3 humidity level is now correct. I will try that version again on ESP-WROOM-32 in a few days or so.