Battery Powered ESP8266 IoT – Temperature Sensor

Since my latest ESP8266 temperature humidity IoT logger project is up and running I have decided to cut the last wire – power. There are more approaches how to make ESP8266 running on a battery, but why not to have a unique one… 😎
The idea is to use only 5µA AtTiny13A (5 microA 2-3V) during the idle time to decouple all other components from batteries! So really 0 power usage from all other components (power regulator, DHT22 sensor,..), since the more components the more idle power consumption. All other circuits should wake up only during limited time and then again turn off.

I have combined knowledge mostly from two my previous projects:

  1. ESP8266 wifi temperature and humidity sensor on 5V USB power project – see details
    ESP8266-temperature2
  2. Low power (5microA) ATtiny13A project as a power switcher project – see details
    DSC_0171

This is my latest version of the wiring that I used:

TempHumIoT_battery
ESP8266 DHT22 battery sketch

Parts list:

  • ESP8266 ESP-01 Wifi Module
  • DHT22 with 10kΩ
  • 3.3V Voltage Regulator – step up (booster)
  • AtTiny13A
  • N-channel MOSFET IRL2203N with 100kΩ
  • 2xAAA batteries with battery case

My AtTiny13A programmer and ESP01 programmer from my previous posts helped me to easilly program ESP8266 and AtTiny13A:
AtTiny13A programmerESP01-development_board-final

The project is up and running. I used double AA batteries. Sending data every ~20 minutes.:
ESP8266 battery DHT2ESP8266 battery DHT1ESP8266 battery DHT5

ESP8266 battery DHT4ESP8266 battery DHT3

Updated version with capacitors:
esp01-dht22-batteryesp01-dht22-battery2

Logs from my server:

{"temp":"24.60","hum":"46.40","voltage":"1023","milis":"4701","datetime":"2016-01-31 16:35:58"}
{"temp":"24.10","hum":"48.90","voltage":"1023","milis":"4794","datetime":"2016-01-31 16:48:38"}
{"temp":"24.00","hum":"49.30","voltage":"1023","milis":"3795","datetime":"2016-01-31 17:09:59"}
{"temp":"23.70","hum":"47.10","voltage":"1023","milis":"4722","datetime":"2016-01-31 17:31:22"}
{"temp":"0.00","hum":"nan","voltage":"1023","milis":"4705","datetime":"2016-01-31 17:52:44"}
{"temp":"23.80","hum":"48.20","voltage":"1023","milis":"5252","datetime":"2016-01-31 18:14:06"}
{"temp":"23.70","hum":"47.90","voltage":"1023","milis":"4738","datetime":"2016-01-31 18:35:27"}
{"temp":"0.00","hum":"nan","voltage":"1023","milis":"4732","datetime":"2016-01-31 18:56:49"}

where:

  • temp and hum are DHT22 temeperature and hunidity values
  • voltage is raw value from ESP8266 GPIO reading. Should get 0 if not sure which voltage will be provided to this pin. – only experimental
  • milis is a ms that ESP8266 needs to send data to the server
  • datetime is added timestamp on the server side

I will do real battery life measurements and I will compare different batteries as power source (AA, AAA, CR2032,..). IoT data logger is configured to send data via wifi every 20 minutes for the test. This post will be continued!

Problems I had to solve:

  • Which battery to use – using 2xAA since CR2032 3V nor 2xAAA were not able to power ESP
  • DHT22 needs time to get values – waiting 2s after the mosfet is on. In general in these steps: wifi.begin, wait till 2s uptime, read DHT, wait for wifi connect, send data to server, go to the light sleep
  • power for N-Channel Mosfet – looks stable from 2xAA
  • Step up or step down voltage regulator – I used step-up to squeeze the batteries
  • Shorten the ESP8266 connection time (static IP,..) – used static IP and optimized mentioned DHT22 readings
  • Read battery level – ESP01 has only GPIO (not ADC). I will add the second ATtiny13A or ATtiny85 to get analog batteries voltage and transfer the digital value to ESP-01 – not implemented now

I will post the source code, once it’s stable and proven.
UPDATE 2016/11/02:
I have stopped using DHT22 because it is slow (2s) and spent lot of time to fine tune the code and still it is not final (although it’s up and running more then 9 months now). The ESP needs to be up for 8s to get reliable data with compare to 4s with SI7021 sensor used in battery-wifi-iot-temp-hum-soil-moisture-sensors.
But anyway the ESP8266 code for DHT22: https://gitlab.com/snippets/30509
ATtiny code to wake up 20min for 8s: https://gitlab.com/snippets/30510
ESP8266 for SI7021 (it reads also data from ATTiny85 serial, that you can remove): https://gitlab.com/snippets/30512

ESP Battery life

2 x Tesco AA batteries

UPDATE: After adding 2 capacitors (100uF and 10uF) in parallel with DHT22 the readings are stable.
After 28 days, the batteries are 2,85V with 1985 temperature/humidity readings.
After 50 days, the batteries are 2.77V with 3544 temperature/humidity readings.
After 3months, the batteries are 2.69V with 4409 temperature/humidity readings
So finnaly after 69days, the batteries are 2.62V with 4655 temperature/humidity readings. So the project works more than 3 months on 2x Tesco AA batteries 😎

3 x Ikea AA batteries

Check project version with only SI7021 temperature and humidity sensor with 3xIkea AA batteries and with ATtiny85 for battery level measurements.
After 50 days the interim batteries voltage level is 4.08V with WiFi transferring and 4.34V (1.44V each!) during sleep mode. The project is still up and running after 3171 measured and transferred data:
battery-ESP-01
The project is up and running after 21 weeks.

Results

Bellow is a widget combination of all of my IoT data from I2C on my cubieboard, ESP8266 on battery, ESP8266 on USB and also Yahoo data. Also check my another ESP8266 battery IoT door sensor project.

IoTwidgets


Related Posts

Fish Tank WIFI HTTP Server

Idea for this project came with my new small fish tank.

Continue reading ...

WiFi Energy Monitor

My new project consists of HW with cost under 20€. It is able to accurately measure electric power consumption and sends data via WiFi. Great source of knowledge is openenergymonitor.org which includes also Arduino library.

Continue reading ...

Programming ESP-01 (ESP8266)

I was inspired by several DIY projects. The ESP8266 WiFi 802.11 b/g/n Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266[…]

Continue reading ...