ESP8266: Good enough for a battery powered sensor?

ESP8266_power_measurements_ battery_lifeDuring the last 2 weeks I’ve collected a lot of ESP-8266 power usage charts as shown here. Enough to conclude that a ESP8266 can be used to build battery powered sensors (e.g. a temperature sensor) but how happy you’ll be after some time highly depends on the report interval. A report interval of 4 samples per hour will lead to a battery life of roughly 1 year. Increasing the report interval to 60 times an hour (once per minute) will lead to a much shorter battery life: less than 3 weeks.

The biggest problem lies in Wifi. It takes my ESP-12 about 1 … 3,5 seconds to get a Wifi connection after waking up from deep sleep. And this is by far the largest contributor to the total time needed to get a sensor value out the door. I tried several things to see if I could shorten the time needed to get a Wifi connection but had no luck; a dedicated AP for a single ESP-12, moving the AP within 2 m. range of the ESP, changing channels – nothing. Maybe turning off (WPA) security may help, but I don’t consider that as a real option. Maybe a static IP address may help (instead of using DHCP) but that’s not a real option either. Increasing the report interval of the sensor is the only thing I can think of right now to get a good battery life (of 1 year or more).

So that’s it, ESP8266 is a no-go? No way! The ESP8266 can still be very helpful in a lot of ways, I’ve had a lot of fun while exploring the ESP8266 and will definitely use them whenever I need always-on Wifi for so,me future project. And I made a nice ‘poor mans digital scope’ during all the fun as well. But it won’t work well when you want to use a relatively short report interval

Is there an alternative for the ESP8266? Lots of ’em, mine is called Zigbee. I’ve been using Zigbee modules since 2010 or so and built my own Zigbee sensors based on a JeeNode + XBee series 2 modules. For motion, temperature, barometric pressure, light intensity (lux). Batteries last about a year, that’s OK. If I would let a ESP8266 do exactly the same thing (with the same reporting interval, sensor type) as a combination of JeeNode & XBee, the batteries would probably last about 8 weeks. Wooaahhh…

I have some unused 3.3V Arduino Pro Mini’s and some XBee’s and will make some similar power usage charts of those; an XBee is ready to send in 35 milliseconds after power-up, so here the numbers will be quite different …

For those interested I’ve put together a page with some of the ESP power usage charts here, so you can see for yourself.

And now it’s time to move on … cause a new Odroid-C1 arrived on which I’m gonna play with OpenHAB, CometVisu, PencilBlue and some more interesting stuff šŸ™‚

Tagged , , . Bookmark the permalink.

29 Responses to ESP8266: Good enough for a battery powered sensor?

  1. Gary says:

    Hi Robert,

    I may have missed it, but what battery did you use for testing
    AA, AAA, NiMh ?

    Thanks great article

    Regards

    Gary

    • Robert Hekkers says:

      I did not use batteries because that wasn’t really necessary for this kind of test. So the supply voltage was 3.3V

  2. Michael says:

    I used it with a LiPo and a 1N4148 to get ~3,3v. It works perfect for many days.

  3. Giuliano says:

    Can i ask something about Xbee (never used)? Really 35ms to catch an IP from DHCP and ready to send a packet ?

    • Robert Hekkers says:

      XBees don’t work with IP; they’ve got a unique 64-bit hardware address and communicate with a Zigbee Coordinator (which is somewhat similar to a Z-Wave controller but different).

      • Giuliano says:

        Oh, i see … something like potatos and oranges…

        • Robert Hekkers says:

          Right, it’s something completely different. For me Zigbee works very well for battery powered sensors. I use Zigbee, RF 433, 868, Wifi, powerline – whatever is best for a specific job.

  4. Ansis says:

    well my results were somewhere near – I got ~3 weeks of combined (DHT sensor, arduino barebone, ESP8266) sending once in 10 minutes. I was putting everything to sleep.. still it was only ~3 weeks. imo ESP8266 still drains too much when sleeping :/ I consider moving to NRF24Lxx. I did try to use basic 433MHz RF Transmitters but as there are several sensors that need to send data I need ACK so need smth smarter then basic 433.

  5. Ansis says:

    well XBees are very expensive if compared to ESP8266 or RF 433 :<
    I need ~7 sensors

  6. timoline says:

    Hello Robert,
    thank you for your research….

    Can I make a simple conclusion like:
    1 sample per hour = 4 years and then 4 batteries = 16 years ?

    • Robert Hekkers says:

      1 sample/h = 4 years? No, 4 samples/h is about 1 year of battery life, that’s 1 of the estimations I calculated. 1 sample per hour wasn’t interesting enough for me. The lower the sample rate, the lower the influence of the power usage of taking a sample becomes; but your calculation disregards the deep sleep power usage. The influence of the batteries used can have an impact though.

      If you’d use 4 x 3.3V 2500 mAh batteries in parallel that would probably help but then the situation changes: using batteries in parallel has some side-effects.

      If you’d use a couple of 1.2V 2500 mAh batteries in series (to get close to the 3.3V operating voltage of the ESP) then battery life will not differ much from my calculations – in series, the Ah don’t add up.

    • Thomas Lytje says:

      No, the batteries will discharge them self. Even if you had absolutely nothing connected to the batteries they wouldn’t keep the charge for 16 years.

  7. Pete says:

    It’s interesting what you say about power draw. The experiments I have done with the 8266 reflect your own experiences: it just takes too long to associate with an AP and push data.
    My application may be practical (a PIR proximity / suspicious person detector that is backed by a small solar panel) as the power can be topped up from the solar cell. However I can achieve the same sorts of functionality using a NRF24L01 which can power up, send it’s payload and go back to sleep much quicker. Even though this means I have to run the code on an Arduino rather than natively on the 8266, it still seems to be a better solution.

    Shame really. The 8266 seemed so promising for this application. I’m sure I can use them in other places where power draw is less important.

    • Robert Hekkers says:

      Hi Pete, good to read that I’m not the only one concluding that Wifi is not the best fit for battery (only) powered sensors. It’s always good to keep both feet on the ground, do some measurements which are good enough to come up with some solid conclusions instead of expecting a battery life based on speculations. šŸ˜‰

  8. Clemens says:

    Perhaps considering Moteinos http://lowpowerlab.com/blog/category/moteino/ an Arduino clone with RFM69 modules would be an option?

  9. Shai says:

    Hi Robert,

    Thank you for this information. It is helpful.
    One thing I dont understand – what battery did you use to calculate the life time (AA/AAA/something else)?

    Shai

  10. George says:

    I’m seeing similar results as you have, in that it takes more than 2 seconds to connect to WiFi. What I’m working on that I’ll release soon is a carrier board that has energy harvesting, battery charging, and backup battery. The regulator is switchable from 2.8V to 3.3V but I’ve found the Lua firmware to have this Zoombie effect when running less than 3.3V. Other firmware don’t seem to have this sensitivity but I have tested as much with them.

    As soon as I run some more tests I’ll be posting the design to see if there’s enough interest to produce it. Results look very encouraging so far, especially if the Lua firmware can be improved.

  11. Nic Roche says:

    Did you end up getting the power usage stats for the arduino pro mini?

  12. Robert,

    I have read with great interest your comments on the ESP8266.
    Could I have your opinion on the following process ?

    Suppose we start the ESP8266 in NO_RF mode (executing a deepSleep(0, WAKE_RF_DISABLE).

    Then we check for the necessity of sending data (for example after the detection of a temperature above a certain limit).
    Case 1:
    When it is necessary to send data, we put the ESP8266 into RF mode (executing a deepSleep(5minutes, WAKE_RF_DEFAULT) and record in the Flash that some data should be sent out.
    Five minutes later, when the ESP8266 wakes up, we check the Flash to see if there is something to send.
    If so, we can deduce that RF is available and can send data out.
    After that we put the ESP8266 back to NO_RF mode as hereabove.
    Case 2:
    If there is no data to send, we check the condition (temperature) and either trigger a communication by putting the ESP8266 back into RF mode or not trigger any communication by leaving the ESP8266 in NO_RF mode.

    In my application, I expect that at most 1 communication would happen per hour.

    Thanks in advance for your advice.

    Pascal

    • Robert Hekkers says:

      Hi Pascal, well I think you must have noticed that it’s rather quiet on my blog since May this year; I just don’t have the time right now; sorry!
      Robert

  13. Luka says:

    Thanks for your research.
    But there is no alternatives in the same price range. Esp-12 costs only 1,8$

  14. Ganesh says:

    Hi,
    I was able to reduce the AP association time to 150ms by initializing WiFi.config with static values of ip, gateway and subnet.

Leave a Reply

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