> From: Kyrre Aalerud[SMTP:kreature@C2I.NET] > Sent: Wednesday, November 19, 2003 3:38 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [EE:] Sampling battery voltage with PIC ADC. > Hi ppl! I've been quiet for some time now on the list as I've had far too > much to do. > Now I'm back on the horse with a little question. > I am making a battery-charger/cycler and want to make the actual circuit as > simple as possible so that fellow hobbyists can make it without too much > hassle. > For battery-voltage I was thinking of using a simple voltage divider to get > signal within 0-5v for ADC. > From my understanding I would need to "see" a voltage drop over time of > something like 10 mV for NiCD in order to correctly terminate the > fast-charge. For NiMH I should stop the charge when the voltage no longer > climbs within some set timeframe. So, I would need a resolution of about 10 > mV or better pr cell. If I simply use the 10 bit ADC directly after scaling > voltage down to 0-5v I have would give 10.23 volts as the max cell-voltage. > This would not be enough. I need charger to work with 8 cells, but it would > be cool to get it working with 1-12 cells. A max cell-voltage of 2v should > be used I think as peak-voltage increases with charge-current. > Any ideas as to how I can adjust the scaling of battery-voltage based on > number of cells charging ? > I though of using a I2C capable digital potmeter, but they all seem to max > out at 0-5v. I would need one where I could place the pL and pH points of > potmeter between the battery + and - poles on a 12 cell battery, preferably > even higher. (18 volts or more!) Put resistor Rbig from the positive terminal of the battery to the ADC input. Put a digital pot from the ADC input to ground. Setting the pot to zero will give zero ADC input; setting it to max will give Vbat * Rpot/(Rpot + Rbig). The scale factor will not be linear in Rpot, but it can be calculated from Rpot and Rbig. Choose Rbig to limit the pot current to allowed maximum under all possible conditions. For protection of the ADC and the pot, put a diode from ADC input to +5 (cathode to +5). Since the very low end of the pot range will be useless, you can put a fixed resistor in series with the pot to compress the useful range. Just change the formula for calculating the scale. John Power -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics