Battery Powered Wifi IoT – Temperature, Humidity & Soil Moisture Sensors

I have just made a prototype of ESP8266 (ESP-01) IoT temperature & humidity SI7021 sensor and also 2x three pin soil moisture sensors with only 0.006mA (6µA) current drain during the sleep.

The idea is simple and consist of the following decisions:

  • ESP-01 as wifi and I2C master for temperature and humidity SI7021 sensor
  • ATTINY85 for 2xAD readings of moisture sensors and 1xAD reading of battery voltage level
  • ATTINY13A to completely turn off all the rest circuits (to minimize sleep consumption 6µA) via mosfet
  • 2x AA batteries with 3.3 power 1A boost to power hungry ESP8266



HW parts

  • ESP-01
  • ATTINY85
  • 3.3 power 1A boost
  • resistors
  • mosfet

HW prototyping

DSC_0158 DSC_0162 DSC_0171

DSC_0172 DSC_0173 DSC_0175


I made also version with 1x moisture sensor and 1x light sensor (any two analog or digital sensors can be used).


  • Power boost vs step down. I think the 1A 3.3 power boost is will be better (need to prove it by real tests)
  • SI7021 sensor and not DHT22 anymore. Si7021 is much faster (doesn’t need 2s) with the same (or better) accuracy
  • battery type = 2xAA and now I’m considering CR123A
  • Uptime = esp wifi communication takes up to 3.5s from power down
  • Moisture sensor takes 20mA. With 2 of them 40mA is quite a big value.
  • Communcation from ATTINY85 to ESP-01 = via only one TXpin by SoftwareSerial.h

Battery life

Power consumption of the project during the sleep time is really outperforming all other battery powered projects with only 6µA (0.006mA) current consumption! Much less then using just deep sleep mode. 😎

I will do the test with these battery types:

  • 2x AA battery (Tesco power Hi Tech) which should last more then 3 months (based on Temperature sensor project)
  • 1x 18650 850 mAh battery (older UltraFire sold as 5300mAh but real 850mAh) took only 17 days. I will repeat the test with new 18650 battery.
  • 3x AAA battery (Ikea). I will test.
  • 3x AA battery (Ikea). 7741 measurements during 17weeks!
  • 1x CR123A (need to buy one 😉 )

Test with 1x older 850mAh 18650 battery after 11 days was promising. The battery was still above 3.7V. However day 17 was the turn point and the battery was decresing 0.1V an hour.

Version with only SI7021 temperature and humidity sensor and 3xIkea AA:
After 50 days the interim batteries voltage level is 4.08V with WiFi transferring and 4.34V (1.44V each!) during sleep mode. After 7741 measurements (4 months) the project stopped sending data:
Project stopped with 3.9V in rest and 3.64V in wifi on. So I removed the mini Step-UP-Down Power regulator and connected battery directly to wifi and the project continues to send data (now 3 additional weeks). Next time I will use directly 3xAA without step-up-down power regulator.

Version with only SI7021 temperature and humidity sensor and 1xCR123A 3V battery:
Soon to be started…


The version with SI7021 temperature and humidity, 1x moisture sensor and 1x light sensor.
ESP-battery-3xAAA A ESP-battery-3xAAA B ESP-battery-3xAAA C

Sample of results with 1 moisture sensor and 3xAA batteries

{"temp":"23.51","hum":"55","serial":"M1=655M2=0B=650","milis":"3426","datetime":"2016-05-02 23:04:56","epoch":1462223096}
{"temp":"23.51","hum":"55","serial":"M1=655M2=0B=650","milis":"3420","datetime":"2016-05-02 23:16:07","epoch":1462223767}
{"temp":"23.51","hum":"56","serial":"M1=655M2=0B=650","milis":"3424","datetime":"2016-05-02 23:27:17","epoch":1462224437}
{"temp":"23.50","hum":"56","serial":"M1=655M2=0B=650","milis":"3424","datetime":"2016-05-02 23:38:28","epoch":1462225108}


This blog will be updated….
The ESP8266 code link (not optimized but running stable)

Other possibilities

Temperature Humidity Barometric Pressure BME280 Digital Sensor


Related Posts

ESP8266 Temperature Humidity IoT Logger


I learned how to program ESP8266 so I created my first temperature IoT ESP8266 project. I used DHT22 as a temperature and humidity sensor and also I did some testing of power consumption using LIGHT SLEEP[…]

Continue reading ...

ESP8266 & NRF24L01 Breadboard Adapter

esp8266 & nrf24L01 on breadboard

You can find several breadboard adapters for ESP8266 WiFi module or nRF24L01+ RF transceiver and also several DIY manuals how to create your own, but I decided to use my new WiFi WSP8266 and NRD24L01 as soon[…]

Continue reading ...

Program ATtiny13A via Arduino board


Programming ATtiny micro-controller is quite easy if you have all the needed information in one place. That is the reason to put all needed files, hints in one post so next time I will need it,[…]

Continue reading ...
  • Benoit

    Hello! Where did you buy the dc-dc boost converter ? Do you have a reference / link to share? I bought one on aliexpress and it’s efficiency is 50% at max.

  • Michael

    Hi Tomas, thanks for publishing the code for the DHT22 project. As you suggested, I made a new PCB for the Si7021 project and also added some silkscreen text:

    To save on space, I left out the Tiny85 and connected the analog inputs to the Tiny13 – is that a problem? In my understanding, the Tiny13 could do the same AD conversions and also send the data to the ESP8266.

    BTW: I did not order the Si7021 PCB yet as I am waiting for the DHT22 PCB – I want to check the production quality.
    Cheers from Germany, Michael.

    • Tomas

      I was trying to have serial data from ATTiny13, but not successful. Another advantage of separate tiny85 is the reference voltage 3.3V also if powered from less voltage batteries. If you will find the way of serial communication with tiny13A, please give me a hint. Thanks for sharing PCB.

  • Jonte

    Hi! What kind of MOSFET do you use? I have had a hard time finding a mosfet that switches 3.3v with 3.3v gate voltage.

  • Arjan de Vries

    Hi Thomas,
    Good idea using an attiny to lower the power. I have build the project but also some improvements:
    – (done) im using the wifi manager for the 8266 so i can easily configure the ssid and password.
    – (done) post the data to a PHP script for mysql logging
    – (done) used dygraph for visualisation
    – (todo) add an feed back cable from the 8266 to the attiny so it can initiate the power down.
    – (todo) cache data and send it after x time over wifi (i think this saves power)
    – (todo) add extra configuration options in the wifi manger like wake up interval, cache size

    Thanks, Arjan

  • Dealah in Kóma

    gosh I need exactly something similar to this. Tomas don’t you plan selling this pre-build?
    I’d be happy buying quite a few and focus on the software development part.
    Amazing work though, congratulation!

  • Stanislas Mauser

    What was the Code to read the Voltage value of the connected power Source? Or did you measured it by hand?