-
Categories
-
Platforms
-
Content
You need to monitor the batter voltage, but it's not quite that easy...Hi there,
What's a low cost and simple way for an arduino to monitor it's own battery level?
Should I feed the + from the battery though a resistor to an analog pin and measure it there? Or is it more complicated than that?
Cheers
No, the reference voltage is a circuit that derives its power from the battery you are trying to measure but provides a stable reference voltage as the battery voltage varies. You can purchase an IC that does this. And the multiple analog comparators suggested by @cjdelphi is also a viable approach with possibly less programming involved.Thanks for your help guys. By reference I assume that this would be a separate power supply - if that's the case, does that make it impossible to do this if there is only one battery source that powers the arduino and needs to be measured?
I would build a voltage divider to reduce the analog input by 50%, because the battery voltage could be considerably larger than the Arduino's voltage-regulated 5 V. It isn't uncommon to power an Arduino from a 9 V battery so reducing this to 4.5 V before measuring it is desirable. The Arduino will digitize (convert from analog to digital) an analog signal between 0 V and 5 V as a digital value from 0 to 255. So, 4.5 V is 90% of the full-scale range, and your program could set an alarm when the digitized value is significantly less than 255 counts and it is time to change the battery. How much less? That depends on what the minimum voltage requirement for the Arduino on-board voltage regulator is. Most three-terminal regulators (except for low-dropout or LDO regulators) need about 2 V more than the regulator voltage output, so about 7 V for a 5 V output. When the 9 V battery voltage drops below 7 V it is time to change the battery. That would be 3.5 V at the measuring input, which is 3.5/5.0 or about 178 counts out of 255 full-scale counts. Set this as the "trip" level for your alarm.Hi there,
What's a low cost and simple way for an arduino to monitor it's own battery level?
Should I feed the + from the battery though a resistor to an analog pin and measure it there? Or is it more complicated than that?
Cheers
Don't know if this is possible with Arduino, but here is a good trick to do this on PICs.
PICs have an internal precision reference, which is settable to 1.024, 2.048 or 4.096V. You can measure this voltage with the A/D using the battery voltage as the reference for the A/D. From that you can calculate the actual battery voltage.
Bob
you can use either one as a reference, but the whole idea here is to measure the battery voltage AND a known reference voltage. Otherwise relying on the A/D by itself may give skewed results... as the A/D conversion may drift as the supply voltage drops.As I interpreted your words, the 4.096V reference will always be constant, the battery voltage will continually drop. Then, we have to compare the 4.096V with the battery voltage, which is reduced by a voltage divider first to be able to feed to the PIC. Am I correct??