SparkFun Forums 

Where electronics enthusiasts find answers.

Questions relating to designing PCBs
By smdFan
#50599
emf wrote:
smdFan wrote:How long of a battery life I might get?
It should last quite a long time if you put the batteries in backwards :-)

Never dealt with battries so I do not know if it is somehow calculatable. I think it should be.

Let's say you have the following:

Bat = 5V
AVR MCU operable in the range of 2.7-5.5v running an LED (blinking).

There got to be a way to calculate precisely how long the bat will effectively operate the MCU to turn on the LED. But I do not know where to begin. Any thought, books, tutorial et ct. ?

Regards,

smdfan.
User avatar
By bigglez
#50601
Greetings smdFan,
smdFan wrote: Never dealt with battries so I do not know if it is somehow calculatable.
.....
There got to be a way to calculate precisely how long the bat will effectively operate the MCU to turn on the LED. But I do not know where to begin. Any thought, books, tutorial et ct. ?
The useful life can be calculated easily, but it's
a situation with many variables so the answer
isn't very accurate. A better method is to measure
the useful life over several different batteries and
under worse case conditions, and calculate the
average.

Before starting you'lll need to know about the
battery. In particular, the energy capacity measured
in Ampere-hours at a given load, and the behaviour
of the battery at the end of it's life.

Use Google to find the datasheet for the battery you
will use. Ideally, the battery will give constant voltage
regardless of current demand or temperature, and
when exhausted the voltage will drop suddenly.

A real world battery will gradually decline and do so
faster at elevated temperatures. Also, batteries have
a self-discharge behaviour that will kill the battery if
it is left unused (storage) for a long time. Fresh
batteries are always preferred!

The ampere-hour capacity is known as "C" and the
rate of discharge is often C/5 or C/10, because
a higher current load will shorten the battery run time.

An end-of-life voltage should be selected, and even
if the battery has more energy to give up the load
should be removed when the EOL voltage is reached.
Some rechargeable batteries will be damaged if the
battery is discharged too much.

You can easily rig an experiment with a DMM and
stopwatch (or wall clock) to measure the battery life,
either running the target project or using load resistors
to draw the desired current.

Comments Welcome!
User avatar
By leon_heller
#50602
Which battery, AVR, LED and resistor? Clock speed?

Leon
By emf
#50604
Now we're starting to get somewhere. The main thing you should check is how many mAh (milliamp-hours) your battery will provide. They'll usually say on the package. Let's say you're using four rechargable AA batteries in series. NiMH are 1.2V each, so that gives you 4.8V, pretty close to your 5V. Capacities vary, but mine are fairly old so they're 1800mAh each, so all together, you have a 4.8V 1800mAh battery. Let's also say you're just lighting a basic red LED with a 330 ohm current-limiting resistor. That will draw about 10mA (less, but 10 makes for easy math). Your battery should power the LED for 1800mAh / 10mA = 180 hours = 7.5 days. It's never really that simple, but that'll give you a ballpark estimate.

The microcontroller varies quite a bit. The current it draws depends a lot on how fast you run it and what type of tasks it is doing. If you're just blinking an LED a few times per second, you can leave the microcontroller in a low power mode and it could consume less than 1uA, so little it's not worth trying to calculate. If you are running the processor as fast as it can go with all the peripherals enabled, it could suck up 20-40mA. The datasheet should list the current draw at various speeds.

If you're blinking the LED, calculate the average current draw. If it's on for one second, off for one second, then call it 5mA and enjoy your 15 days of runtime.
By Philba
#50605
I think the answer to "how long does it last?" is uninteresting if you haven't considered the question: "How do I make it last longer?".

The simple answer to the former question is measure the current draw of your device and divide the battery capacity by that. This is an upper bound, probably 10-20% optimistic.

There are a myriad of tricks and techniques that you want to use for a battery powered device to minimize current draw. Designing your software to be interrupt driven and keep the processor in sleep mode except when processing interrupts will help a lot. Running at the lowest effective clock rate will also help. Some processors also allow changing the clock rate so that when you need the horsepower, you run fast and when you don't you run slow. The TI MSP430 is particularly well designed for that but the AVR line isn't too bad.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]