Testing Deep Sleep Mode On An ESP-01 With A Worm Farm
TAGS: electronics; software; nature projects; ESP-01; Arduino; DS18B20 Temperature Probe; batteries; IOT; AdafruitIO; Cayenne
Why I Did This
I had an ESP-01 device and wanted to see if it could be a fit for low input, low power, deep-sleep-mode applications. I just started a worm farm in some 5-gallon pails (it’s just some layered pails with holes, filled with old vegetables and composting material; I wanted to build it for compost, and to get worms for fishing). I figured this worm farm could be an appropriate project to monitor pail temperatures and test the deep-sleeping capabilities of an ESP-01 device.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_0.jpg)
A portable, low power, WIFI temperature probe for my worm composter.
Design Walkthrough
Parts: ESP-01 controller; Arduino Uno controller (for programming ESP); Arduino IDE; Cayenne free account; DS18B20 Temperature Probe; 2x AAA batteries (or whatever combo batteries to get ~3.3V)
I initially wanted to test this with AdafruitIO as the web server for saving the temperature
readings, but I wasn’t getting it a connection on their servers, so I tried Cayenne.
I started programming by using customizations of Cayenne example codes for data uploaded of
a DS18B20 probe with the deep-sleep modes.
I had a heck of a time actually getting the ESP-01 programmed. I have programmed it before
using an Arduino Uno as the serial uploader, but it took me like 20 tries (fiddling,
adjusting wires, unplug/plugging) in order to get it to successfully upload.
Much like AdafruitIO, Cayenne was also giving me issues with connectivity, but at least it
was showing up
on their servers (for like a split second). I then found custom code by Cayenne Community
board user ‘Sven’ (who was also doing deep-sleep and using a DS18B20 probe) and found that
with his code
the connectivity was much better, and I was able to see values stay on the Cayenne
webpage.
After getting a stable connection I switched power to 3 AAA batteries that were already
semi-drained (they were 1.2V so together at 3.6V; good enough to start testing with). I also
place all the pieces inside a Tupperware container to protect them from the elements, then
placed within the worm pails.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_1.jpg)
I programmed the ESP-01 through an Arduino Uno, and tested its amp draw (it shows zero
when in deep sleep).
I also have the probe next to another temperature gauge to check for
discrepancy.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_2.jpg)
The temperature probe reads pretty darn close to separate gauge, but are they both accurate?
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_3.jpg)
The Cayenne server picking up my ESP-01's sensor tranmissions.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_4.jpg)
A Tupperware to protect the batteries and ESP-01 from the elements.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_5.jpg)
The probe is within the compost pail garbage clippings.
![](articleAssets\Testing-Deep-Sleep-On-ESP01-With-Worm-Farm\esp01_sleep_worm_6.jpg)
Final setting: the Tupperware is sitting inside the pails.
Lessons Learned and Future Changes
Where’s the history, Cayenne? Even though I was getting a consistent reading from the devices on the Cayenne server, it seemed to not be saving a history and I’m not sure why, so for now I’ll have to monitor it live with regular checkups; maybe I can try AdafruitIO later.But how’s the battery? Preliminary tests showed it was drawing 80mA when in run mode (and nothing in deep-sleep). I hope to eventually tune this setup to get like months use out of the battery, but for now I’ll test short term draw. I don’t have a multimeter that accurately goes below the milliAmp range, so for now I’m just testing by checking periodical for battery drain. I read that removing the board's LEDs can help with lowering amperage.
Update: Battery didn't last overnight (less than 18hrs use), not good! When I checked the setup this morning i expected it to still run at least for the day, but it was at 2.5V (which is apparently below this device's operating voltage range). I will lower the program looping frequency (i.e. increasing deep sleep time from 1-minute to 30-minutes), remove that 'always on' LED, and replace the battery with some AAs.
Update 2: Battery lasted at least a week, but rain got into the container (which is strange because the tupperware was sealed) so battery might have been killed. The battery setup went from 3V to 1.35V in about 10 days, but it rained in the last few days (which got into the container and possibly shorted the battery). I'm going to hold off on further testing this until I find a working data logger server since Cayenne's is not recording my history.
References
Cayenne web sever for devices: https://cayenne.mydevices.com
Programming ESP-01 via Arduino Uno as boot loader:
https://www.engineersgarage.com/esp8266-with-arduino-and-ft232/
DS18B20 and ESP01 tutorial:
https://myhomethings.eu/en/ds18b20-temperature-sensor-with-esp-01-module-for-iobroker/
Sven’s setup: https://community.mydevices.com/t/esp-01-ds18b20-cellphone-li-ion-battery/8137