tzapu / DeepSleepDHT22

Battery Powered ESP8266 WiFi Temperature and Humidity Logger
http://tzapu.com/minimalist-battery-powered-esp8266-wifi-temperature-logger/
MIT License
136 stars 39 forks source link

DHT22 and deep sleep #3

Open consolacion opened 7 years ago

consolacion commented 7 years ago

Great project and ofcourse I am not doubting your findings regarding the DHT22 and deep sleep, but I just find it very hard to imagine that deep sleep cycles would affect a DHT22. Then it would also be affected I guess if you power up and power down a normal application a few times. So I really wonder what is going on there.

very odd, but do i understand from your version 2 that you dont have that issue anymore as you have the DHT directly connected to a the Vcc?

Anyway, the DHT22 and DHT11 usually don’t do well on a period of sleep: they need about 20 secs to 'power up' they do give readings in the mean time, but inaccurate. Another issue with the DHT series as I understand is that the reading is always of the previous read command. So suppose I do a reading every second, then the reading at say 1 sec past noon is actually the temperature and humidity as they were 1 second ago at noon. That is not really an issue if you do frequent readings, but suppose you do a reading every hour (but have kept your DHT powered up), then your first reading is that of an hour ago.

Finally, if you are using the Adafruit library (which you dont, but others may) there is an error in the cpp file that can stop the proper functioning of the DHTxx https://arduinodiy.files.wordpress.com/2016/10/adafruiterror.png Finally, I must admit I have been running the DHT11 without pullup as well, didnt see any difference compared to with pullup

tzapu commented 7 years ago

hi, i do not know why it stops working, but that has happened in all my and my friend @chaeplin 's tests. and he has done tens of them with various configurations, including transistors to switch power and so on. i completely agree with you that it shouldn't happen though... the only way i got it to work reliable, and to give accurate readings was to read twice and power it up/down completely during sleep. so the dht is now tied into both gpio0 and gpio2. also been using another library. i don t think i managed to upload that sketch, will try to do so. anyway, as you mentioned, the dht is really bad on power, not even sure if i got 1 - 1.5 months of runtime while the equivalent temp only ds18b20 seems to run for 4-6 months...

this is what i was running last https://gist.github.com/tzapu/e6e70b4c094be618b714050a252309a3 seems now, i can t get any of my dht sketches to compile... lovely

mrburns42 commented 6 years ago

I have the same problem. I think switching from GPIO_2 to GPIO_3 is a solution. This takes away the RX pin of the ESP-01, but that is only needed for programming in my setup. I put more details to the cause at:

https://github.com/adafruit/DHT-sensor-library/issues/57?_pjax=%23js-repo-pjax-container

consolacion commented 6 years ago

@tzapu , i hope you managed to compile yr sketches again. I apologize for my late reaction, I must have missed your reply

@mrburns42 In fact I have been using pins of the ESP-01 like this:

GPIO0 -> SDA pin of the I2C port
GPIO1 ->DHT11
GPIO2-> SCL pin of the I2C port
GPIO3-> OneWire Bus

had a BMP and an OLED on the I2C and 2x DS18B20 on the GPIO3 Not sure why switching from GPIO2 to GPIO3 would solve it (but if it does for you that is great)