I think you could also just monitor the voltage directly using an analog input pin.
How much power do you consider a drain? any voltage divider or reference diode like the TIL431 requires power. The TIL431 is an adjustable Zener diode and does require 400 uA as a minimum cathode current for proper operation. It and a pnp transistor could make a switch for flagging when the voltage to the device was above a "Set Point" but it would require about 1 mA for proper operation when used to measure the primary power source and there's a way with 2 transistors to enable the device that isn't very complicated and draws no current until enabled. 3 transistors 2 pnp's and an npn and about 4 or 5 resistors total maybe a .1uF cap on the '431 for stability as there is a LOT of current gain in that device. About 100 uA to control up to 100 mA of Zener current through the diode.Doc
I tried to point out a simple method to measure the battery, flag it's output and be a 0 drain load until enabled circuit. I can provide a schematic If you are interested. This isn't rocket science at all just an "Open Collector NPN switch that pulls a little current from the base of a PNP to turn it on and send power to another PNP and a resistor or two and the TIL431 If the 431 is turned on enough (the battery is high enough to turn the TIL431 on then the last PNP's collector goes high and you have a "Good Battery Flag". Test for it and then set the controlling port pin low to turn off the Batt Test enable. later today I will install Fritzing or something close and create a schematic for you. If I can find it I will try to simulate it in MultiSim 11. This is in order to verify something I have used many times in the past. As I remember there is a MAX666 or something close that can give you a linear low current regulator and a low battery flag... all for 10 uA overhead... less than the current required by the Arduino linear too. Interested?..Doc
Well that sounds fine, like I said I'm interested in seeing a schematic for it to try and better understand it, but I also just had this thought that may require only a single resistor. It hinges on two questions though that I can't find the answer to.First, what is the default AREF voltage for a stand alone atmega328p. Is it the internal 1.1 volts as stated here: http://arduino.cc/en/Reference/AnalogReference?from=Reference.AREF ? Just as a side note I've got my ATMega328p set to brown out at 1.8 volts, right now mainly because the nrf24L01 needs 1.9 volts minimum to operate correctly anyway. Don't know if that makes a difference or not.Second, the voltage on a digital pin set to high is equal to the power supply voltage isn't it? Since I'm dealing with less than 5v and not using a regulator.The battery I'm using is most likely going to be a 3v coin cell. If it is the 1.1v internal aref, could I not put a ~367k resistor between a digital pin and an analog pin, set the digital pin to high, and read the analog, then set the digital pin back to low? If my math is correct that should give me roughly 1.1 volts at max power so the analog should read it's max of 1023 correct? And as the supply voltage decreases, the analog read should proportionally decrease, 2v on the power supply should give me ~682 analog reading. This is assuming the voltage going out of the digital pin decreases as the power supply decreases. So that should give me a fairly accurate reading of the power remaining in my battery? That is assuming my math is correct on the resistance value. Also I based all those calculations off something that I read that stated that the analog inputs on the mega328p uses a 100mohm resistor to create the load.I can try to test this in a bit for myself to see if it works or not, just not at my work bench right now.
I as away for most of today and although the offer might have been valid when I made it it was based on some basic assumptions and you fail to meet them... So after reading your last two posts you seem to have the theoretical side well under control and obviously you don't need the services an an aging senior engineer with 15 years experience in just what you are now doing so I will BUTT OUT Permanently From this thread... Sorry I intrudedDoc