In my last blog post I took an Adruino Uno and a Protoshield and made a simple battery monitor, so I could measure the voltage of a discharging 9V battery when it was drained through a constant 100mA load. Below is the 9V battery discharge curve:
The 100mA constant load was chosen because my ProtoStack Arduino Clone with LCD draws about 92mA and I wanted to write a sketch to display a battery bar and the approximate hours battery life left. Since all batteries have an internal equivalent series resistance (ESR), it is important to take that into account when only using a battery's voltage to monitor its state of charge. Since we discharged the battery through a load that is similar to the ProtoStack board with LCD, the ESR of the battery has automatically been accounted for in the voltage measurements.
With the plotted excel data from the discharge monitor I created a look-up table in software to approximate the battery life:
Battery Voltage Hours Life Left Displayed Battery Bars
7.87V > Batt 4.5hrs 4
7.45V > Batt <= 7.87V 4.0hrs 4
7.23V > Batt <= 7.45V 3.5hrs 4
7.08V > Batt <= 7.23V 3.0hrs 3
6.94V > Batt <= 7.08V 2.5hrs 3
6.77V > Batt <= 6.94V 2.0hrs 2
6.56V > Batt <= 6.77V 1.5hrs 2
6.30V > Batt <= 6.56V 1.0hrs 1
5.71V > Batt <= 6.30V 0.5hrs 1
Batt <= 5.71V mins left 0
Here is the sketch I wrote: link
I tied the input voltage through a resistor divider (220K Ohm series and 100K Ohm shunt) to the A0 pin on the micro.
One issue I ran into was the 9V battery can go down as low as 5.71V before it is completely dead. The ProtoStack board has a 1N4004 reverse polarity protection diode and a 7805 Linear Regulator to generate its 5V rail. These components require that the input voltage be greater than 7.8V in order to create the 5V rail properly.
So I replaced the 1N4004 diode with a schottky diode that has a much lower 0.2V forward voltage and used a L4941 5V linear regulator to replace the 7805. The L4941 has a drop out voltage of less than 0.45V when sourcing 1Amp. With these mods I was able to go down to 5.30V input voltage before the LCD stopped functioning.
I used the Parallax 16x2 LCD commands to create the custom characters for the "EH" and Full & Empty Battery Bar Segments. Here is a link to the spreadsheet I used to calculate the values for the custom characters.
This was a fun project to get myself familiar with the Arduino Analog pins. Now my ProtoStack Board is all ready for a future portable battery powered electronics project.
It is important to take that into account when only using a battery's voltage to monitor its state of charge. Since we discharged the battery through a load that is similar to the ProtoStack board with LCD, the ESR of the battery has automatically been accounted for in the voltage measurements. batteriser
ReplyDelete