ESP8266 on batteries for years – part 5

Actual power consumption measurements


The power beast – ESP8266

One of the very first and most important measurements is how much the ESP consumes when its waken up. I used my voltage/current logger to measure this. This is the result:

It shows that the ESP is awake for about 0.7 seconds and on average it uses 78mA. The raw data can be downloaded here.


AtTiny85 and the sensors

Next is measuring the cycle of the AtTiny when it does it’s measurements. The chip uses so little power that I had to change shunt resistor of my INA219 from 0.1R to 10R, giving it 100 times more sensitivity.

It shows that a measurement takes about 180 ms and uses about 1.35 mA on average. The raw data can be downloaded here. I have deliberately reduced the clock frequency on the AtTiny from 8 MHz to 1 MHz. This makes it go from 10+ mA down to about 1 mA.

My modification to my datalogger:


Sleeping power consumption

With a multi-meter I was able to measure 23.5uA for the entire device when both the AtTiny and the ESP are sleeping. This is without any power regulator or DC-DC converter. I still havn’t decided which way I will go here. But it should be possible to find a solution under 10uAΒ quiescent current.


Final calculation

With the above measurements I can now do the real world calculation of the battery consumption. And it was quite close to my first calculation.

This should be fine for running some years on AA batteries πŸ™‚



I will add more info about power regulators / DC-DC converters when they arrive from china. This can take 1-2 month. I hope you enjoyed reading about my little project.

Comments are welcome πŸ™‚

20 thoughts to “ESP8266 on batteries for years – part 5”

  1. Hi Alex,

    I’m currently working on a Wifi project with a ESP8266. The hardware is based on a PIC and a ESP8266 module, some sensors and AA batteries. The interface between the micro and the module is UART with AT commands.

    Both the micro and ESP are in deep-sleep most of the time, waking every hour to connect to wifi and deliver data.
    My problem is that from reset it takes the ESP8266 ~3s to connect to Wifi and ~4s to get a DHCP lease.
    Several places i see connection times below 1s, but also others that have 3s (7s with DHCP).

    So how do you get below 1s in connection time?

    1. DHCP is a no-go. Besides that I don’t do much. I use an ubiquiti AP lite – really good quality AP.
      If you deep sleep the ESP and start it up with the radio disabled, that will add 3 sec when you need the radio because of calibration.

  2. Hi Alex,

    Thanks for the reply.
    If you deep sleep the ESP and start up with the radio enabled, wouldn’t it take 3 sec to calibrate still? So by disabling the radio on startup you are postphoning the 3sec calibration?
    If so, this could explain the ~3s connect time i experience.

    1. In my device my radio is on every time I go to sleep and when I wake up. I can keep the wifi connection time under 1s most of the time. As soon as I play with disabling the radio, I get a 3 second penalty (where the ESP does calibration).

  3. Hi Alex,

    Thanks for clarifying.

    So when you wake up the module you don’t get the 3sec calibration penalty?
    I currently power off the module completely to save the 18uA sleep power. If i instead keep the module powered in sleep (drawing 18uA) and wake it every hour i should be able to avoid the 3s calibration each time?

    1. Correct… those 3 seconds compared to 1/2 a second contributes much more to the overall consumption than those 18uA πŸ˜‰

      1. Hi Alex,

        I use the default firmware on the ESP8266 using AT commands directly to configure the connection. If i leave it powered (deep sleep) and reset it with the reset pin, i still seem to get the 7s connection time. How do you get into deep sleep? From your code it seems you also just wake the device by the RST pin, but how do you keep it calibrated during deepsleep? I can’t seem to find any documentation about this.

        1. I have never used the default AT firmware in the ESP because it really doesn’t use the potential of the ESP. You can use it as a stand alone arduino platform. You can get started here:
          Most of my wifi communication/mqtt logic is done in the esp. For my project to work you also need to put my code in the ESP. It will handle the deep sleep too.

  4. interesting project, I enjoyed reading your articles. I try somehow a similiar project.
    This person reduce the connect time:
    And we could reduce the transmit power in correlation to our distance. Usually the esp does not move around.

    Of course, especially 802.11 is not made for this. Did you thought about ESP-Now functionality? You needa gateway, but it could be done by a esp8266. Maybe there is the opportunity that an esp32 provide this in real time without rebooting or two esp8266 connect to each other.

    1. I would consider using rfm69 or LoRa if you want to do point to point… then you can eleminate the powerhungry esp totally and just use the attiny…. but thats a complete different design. But that would be very low power – even better than my approach.

      I just like the idea of not having a hw gateway, thats why I went down this road.

  5. Fantastic description and very good project :). I want to do the same device for impulses counter. I try to compile your code and make some interesting

  6. Hello Alex ,
    Hope you are doing well.
    I am trying to make a project which uses esp8266 and measures Temperature/Humidity using DHT11, Soil moisture, Light received and I am measuring it using Esp8266 12e and Multiplex for other two analog sensors. My question is that if I convert my project on Attiny 85 and Esp8266 12e only how much time it can run on AA batteries and I want to send data on the server in every Hr.

    Please provide some tips an solution!

    1. My guess would be that DHT11 is a powerhog… You should use a more modern sensor like mine.
      About the soil sensor I have no idea how much power it uses… You need to do some measurements/googeling πŸ˜‰
      If you only need a reading every hour you can skip the attiny from the setup.

      1. Thanks for response Alex,
        I will try to use your advice. I want another help how to establish I2C communication between ESP8266 12e and ATtiny 85 . all the code seems to be complicated when I tried can you tell us by an simple example code.

          1. Thanks, Alex,
            After putting lots of effort I found running esp8266 with multiplexer will be the best option. I am now using Lion Batteries for experiments with deep sleep for an Hr but then also the battery is draining a lot, so can you suggest with the better solution and any suggestions from you will help!

  7. You can reduce the sleeping power consumption significantly by using a low power external RTC such as the PCF8523 to switch off power to the ESP8266 and other chips.. This may extend the wifi connection time on wake up but it may be worth it if the wake time is very infrequent.

  8. Hi Alex. Thanks for this writing up. I learnt a lot while working through this series.
    I currently work on a quite similar project and can’t decide how to power my circuit properly. Did you decide on this topic already. You wrote the setup would run nicely on some AA Batteries, which would be my preference since I don’t want to deal with LiPo/LiIon batteries. My concern is that eg. 2xAAs would require a step up to 3,3V which would introduce another component that drains the battery. Another topic of concern would be under-voltage protection for the batteries.
    Do you have any thoughts on these topics?

Leave a Reply

Your email address will not be published. Required fields are marked *