I need to implement a battery life indicator for my project. What I have in mind is a very simple battery life indicator for a 9V battery, using just 1 red LED. So what happens is that when the voltage reaches around 7.8V and below, the red LED lights up. If it is higher than 7.8V, the red LED does not light up. And when the red LED lights up, it sends a signal to the arduino which then displays a warning sign on the LCD display.
Can anyone help me with how the schematic should look like and connections for the battery life indicator should look like? Am totally clueless (New to arduino )
Make a voltage divider from two 100K resistors, connect it between +9V and ground, and connect the midpoint to an analog input pin of the Arduino. Also connect a 10nF or 100nF capacitor between the midpoint and ground. When you do an analogRead from that pin, 7.8V will correspond to (7.8/2) * (1024/5) = 799. If you get a reading less than that, drive an output pin high to light the LED. How you display the battery state on the LCD is up to you - I normally display the battery voltage to 1 decimal place if there is enough space.
oric_dan(333):
OP, I hope you're not trying to power an Arduino using one of those measly little 9V batteries.
If I use these "measly little 9V batteries" with my arduino projects, which don't involve actuators but do have displays, I can have them run for a maximum of 2 days straight. If you just occasionally turn them on and look at them, they can last for quite some time. One of my projects from 2 years ago is still working with this battery since I turn it off after running it for a bit. These are two extremes but the OP really didn't say what amount of power is involved in the project so every 9V batteries are not totally unfit.
Looking at this d/s indicates 600 mA-hr for 25 mA load, so a regular Arduino without any loading will run
for maybe 24 hours. Poo on that, says I. Rechargeable 9V are only rated at 200 mA-hr, so 3X worse.
I am thinking of running the arduino with a 9V b attery indeed..
The arduino is basically connected to a 16 by 2 LCD display, a RTC module, 2 push buttons and a servo. But the servo runs on its own battery source. so, the arduino powers everything else other than the servo. The servo rotates 180 degrees every 4 hrs per day max. And the LCD display sleeps after inputs have been transferred to it via the pushbuttons and only wakes up when the pushbutton is pressed again or when the battery gets low...
@oric_dan(333) : That is incredible -- how did using a 32-Khz xtal reduce the current draw that much? I'm curious what the exact numbers are on the current draw that you measured.
oric_dan(333):
I have used the 9V in dataloggers with 32-Khz xtal. At that rate, it will run for about 30,000 hours or
about 3 years. That makes more sense.