Electronic – arduino – Rough Battery (9V Alkaline) Level Estimation with Analogue Reading

arduinobatteriesbattery-operatedembedded

I'm building a portable desktop weather station using an Arduino Nano micro-controller. The system is being powered by a consumer 9V alkaline battery, with the voltage being regulated by the Nano's on-board regulator.

I want to have a rough battery level displayed on the LCD screen.

The initial approach I have taken is by using a voltage divider which scales the input 9V to 3.3V. This signal is then input into to the Analogue IN (A6) of the Nano, ( AREF is set to 3.3V due to other analogue input device requirements).

From this I was assuming that ranges of voltage readings could correspond to FULL, HALF and LOW battery indications.

I understand that the battery terminal voltage will change with current draw. I expect a peak current draw of 350mA with a typical draw of about 100-150mA.

What is a good scheme/algorithm/cutoff values I should use to roughly measure battery level?

EDIT:
-My Estimated power draw was wildly inaccurate. After measuring the current draw of the final device, consumption was approximately 30-40mA continuous, with rare peaks of 50mA.

-I ended up using a simple battery percentage using AnalogRead(). I calibrated a fresh battery to display ~90% by adding a fudge factor. It was fairly successful as a rough estimation.

Best Answer

Expect 9V as a fresh battery, and about 6-7V as a dead battery (I guess you need 5V in your device, right?)

In case of a good battery, continous load shall not give you really different measurements. Of course, the battery voltage may drop by say, 0.1V, but it is really something you can ignore.

You may want to take into account the discharge curve of your battery to improve accuracy of power estimation: http://www.powerstream.com/9V-Alkaline-tests.htm This could be done by having a simple array converting measured voltage to expected % of remaining power.

I suggest you to code some histeresis, otherwise you will see your status bouncing between "full" and "half" states when the battery is nearly drained to half.

I agree with the other comments that a 9V battery has only one advantage: convenience. It is really not the best power source for your circuit, you may run your stuff from 3xD cells (4.5V connected right to the 5V rail, bypassing the LDO) for about 40-50 times longer than from a 9V battery.