# Calculate lifespan of BLE ESP-32 module

I have purchased an ESP-32 BLE module. I have programmed it to turn on to broadcast a Bluetooth text to my phone and then enter the deep sleep mode. Then continue this loop.

When the Bluetooth text code it been to run the current it pulls is around 150mA. Then the module enters the deep sleep mode for 15 seconds at which time the module now pulls only 10mA.

I want to know if I ran it of lithium battery like the 18650 with a capacity of 2600mAH, how long will the battery last?

Please note I know how to calculate the lifespan of the battery it is just the current pulled by the device divided by the capacity of the battery. But how is it done when the current is not constant but changes between 'two current states' i.e. 150mA for 2secs then 10mA for 15secs and then loops again?

• So are you asking how to calculate the average current consumption? You already know the times and currents, you simply calculate the average consumption during the 17 seconds. Then you divide the battery capacity with average current to find operating time. Jun 13, 2020 at 10:57

But how is it done when the current is not constant but changes between 'two current states' i.e. 150mA for 2secs then 10mA for 15secs and then loops again?

The average current taken is: -

$$10 \text{ mA} + \dfrac{140 \text{ mA} \times 2\text{ seconds}}{2\text{ seconds}+15\text{ seconds}} = 26.5 \text{ mA}$$

That should be the current used.

Please note I know how to calculate the lifespan of the battery it is just the current pulled by the device divided by the capacity of the battery.

That assumes a fully charged battery discharged to a voltage level that may be below the minimum operating voltage for the blue tooth module so, you need to be aware of this and make plans accordingly. Maybe use a buck-boost converter to extract the maximum range. You should also consider that charging a lithium battery to its full level repeatedly may not give the best lifetime for said battery.

• Just to confirm the 17 seconds is: 2seconds + 15 seconds, so basically the total time? Jun 13, 2020 at 10:55
• Correct and also note my addition. I'll make the 17 seconds clearer in my answer. Jun 13, 2020 at 10:56