Hi Dan, I have a battery voltage sensor using one PIC pin that doesn't need the ADC feature, so it can be used on any cheaper PIC that only has digital inputs. It does require that the PIC is run from a regulator and the battery voltage changes but the PIC Vdd does not. It uses about 30uA so is useful for some circuits. It uses two resistors and one small ceramic cap. -Roman Dan Michaels wrote: > > Brian Gregory wrote: > >Simon Nield wrote: > >> if the pic you are using has an adc you could use that. > > > >I would need some kind of voltage reference or some resistors to divide the > >battery voltage if I used the supply (from an LDO regulator I guess) as the > >reference. That's run the battery down. > > > > Yes, it would seem that just about anything you connect to the > battery itself is likely to pull it down - except possibly a zener > with high enough voltage and hopefully low leakage [??????] > > Here is a variation on some of the other - diode+resistor schemes. > Assuming you aren't running straight off the battery - but are using > an LDO to power the bus - eg, LM2936-5.0 [15 uA]: > > battery---+-----LM2936--+----> +5v > | | | > | gnd | > zener | > | +-----+---+ > | | Vdd | > +--10K--|RB7 | > | | | > +-------|RA0 | > Vsense | | > +---------+ > > Assume battery = 9v, then use 5.1v zener. RB7 = 1 while in sleep > mode. Wake up --> pull RB7 = 0 --> measure voltage on RA0 --> > Vsense = Vbattery-5.1v --> accurate reading, since the A/D Vref=5v > from the LM2936. > > At full charge, Vsense ~ 9-5.1v = 3.9v. At low-charge, when > Vsense ~ 0.1v, then Vbatt has dropped to 5.2v, and the LDO is about > to fall out. > > If the zener has too much leakage, then assign RB7 as input > during sleep, instead of holding it as output = high. > > Who knows, this thing might even work, > - Dan Michaels > Oricom Technologies > http://www.oricomtech.com > ========================= > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.