sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
236 stars 125 forks source link

DHT reading failed! #135

Closed aleiei closed 3 years ago

aleiei commented 3 years ago

After having correctly compiled and loaded the temperature sensor firmware on Nodemcu ESP8266E, when I open the serial monitor I have these data: 13:47:25.292 -> ...................connected! 13:47:30.827 -> [WiFi]: IP-Address is 192.168.1.108 13:47:32.452 -> Connected to SinricPro 13:47:33.480 -> Temperaturesensor turned on (via SinricPro) 13:47:33.745 -> Temperature: 23.0 Celsius Humidity: 76.0% 13:48:34.744 -> DHT reading failed! 13:48:34.744 -> DHT reading failed! 13:48:34.777 -> DHT reading failed! 13:48:34.810 -> DHT reading failed! 13:48:34.810 -> DHT reading failed! 13:48:34.843 -> DHT reading failed! 13:48:34.877 -> DHT reading failed! 13:48:34.877 -> DHT reading failed! 13:48:34.910 -> DHT reading failed! 13:48:34.943 -> DHT reading failed! 13:48:34.943 -> DHT reading failed!

Sporadically reads the data correctly. With an example sketch for the read only temperature / humidity it works well. I have tried to extend the reading times of DHT11 through DHT.h, but without success. Any suggestions ? Thanks in advance to everyone.

kakopappa commented 3 years ago

You are reading the values from the sensor too often. AFAIK sensor requires 2 second delay between reads

On Sat, 30 Jan 2021 at 8:05 PM aleiei notifications@github.com wrote:

After having correctly compiled and loaded the temperature sensor firmware on Nodemcu ESP8266E, when I open the serial monitor I have these data: 13:47:25.292 -> ...................connected! 13:47:30.827 -> [WiFi]: IP-Address is 192.168.1.108 13:47:32.452 -> Connected to SinricPro 13:47:33.480 -> Temperaturesensor turned on (via SinricPro) 13:47:33.745 -> Temperature: 23.0 Celsius Humidity: 76.0% 13:48:34.744 -> DHT reading failed! 13:48:34.744 -> DHT reading failed! 13:48:34.777 -> DHT reading failed! 13:48:34.810 -> DHT reading failed! 13:48:34.810 -> DHT reading failed! 13:48:34.843 -> DHT reading failed! 13:48:34.877 -> DHT reading failed! 13:48:34.877 -> DHT reading failed! 13:48:34.910 -> DHT reading failed! 13:48:34.943 -> DHT reading failed! 13:48:34.943 -> DHT reading failed!

Sporadically reads the data correctly. With an example sketch for the read only temperature / humidity it works well. I have tried to extend the reading times of DHT11 through DHT.h, but without success. Any suggestions ? Thanks in advance to everyone.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/135, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZS5KH2DUGUL3CHLBTTS4P73HANCNFSM4W2JMEWA .

aleiei commented 3 years ago

The example file I uploaded to the Nodemcu board is the Temperature Sensor from your 2.8.0 master SDK, along with Mark Ruys' DHT library. The skecth example taken from the DHT library also gave Timeout error. 17: 20: 33.616 -> Status Humidity (%) Temperature (C) (F) 17: 20: 34.645 -> OK 74.0 24.0 75.2 17: 20: 35.639 -> TIMEOUT nan nan nan 17: 20: 36.666 -> OK 71.0 24.0 75.2 17: 20: 37.693 -> TIMEOUT nan nan nan 17: 20: 38.720 -> OK 72.0 24.0 75.2 17: 20: 39.747 -> TIMEOUT nan nan nan 17: 20: 40.741 -> OK 73.0 24.0 75.2 17: 20: 41.768 -> TIMEOUT nan nan nan 17: 20: 42.795 -> OK 72.0 24.0 75.2 17: 20: 43.824 -> TIMEOUT nan nan nan 17: 20: 44.851 -> OK 72.0 24.0 75.2 17: 20: 45.846 -> TIMEOUT nan nan nan This happens because the file heater waits only 1 sec between one reading and another. Editing the heater file from: int getMinimumSamplingPeriod () {return model == DHT11? 1000: 2000; } to int getMinimumSamplingPeriod () {return model == DHT11? 2000: 2000; } the example file started working correctly. 17: 18: 51.351 -> OK 75.0 24.0 75.2 17: 18: 53.374 -> OK 74.0 24.0 75.2 17: 18: 55.396 -> OK 74.0 24.0 75.2 17: 18: 57.416 -> OK 73.0 24.0 75.2 17: 18: 59.437 -> OK 73.0 24.0 75.2 17: 19: 01.457 -> OK 73.0 24.0 75.2 17: 19: 03.479 -> OK 73.0 24.0 75.2 The same is not true for your Temperature Sensor example. In my opinion the sum of the single instructions induce a delay and there is no more synchronism.

aleiei commented 3 years ago

Now it seems to work. I changed the heater file by increasing the DHT reading time from 1 to 2 sec: int getMinimumSamplingPeriod () {return model == DHT11? 2000: 2000; } and I deleted ( comment ) the line: // if (temperature == lastTemperature || humidity == lastHumidity) return; // if no values changed do nothing ...

18:12:21.733 -> [Wifi]: Connecting.....................connected! 18:12:27.863 -> [WiFi]: IP-Address is 192.168.1.108 18:12:29.486 -> Connected to SinricPro 18:12:30.513 -> Temperaturesensor turned on (via SinricPro) 18:12:30.744 -> Temperature: 24.0 Celsius Humidity: 71.0% 18:13:30.752 -> Temperature: 24.0 Celsius Humidity: 73.0% 18:14:30.757 -> Temperature: 24.0 Celsius Humidity: 76.0% 18:15:30.767 -> Temperature: 24.0 Celsius Humidity: 79.0% 18:16:30.769 -> Temperature: 23.0 Celsius Humidity: 78.0% 18:17:30.779 -> Temperature: 25.0 Celsius Humidity: 74.0% 18:18:30.751 -> Temperature: 26.0 Celsius Humidity: 64.0% 18:19:30.750 -> Temperature: 27.0 Celsius Humidity: 62.0% 18:20:30.760 -> Temperature: 27.0 Celsius Humidity: 61.0% 18:21:30.755 -> Temperature: 27.0 Celsius Humidity: 60.0% 18:22:30.783 -> Temperature: 26.0 Celsius Humidity: 66.0% 18:23:30.780 -> Temperature: 25.0 Celsius Humidity: 69.0% 18:24:30.772 -> Temperature: 25.0 Celsius Humidity: 71.0% 18:25:30.757 -> Temperature: 24.0 Celsius Humidity: 74.0% 18:26:30.780 -> Temperature: 24.0 Celsius Humidity: 76.0% 18:27:30.760 -> Temperature: 24.0 Celsius Humidity: 76.0% 18:28:30.781 -> Temperature: 24.0 Celsius Humidity: 77.0% 18:29:30.775 -> Temperature: 24.0 Celsius Humidity: 78.0%

sivar2311 commented 3 years ago

Hi @aleiei! Thank you for pointing this out.

Since the bug is not in the SinricPro library, but in the external DHT library (which is not ours), please report the bug and your solution in the DHT library repository.