Chagrin:
adrian_h:
Chagrin:
The AVR chip itself can monitor its own battery voltage. You have to set the analogReference to INTERNAL (which is 1.1V) or use an external voltage reference such as a TL341 and then measure the battery voltage against that. Once your chip recognizes that the battery is low you can set it into a sleep mode, waking it periodically to blink your LED, etc. and that will be much simpler and more efficient than any external monitoring circuit.Isn't 1.1 V too low a voltage? Doesn't that mean that if the voltage goes above 1.1V that the value returned will just be maxed out at 1023?
Yes, that's correct; you would need to use a voltage divider to keep it under whatever your reference voltage is. Well, point being that you have to compare the battery voltage against some known reference. Leaving it as analogReference(DEFAULT) would be comparing it to itself.
There are a couple of different methods to allow a arduino to 'measure' it's own Vcc voltage. Perhaps the easiest is to just wire the shield's 3.3vdc pin to a unused analog input pin and use the resulting reading as a compensation value to compute what the internal Vcc reference (actually Avcc) must be.
Another method is to select the analog input mux to read it's internal 1.1vdc band-gap voltage directly and then 'reverse calculate' what the Avcc voltage must be.
Lefty