Electronics > Projects, Designs, and Technical Stuff

Esp8266 deep sleep mode with DHT22 sensor

(1/2) > >>

Byachna:
Hello All,

I'm planning a small project that utilizes an esp8266 and a DHT22 temperature & humidity sensor to periodically post the temperature and humidity values of my humidor to a Webservice. I was reading around online and saw some similar projects having issues with the DHT22 sensor dying after a few deep sleep cycles on the esp8266.

The reason for the deep sleep is that I would love to have this setup run on battery, without having to change it every other day :)

My questions to you are:
1. Does anyone have experience with this esp8266/dht22 setup?
2. Are there any other temp/humidity sensor combos more reliable yet relatively cheap as the dht22?

I appreciate any input you could give!

Thanks,
Brandon

frozenfrogz:
I have not used the DHT22 myself, but from what I heard you should be good if you write the DHT Vcc pin low before going to sleep and high after wake up. So don’t connect the sensor directly to the battery but use a GPIO. That way the sensor does a full reset on power restore and you should be good. The issue of not being able to read from the sensor after some time / sleep - wake cycles seems to only appear if the sensor is running while the ESP cycles. Also, there have been reports of bad measurements if the DHT22 is close to the WiFi antenna. It seems to be sensitive to RF interference, so shielding or bigger distance from the ESP is preferable.
The routine would be something like (pseudo code):

wake ESP from deep sleep (external interrupt on CH_DP, or RTC event)
write DHT Vcc high
wait for DHT to settle
take the measurement
wait for value
push value to webservice
write DHT Vcc low
deep sleep for (time) / until interrupt

Regards,
Frederik

Byachna:
Hi Frederik,

Thank you for the helpful response :). After reading through your pseudo code, it seems like a very logical thing to actually shut the sensor off before sending the esp8266 into deep-sleep mode. I should be receiving the components to make this project by Monday, so I hope to post my findings as I progress!

-Brandon

Wiljan:
There are a lot of discussion around on the the web on how to minimize the current when running the esp8266 from batteries

Try have a look here

http://homecircuits.eu/blog/battery-powered-esp8266-iot-logger/

or here

https://openhomeautomation.net/esp8266-battery/

Good luck  :)

wassy:
+1 to frozenfrog. Thanks for the advice. I also found that I need to switch VCC to the DHT22 before and after deepSleep mode.

I found other advice on the web that said set the data pin to output mode and set it low just before deep sleep, but that didn't seem to have any effect in my case. Disabling the DHT22 by setting VCC low via a GPIO pin just before going into deepSleep did the job for me, now it seems to report reliably on wakeup. I set the pin low on startup, small delay then set it high, slightly longer delay, then read the sensor, then set it low again before deep sleep is the setup I am currently running. I don't know if all of those states are needed. I will do some experimenting to find the best configuration

Thanks

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod