Don't forget to "reconstitute" the actual voltage value, from the value read from the ADC, by whatever the resistor voltage divider ratio is. I recently had a circuit that used a 1M from the battery (a 15V LiSO2 battery) and a 100K to ground. This created a "divide by 11" divider to get the voltage down into the range that the 10-bit ADC could handle. To display the actual voltage, I multiplied by 11 (and also added in a fudge factor equal to the tolerance of the resistors). Douglas Wood Software Engineer dbwood@kc.rr.com Home of the EPICIS Development System for the PIC and SX http://epicis.piclist.com ----- Original Message ----- From: "Douglas Butler" To: Sent: Wednesday, March 27, 2002 3:44 PM Subject: Re: measuring battery supply via A/D > Use a 2 resistor divider, no op amp needed. Try a 22K from the battery > to the A/D, and a 47K from the A/D to GND. > > Sherpa Doug > > > -----Original Message----- > > From: Kosmerchock, Steve [mailto:Steve.Kosmerchock@RFSWORLD.COM] > > Sent: Wednesday, March 27, 2002 3:20 PM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: Re: measuring battery supply via A/D > > > > > > Glen, > > > > Two diodes would give you a drop of 1.4VDC. > > So REF V would be 5.8V, still too high. You could use > > an op-amp and resistor network. > > > > Steve > > > > > > > > -----Original Message----- > > From: Glen Wiley [mailto:gwiley@GWILEY.COM] > > Sent: Wednesday, March 27, 2002 1:12 PM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: measuring battery supply via A/D > > > > > > From a software guy to the EE's of the world... > > > > I would like to measure the voltage level of my battery > > power supply (6 NiMH AAA cells) which should start at around > > 7.2V. Using the A/D (AN0) pin on a PIC16F872, what is the > > best way to do this. My first guess was to insert 2 diodes > > in series to take the max input voltage down to 4.8V. > > > > The goal here is to log the battery supply voltage (along > > with some other info which is stored in serial EEPROM) for > > later analysis. This does not have be absolutely accurate, > > only relatively accurate - this portion of the data will be > > used to generate data for trending battery life under normal > > operating conditions for the device. > > > > thanks in advance for your time > > -- > > Glen Wiley > > > > Everything should be made as simple as > > possible, but not simpler. -- Albert Einstein > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > -- > > http://www.piclist.com hint: To leave the PICList > > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > > > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu