Estimating Running Time

How long will one set of batteries last?

This can be fiendishly difficult to predict! Sometimes the only way to be sure is to plug it in with a fresh set of batteries and check the circuit and a clock periodically, until the LEDs fade or start to act erratically.

Why is it so difficult to predict?

Digital LEDs seldom run in one fixed state — they’re usually animated. We can estimate the power use for a steady configuration, but animation is constantly in flux.

Also, battery manufacturers often overstate their cells’ capacity, or express it under extremely idealized circumstances.

Where do I start?

Track down a datasheet for your batteries! You might find it on the manufacturer’s web site, or a vendor site such as Digi-Key. Easiest is just to use a web search engine. In most battery datasheets you’ll see one or more charts like this one:
This chart shows the cell’s output voltage over time, at different discharge rates. You can see that the expected service life is not directly proportional to power drain — halving the latter more than doubles the former. Again, with a fixed configuration, we could plan for this, but our LEDs are in motion, which doesn’t make things any easier. You’ll probably just have to come up with an informed average.

Elsewhere in the datasheet (or often printed on the cell itself, in the case of rechargeables), you may find a capacity in mAh (milliamp-hours).
LED current use is measured in milliamps (mA). As a rule of thumb, we usually use 20 mA as a guideline for a single LED at full brightness, and each color “pixel” contains three LEDs (one each for red, green and blue), for a total of 60 mA per pixel when displaying white at full brightness. If we leave that pixel on in that state for one hour, we’ve used 60 milliamp-hours (60 mA × 1 hour = 60 mAh). If the stated battery capacity is 2100 mAh, we could expect to run that one pixel for about 35 hours continuously before the battery peters out (2100 mAh ÷ 60 mA = 35 hours).
But single pixels are seldom left on at full brightness for hours. Usually there’s some combination of brightness levels being mixed, some number of pixels are off entirely, and these states may change many times per second. That’s why we just use reasonable estimates, as in “On average, running this code, I think there’s about ten pixels on at any given time, and the average color mix represents a brightness level of 75%.” Starting with the “60 mA per pixel” rule of thumb: 60 mA × 0.75 = 45 mA average per pixel. 45 mA × 10 pixels = 450 mA. Left to run continuously, with a 2100 mAh battery pack, 2100 mAh ÷ 450 mA = 4.66 hours.

Complicating matters further, the LED driver chips themselves use a tiny bit of current, even when the LEDs themselves are “off.” Each chip needs about 2 mA extra…for a strand of 25, it’s using about 50 mA just in this idle state. You may want to factor this into your estimation. Oh, and we forgot to mention power use for the microcontroller that’s driving all this…about 25 mA or so for an Arduino. So we’ll add about 75 mA to the above estimate: 2100 mAh ÷ 525 mA = 4 hours.

If you have a really nice multimeter with an average current recording mode, it will be your new best friend, because it’s doing this based on actual readings. But this capability is usually present only in high-end meters.

You may also want to add some “engineering overhead” to your estimate. Remember what was said about battery capacity often being idealized. So we’ll de-rate the battery by a bit, let’s assume reality is about 80% of the stated capacity: 2100 mAh × 0.8 = 1680 mAh. 1680 mAh ÷ 525 mA = 3.2 hours.

As you can see, there’s an awful lot of fudging and speculation in this process. This is why we say it’s easiest sometimes just to plug in some batteries and keep an eye on it!
Last updated on 2016-09-07 at 03.24.33 AM Published on 2012-07-29 at 11.58.37 AM