# Powering an Arduino for a about 600 ms using a Capacitor

#### Marquis

Joined Jan 18, 2015
16
I'm powering my AtTiny84 with a single AA battery using the NCP1402 DC/DC Boost IC. That works fine, but I want to disable the NCP at times in order to sample the battery voltage. In order to do that and keep the microprocessor running I want to use a capacitor for about 600 ms while I sample the battery. Any suggestions for a capacitor?

What formula's could I use to figure that out?

Thanks!

#### BobTPH

Joined Jun 5, 2013
5,283
dV/dT = I / C

Determine how much current is needed, how much voltage drop you can tolerate and then C will be determined.

For example: Say you want it to drop no more then 1v over 0.6 seconds and the AtTiny requires 5mA:

dV / dT = 1/0.6 = 1.67 = 0.005 / C

1.67C = 0.005

C = 0.005 / 1.67 = 0.003F = 3000uF

Bob

#### Bernard

Joined Aug 7, 2008
5,788
Need to know the voltage & drain on boosted supply.
Charge on cap ,Q, = C X V. or I X T; assume load as 10 mA, C = 1000 uF, & Vdd = 5 V,
.001 F X 5 V / .01 A = .5 sec. Use boost converter & C about minimum of 3,000 uF ??

#### takao21203

Joined Apr 28, 2012
3,702

#### takao21203

Joined Apr 28, 2012
3,702
its not making much sense either since after disconnecting the load, the battery voltage will increase over some time, depending how depleted it is.

Why 600mSec?

#### GopherT

Joined Nov 23, 2012
8,012
Why not use a voltage divider with two resistors (90.1k and 9.01k) then your battery voltage is 10x your measured value. You can also use any two random resistors that do not waste too much power, as long as you can do the math.

#### RichardO

Joined May 4, 2013
2,271
Why not use a voltage divider with two resistors (90.1k and 9.01k) then your battery voltage is 10x your measured value. You can also use any two random resistors that do not waste too much power, as long as you can do the math.
If the battery voltage is less than the voltage supplying the micro then a voltage divider is not needed. You may still want a resister between the battery and the A/D input for unexpected conditions.

As alluded to by takao21203, you do not need to disconnect the load to measure the battery voltage. In fact, you will get a better reading with the battery under load.

Even under the best of circumstances it is hard to get a reliable battery capacity measurement. Think about how much you believe the battery-life-remaining number reported by your cell phone or laptop computer. The computer, for instance, tries to measure the power into and out of the battery for its estimate. I think Microchip has some application notes on this technique.

#### GopherT

Joined Nov 23, 2012
8,012
If the battery voltage is less than the voltage supplying the micro then a voltage divider is not needed. You may still want a resister between the battery and the A/D input for unexpected conditions.

As alluded to by takao21203, you do not need to disconnect the load to measure the battery voltage. In fact, you will get a better reading with the battery under load.

Even under the best of circumstances it is hard to get a reliable battery capacity measurement. Think about how much you believe the battery-life-remaining number reported by your cell phone or laptop computer. The computer, for instance, tries to measure the power into and out of the battery for its estimate. I think Microchip has some application notes on this technique.
I assumed the OP was using a 9 volt battery and a voltage regulator. A voltage divider that brings the battery to some ratio between micro's Vcc and ground.

If a battery directly feeds the Microcontroller, you still need a voltage regulator for a reference voltage. You still need a voltage divider for this. Otherwise, you will only measure the Vcc.

Finally, some micros have of board voltage reference and then no off-board voltage ref is needed. Still need a voltage divider to get a ratio of battery voltage below the inboard voltage ref.

#### BobTPH

Joined Jun 5, 2013
5,283
If your micro has a built in voltage reference, as most of the newer PICs do, you can measure the battery voltage in an indirect way.

You set the Vdd as the reference for the ADC. Then you measure the voltage of the voltage reference (say 1.024V). It will measure high in the inverse ratio that the battery is to nominal. I.e. if your battery is supposed to supply 3V and the voltage reference reads 1.024V then the battery is actually 3V. If the battery has fallen to 2V, then the voltage reference will read 1.204 * 3 / 2 = 1.536V. So your battery is actually 1.024 / (vref read) * 3V.

Bob

#### Marquis

Joined Jan 18, 2015
16
Wow, thanks for the help. It's clear from the comments that I should refine my problem.

I am running the At84 on a single AA battery. I use the NCP1402 to boost the 1.5 volts up to 3.3 Volts. I could use the internal Bandgap reference to measure the volts but of course that would always give me 3.3 volts until the second the battery went dead.

I don't need an exact battery measurement, I need enough to plot the decline in voltage so that I can have the device give a low battery alert. The reason I didn't consider using a voltage divider and a pin to sample it was that I figured the current continually going through the voltage divider would be too much to make it worth while. I'm trying to run this sensor for as long as possible on the one battery. Would the voltage divider use current even when the AtTiny is sleeping? I assumed so and therefor didn't want to go down this route.

I had planned to periodically turn off the NCP1402 (only while most functions of the chip were sleeping) to use the bandgap reference to monitor the actual battery, but then I realized that wouldn't work. The chip needs more than 1.5 volts to run. So i planned to use the Capacitor to keep it going. Again, I have the same problem, measuring the volts (using the internal reference) now will just show the volts from the capacitor..

So it's clear that I will have to use a voltage divider. Correct? How can I absolutely minimize the draw and still get a half accurate measurement?

#### crutschow

Joined Mar 14, 2008
30,137
What is the problem with measuring the 1.5V battery voltage directly with the AT84?
The battery voltage, even when operating the micro, should still give a good indication of its discharge state.

#### Marquis

Joined Jan 18, 2015
16
The problem is that the 1.5 volts is below the operating voltage of the Micro. It cuts out around 1.8 volts I believe. So how I keep it boosted yet still maintain the ability to test the battery?

#### crutschow

Joined Mar 14, 2008
30,137
The problem is that the 1.5 volts is below the operating voltage of the Micro. It cuts out around 1.8 volts I believe. So how I keep it boosted yet still maintain the ability to test the battery?
Doesn't the micro have the ability to measure external voltages?

#### GopherT

Joined Nov 23, 2012
8,012
If your micro is running above the battery voltage, just connect your ADC pin of the micro to the + of the battery. Then, I assume you have an on board reference to compare to.