Battery Powered ESP8266 WiFi Temperature and Humidity Logger

I wanted to have a few portable and long lasting temperature and possible humidity sensors I could just throw around hand have them working with as little hassle as possible. Enter the Battery Powered ESP8266 WiFI Temperature and Humidity cloud logger.

Unfortunately after numerous attempts, DHT22 and deep sleep do not seem to go well together. After some time, no matter what code and library I uses, it would stop sending data. I have had help from other community members as well testing this, and the results are always the same, the DHT dies after a number of deep sleep cycles.

For powered projects that don t sleep it is fine. If I get anywhere with it, I will post another update. We ve even added a transistor to switch it off, no go 🙁 The DS18B20 based sensors however have been running since last august now without any hickups.


  • easily movable
  • last at least 3 months on a battery
  • minimum amount of components (that hopefully i had laying around)
  • post to emoncms
  • later: post to MQTT


  • ESP8266 ESP-01 based (had)
  • Arduino IDE with ESP8266 support based firmware, with WiFiManager for easier portability
  • DHT22 or DS18B20
  • low voltage drop and low quiescent current regulator
  • 18650 Rechargeable Lithium LiFePO4 Battery (eCig battery)
  • upload data to EmonCMS

First build

The first prototype I made of this had all the regular pull ups/downs and whatnot’s I found on most websites reflated to the ESP8266 I found.
That prototype has been running since August now, on a couple of batteries. It gets the temperature from a DS18B20 every 10 minutes, posts it to EmonCMS and goes to sleep. It’s great.

battery powered esp8266 on emoncms

Second build

After reading and playing some more about and with some ESP modules, it appeared as I could possibly run an ESP-01 module without any pull ups and so the list of components became:
– 1x ESP8266 WiFi module, ESP-01 version
– 1x HT7333-A low voltage drop and low quiescent current regulator
– 1x 10uF capacitor
– 1x 4×2 header
– 1x 18650 case
– 1x 18650 battery
– 1x DHT22


ESP8266 WiFi DHT22 Sensor Deep Sleep Schematic

Deep Sleep for the ESP8266 ESP-01

Because the ESP-01 does not have the necessary pin exposed for Deep Sleep (GPIO 16) we will need to do some surgical soldering on it.
We need to solder a very thin piece of wire from the reset pin to one of those very small pads on the esp chip.
ESP8266 ESP-01 Deep Sleep Mod

Don’t worry, it’s a lot easier than it looks.

Get the piece of wire, solder it on the reset pin, tin the other end and bend it into position
What I did next is applying head somewhere near the end of the wire, this melted the solder on the wire and on the pad and I got a connection. Easy peasy.

You will also need to remove at least the red LED to lower consumption.

I have also added some hot glue on top of the wire, it’s quite easy to pull it away together with the esp’s pad otherwise.

Putting it all together

I’ve assembled everything on a perfboard. Not the prettiest thing in the world, but function over form.
And it sure is functional.

Deep sleeping ESP8266 wifi temperature and humidity board top side

and back
Deep sleeping ESP8266 wifi temperature and humidity board bottom side

and all assambled
Deep sleeping ESP8266 wifi temperature and humidity board assembled


You will of course need an EmonCMS account or a local running copy of Emoncms.

For the firmware you will need Arduino IDE and at least the 2.0.0 stable release of the ESP8266 package

The firmware is quite simple:
– try to connect to wifi, if fail start in config mode
– read dht22 data
– post dht22 data to emoncms
– go to sleep
– awake and repeat

Get it here: arduino ide source code for battery powered esp8266 dht22 temperature and humidity sensor


Here is the grand result. Quite pleased with it.
Complete Battery Powered ESP8266 ESP-01 Temperature and Humidity Sensor

Emoncms Data
Emoncms showing data from temp and humidity esp8266

Category: blog

Tags: , , ,

- December 18, 2015