# Getting the magnitude of the voltage of a battery

Discussion in 'The Projects Forum' started by Skynt, Nov 22, 2011.

1. ### Skynt Thread Starter New Member

Nov 27, 2010
3
0
I want to create a circuit using some op-amps (LM324CN is what I have), resistors and capacitors that takes the absolute value of some DC power source and can output to some analog comparator. However, after looking up some schematics online, I haven't been able to design one that works with my parts. Could anyone offer some design help / advice? I'm an engineering student with a limited knowledge of electronics.

2. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
Hello Skynt,

Well, you are going to need a fixed voltage reference, and you will also need a voltage divider to get the battery voltage into the common mode range of the opamps' inputs.

For a fixed voltage reference, you can consider using a Zener diode in series with a resistor. The anode goes towards the more negative voltage. You want at least a couple of mA current through the Zener, but not more than 20mA. Size your current limiting resistor appropriately.

Then you need the voltage divider from the battery positive terminal to ground. The LM324s' range includes the negative rail (in this case, ground) and the upper limit is about +V/Vcc - 1.5v. You want to size the resistor values so that you will have between approximately 100uA/0.1mA and 2mA current flow through the divider; much lower than 100uA, and noise starts to become a factor; much above 2mA and you are using an excessive amount of power.

But you have not said what the voltage of the battery is, or how you are going to power the LM324, or what you are planning on doing with the output.

3. ### Skynt Thread Starter New Member

Nov 27, 2010
3
0
The range of the battery size would be at maximum 20V. Right now I'm trying to feed this circuit into a differential comparator (LM339).

4. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
OK then, so lets' say you use a 5.1v Zener diode with a resistor to supply current for a voltage reference.

Are you familiar with Ohm's Law?

Calculate how many Ohms of resistance you will need to have in series with a 5.1v Zener across your 20v maximum supply, in order to have 5mA current.

Then you need to decide at what voltage you want the comparator to change states, indicating that the battery voltage is above or below the threshold.

Something about common comparator families; the LM339, LM393, LM111, LM2903 all have open-collector outputs; this means that they can sink current, but cannot source current. You need to have a resistor between the output and a more positive voltage in order to show a change in voltage on the output of the comparator.

The LM339, LM393 and LM2903 only have a 6mA guaranteed sink current; the LM111 is much higher at up to 50mA.

In order to ensure that the output of an LM339 can go low enough to signal a logic low level without a doubt, you should stay below 5mA. So:
Calculate what is the minimum value of resistance you need to limit current from a 20v source to 5mA?