# Just finding how long an ESP can run in deep sleep mode off a LiFePo4 battery?

Joined Mar 1, 2016
13
I read an ESP runs at 20 uA in deep sleep mode. Assuming this is true...
Take the capacity of one LiFePo4 battery to be 650 mAh.

Amps*seconds*minutes
0.00002*60*60
= 0.072 Ah

So one 650 mAh battery should last roughly 650/72 = 9 hours under constant load? That seems really low. Did I make an error?

Joined Mar 1, 2016
13
Wow, I was way off.

0.02 mA
650 mAh

650/0.02 = 32.5k hours
650/(0.02*24) = 1354 days
650/(0.02*24*365) = 3.7 years

#### WBahn

Joined Mar 31, 2012
28,492
I read an ESP runs at 20 uA in deep sleep mode. Assuming this is true...
Take the capacity of one LiFePo4 battery to be 650 mAh.

Amps*seconds*minutes
0.00002*60*60
= 0.072 Ah

So one 650 mAh battery should last roughly 650/72 = 9 hours under constant load? That seems really low. Did I make an error?
Uh. Yeah, you did. Because you were fast and lose with your units.

You threw away the units, did some math on some numbers, and then tacked on the units that you wanted the answer to have without regard to what units the answer actually had.

650 mAh / 72 mAh

leaves you with a dimensionless quantity, but you are looking for an answer with dimensions of time. If you had tracked the units, they would not have worked out to what you want and that would be the red flag that something went wrong.

Taking a step back and tracking units, your have:

(0.00002 A) * (60 what?) * (60 what?)

If you want how much charge is consumed after 1 hr at 20 µA, you want:

(0.00002 A) * (1 h) = 0.02 mAh

Your 60*60 can only be a conversion from Ah to As

(0.00002 A) * (1 h) * (60 min/h) * (60 s/min) = 0.072 mAs

You need to properly track your units through EVERY step of a computation. Most mistakes (not all) that you make (and you WILL make many of them -- we ALL do) will mess up the units, allowing you to spot that an error has been made almost immediately, which not only let's you track it down quickly and fix it, but it prevents you from wasting a bunch of time on the rest of the work, which is guaranteed to yield a wrong answer at this point, and from relying on an answer that is wrong without realizing that you are doing so.

To get at the answer you finally got, you can do it like this:

20 µA * T = 650 mAh

T = (650 mAh) / (20 µA)

T = (650 mh) / (20 µ) * (1000 µ)/(1 m)
T = 32500 h * (1 day / 24 h) * (1 yr / 365.25 day) = 3.7 y

Since the battery probably won't last that long sitting on a shelf, you can expect the device to be able to stay in sleep mode for the shelf life of the battery.

But, of course, a micro that never leaves sleep mode might as well not be there -- unless the whole point is that if SHOULDN'T ever wake up UNLESS something has gone wrong.

In fact, it's FAR worse than that. A typical such battery has a self discharge of about 5% per month.

For a 650 mAh battery, that's 32.5 mAh/mo

If we assume 30 days in a month, that's a 45 µA self-discharge rate, or twice the MCU sleep current.

So a better estimate would be to use a 65 µA draw, which gives you an estimated battery life of about 7.8 13.9 months.

EDIT: Screwed up the final calculation, somehow, and failed to do the "does the answer make sense" sanity check.

Last edited:

Joined Mar 1, 2016
13
Where do you read 5% per month?

LiFePo4 from what I read discharge at a max of 3% per month.

Joined Mar 1, 2016
13
"LiFePO4 batteries have a low self-discharge rate of 2% per month."

Joined Mar 1, 2016
13
650/(0.065×24×365)

= 1.1 years

#### WBahn

Joined Mar 31, 2012
28,492
650/(0.065×24×365)

= 1.1 years
I don't know what mistake I made when punching it into the calculator on the fly.

But one thing I didn't do, which I almost always do, is ask if the answer makes sense.

Since 65 µA is about 3x the draw of 20 µA, the answer should be about 1/3 of the original answer, which would be 1.2 years. Since 7 months is well shy of that, I should have suspected a mistake and looked further.

#### WBahn

Joined Mar 31, 2012
28,492
Where do you read 5% per month?

LiFePo4 from what I read discharge at a max of 3% per month.
I did a quick search and the first four sites I found that gave a self-discharge rate all mentioned the same value.

If you have a better value, particularly one specific to the batteries you are actually using, by all means, use it.

Joined Mar 1, 2016
13
Lot of good tips and practical info. Thanks!

---

(0.00002 A) * (1 h) * (60 min/h) * (60 s/min) = 0.072 mAs
0.072 As (not mAs)?

---

If we assume my application draws a constant 150 mA for five seconds twice a day...

650/150 = 4.3 hours = 154.8k seconds

10 seconds per day, 365 days...

154800 seconds / 3650 seconds
~= 42 years?

--- --- ---

Combine deep sleep and this theoretically constant application usage...

#### WBahn

Joined Mar 31, 2012
28,492
0.072 As (not mAs)?
My oops. Yes, it's 72 mAs, or 0.072 As.

If we assume my application draws a constant 150 mA for five seconds twice a day...

650/150 = 4.3 hours = 154.8k seconds

10 seconds per day, 365 days...

154800 seconds / 3650 seconds
~= 42 years?

--- --- ---

Combine deep sleep and this theoretically constant application usage...
It's hard to give a quick, "Does this make sense?" check on the answer because 150 mA is a LOT bigger than the sleep current, but 10 seconds is a LOT smaller than a day. So no immediate feel for which direction the scale tips without looking deeper.

Having said that, since an hour is 3600 seconds, 4.3 hours is going to be somewhere between 14.4 ks and 15.8 ks (110% of 14.4 ks). So a result of 154.6 ks appears to be off by an order of magnitude.

This is how I would approach it:

Self-discharge:
Pick a rate you think is reasonable. So let's say 3%/month.
That would be 650 mAh*3%/mo = 19.5 mAh/mo

Sleep:
Let's use the 20 µA (for simplicity, we'll assume this is continuous, even when active).
That would be 20 µA * (1 mA / 1000 µA) * (24 h/d) * (30 d/mo) = 14.4 mAh/mo

Active:
150 mA for 5 seconds, twice a day.
So that would be (150 mA) * (5 s / event) * (2 event/day) * (1 h / 3600 s) * (30 day / mo) = 12.5 mAh/mo

Total:
19.5 mAh/mo + 14.4 mAh/mo + 12.5 mAh/mo = 46.4 mAh/mo

Life expectancy = 650 mAh / (46.4 mAh/mo) = 14.00 mo

Doing it this way let's us see some potentially useful relationships. The active energy needs are comparable to the sleep needs and the single largest (but not by much) need is the self-discharge.

Because using a larger battery would increase the self-discharge proportionately (roughly), there is probably not a lot of additional life expectancy to be gained from using a larger battery.[/QUOTE][/QUOTE]

Joined Mar 1, 2016
13
1. ESP01/07/12 minimum 3V operation
2. 650 mAh rated LiFePO4 battery, 80% useful operation
3. 3% self-discharge/month

150 mA for five seconds twice a day
~20uA deep sleep mode

80% * 650 mAh / (46.4 mAh/mo) ~= .8*650/46.4 = 11 months!

I estimate changing batteries 1-2 times/year. So this tells me I either need to use more batteries or change the battery twice a year

#### WBahn

Joined Mar 31, 2012
28,492
That sounds reasonable. Having a plan to change it twice a year but having a life expectancy of nearly twice that gives a nice margin for variations in parameters and assumptions plus some leeway in when you actually get around to changing them out, but at the same time not drastically oversizing the battery.

#### joeyd999

Joined Jun 6, 2011
4,817
FYI to TS:

This is a practical example of where I would look at alternate battery chemistries.

A 123 primary (non-rechargeable) lithium battery (3V @ 1500mAH) has a shelf life of 10 years.

Your application would likely run 10 full years on one battery -- even at sub-zero temperatures. No recharge necessary.

This would greatly simplify your design with reduced cost and improved performance.

#### WBahn

Joined Mar 31, 2012
28,492
I agree with Joey. We (I) can get so focused on the question as originally asked, that we forget to step back and ask the most relevant question of all -- what is the actual problem that needs to be solved.