Electronic – Battery life monitor on PIC circuit

batteriespic

I have a small circuit using a PIC18F14F50 microcontroller chip which is logging data into an external EEPROM chip over an i2c interface (which I can then read back later over the USB interface). One sample is recorded every 15 minutes and doesn't need to be particualrly accurately timed.

It's ok if samples are missed or mis-timed while batteries are being changed, but it's not great if the batteries expire and no data is recorded for several days until someone notices.

So I'd like to warn the user when the battery is low in plenty of time for them to replace them. The average current is under 2mA and I'm running in from 3 AA alkaline batteries in series to give 4.5volts so I'd expect them to last quite a number of days.

But I'm wondering how to detect that the battery is low? I presume the voltage will drop as the batteries reache the end of life. I'm thinking that this PIC has a 1.024v reference voltage so I can divide down the supply voltage and feed it to an analogue input and when the divided voltage drops below that trigger a warning.

But I don't know enough about batteries to know how well this will work? And I don't know what voltage to choose that would indicate that perhaps 10-20% battery life is left. Will that even work at all? Is there a better approach?

This doesn't need to be at all accurate, I just want to give a good warning in plenty of time without getting people to disard batteries that still have life left in them.

As my current usage is fairly constant, would a simple timer be reasonable if I can work out how long the batteries last on average and then pick 85% of that time before I give the warning? Or does battery life vary more than that?

Any thoughts would be welcome.

Best Answer

First, let me comment on the timer circuit. This will work, as long as your batteries are all of relatively the same age and kept in the same conditions. In 6 months when you are still using this and your batteries are all 6 months older you will need to update the timer. Functional solution, but not the best one.

You can divide down the voltage for your input with a resistor network that has a high enough voltage not to affect your lifetime(you can use a network that does load, you just replace your batteries more often). There is one catch, you need to Load a battery to see a true value of it's life left. You will find the more loaded a battery is the more the discharge curve looks like a line. It will never be a line, there will still be clear phases, but you can dependably correlate a loaded batteries voltage with your life left.

If your PIC is on during the measurement you will probably get a decent measurement. Have the pic spend time measuring your battery and look at the resulting voltage curve until your device dies. If the curve stays relatively flat, and then suddenly drops and your batteries die then you will want to use a transistor and load resistor to increase current draw during battery measurements. There is a large amount of information on batteries on battery university. Often microcontrollers fail to pull enough current to get a curve that is sloped the entire way(I have seen this problem with ultra low power uC like MSP430). You will probably be fine with just your PIC running.

Research into AA battery chemistry has fielded some results. It does look like they show pretty flat discharge curves with low currents(<500 mA). This will mean that you will likely want a resistor discharge circuit coupled with a transistor to allow the voltage measurements to be more valuable.

Please forgive me if this was not clear enough. If you comment and questions or suggestions I will update it.

Related Topic