# Voltage Sensing

TxAggie00
Hello all!

I do not pretend to have any knowledge of electrical engineering, just enough to get myself in trouble and blow up some transistors. That being said, I have a question for the experts.

My recent hobby project requires my computer software (my area of expertise) to interface with a microcontroller. What I am trying to do is plot the voltage change in batteries as they are being charged and discharged. Sitting there with my fluke for 6 hours doesn't intrigue me, so I am trying to "automate" the process. The charger has an output rating of up to 24V and 1.5 amps. I am using a Parallax bs2px for the microcontroller and an ADC0834 4-channel ADC for voltage sensing. How can I monitor the batteries with that ADC and not put too much current through it? Do I need to isolate that part of the circuit? If so, how? I have read through the datasheet for the http://www.national.com/mpf/DC/ADC0804.html#Overview" [Broken], but it might as well be written in latin. I do know that I am going to need a 5:1 voltage divider, because my Vref is 5V.

Any help is appreciated! Thanks,
Scott

Last edited by a moderator:

## Answers and Replies

That link was for a different ADC. However, I have used the ADC0834 and wouldn't recommend it.
It is a serial device, so you have to read off each of the 8 bits by sending pulses to it. Yukk!

If your battery charger does 24 volt batteries, you need the ADC to cover up to 30 volts to allow for fully charged batteries being about 29 volts.

To do this, get two 100 K resistors and put them in parallel. Wire this combination from the charger to a 10 K resistor to ground.
Then take the voltage at the junction of the two 100 K resistors and the 10 K resistor to your ADC converter.

[PLAIN]http://dl.dropbox.com/u/4222062/voltage%20divider.PNG [Broken]

So, suppose you had 30 volts at the input of this voltage divider.
Then the output would be 10/60 times 30 V or 5 volts.
Lower input voltages will give less than 5 volts.

You might like to take this question to the Programming and Computer Sci part of this Forum:
https://www.physicsforums.com/forumdisplay.php?f=165
to see if someone can suggest a better way of doing the A to D conversion.

I use Picaxe chips for everything, but I haven't had much luck getting converts to that system.

Last edited by a moderator:
TxAggie00
Thanks for the reply!

From what I have seen and experimented with using the ADC0834, I would have to agree with you. I will probably move to at least a 12 bit ADC. I have all the programming done and am successful taking measurements using the 5V on the board and a 10K pot to adjust the voltage going into the ADC, but what I am unsure of, is how the ADC being in parallel with the charger and battery will affect the charging of the battery if at all. I want to have as little of an impact as possible. Also, the batteries are 18V, so I probably wont see voltages over 24.

Thanks for the circuit diagram. I will breadboard that out and see how it works.

Thanks,
Scott

The circuit I suggested would draw only 0.5 mA from the battery charger, so it is not a problem. (ie 30 Volts / 60000 ohms = 0.5 mA). You can get 1% precision resistors for a few cents more, so get those if you can.

One thing worth considering is the open circuit voltage of the battery charger. If this goes to 40 volts when the battery is disconnected, you need to allow for this and make sure your ADC is protected.

I'd suggest at least a 10 bit A to D. This is because you need to read the voltage in a small area of the total range (maybe 14 volts to 18 volts) and you need good precision to do this.

If the range was 0 to 30 volts then each bit change would represent 0.029 volts on a 10 bit A to D while it would represent 0.117 volts on an 8 bit A to D. This is a worthwhile improvement.
It will give much smoother curves if you are graphing the results.

TxAggie00
Perfect! Thanks so much for your assistance!

Thanks,
Scott

The circuit I suggested would draw only 0.5 mA from the battery charger, so it is not a problem. (ie 30 Volts / 60000 ohms = 0.5 mA). You can get 1% precision resistors for a few cents more, so get those if you can.

One thing worth considering is the open circuit voltage of the battery charger. If this goes to 40 volts when the battery is disconnected, you need to allow for this and make sure your ADC is protected.

I'd suggest at least a 10 bit A to D. This is because you need to read the voltage in a small area of the total range (maybe 14 volts to 18 volts) and you need good precision to do this.

If the range was 0 to 30 volts then each bit change would represent 0.029 volts on a 10 bit A to D while it would represent 0.117 volts on an 8 bit A to D. This is a worthwhile improvement.
It will give much smoother curves if you are graphing the results.