# How can I read the battery voltage in this situation

#### ariondoneda

Joined Apr 8, 2022
8
Hi,

Im having trouble figuring it out how to "read" the battery voltage in a particular situation in the circuit shown below.

The problem is, when a disconnect the battery the 27V in DC_In appears in V_Bat and I have a false positive, like, my system thinks that there is a battery plugged in, with 27V, but its not true, iss just the DC_In appearing in V_Bat.

How can I isolate the battery voltage and the DC_In voltage? I need to recharge and discharge the battery, so that is why there is this 3 diodes.

Thanks!

#### Alec_t

Joined Sep 17, 2013
14,009
How can I isolate the battery voltage and the DC_In voltage?
Can you use a battery connector with a built-in switch?

#### BobaMosfet

Joined Jul 1, 2009
2,102
Hi,

Im having trouble figuring it out how to "read" the battery voltage in a particular situation in the circuit shown below.

View attachment 268586

The problem is, when a disconnect the battery the 27V in DC_In appears in V_Bat and I have a false positive, like, my system thinks that there is a battery plugged in, with 27V, but its not true, iss just the DC_In appearing in V_Bat.

How can I isolate the battery voltage and the DC_In voltage? I need to recharge and discharge the battery, so that is why there is this 3 diodes.

Thanks!
Young Jedi.... electricity follows the laws of fluid dynamics (to some extent conceptually). A greater electricity overcomes and pushes a weaker electricity in the opposite direction. Thus, you require 1 and only 1 diode to prevent the 27V from pushing back against the 24V. The 24V can never overcome the 27V so it does not require a diode to prevent it from pushing against the 27V.

In this way, if the 27V is removed the 24V instantaneously supplies voltage and current to the regulator. Your 24V is isolated from the 27V, so you use an optocoupler, like an 4N35 to test your battery voltage.

#### MisterBill2

Joined Jan 23, 2018
16,582
We have much less than enough information to provide a solution, and so every suggestion is a guess. And my guess is that you do not have access to the battery directly, and at the same time you are unable to switch off the 27 volt source.
The very simple procedure will be to connect the voltmeter between the point tagged "V_Bat" and the battery negative marked as ground. Then switch off, or disconnect the 27 volt source. With the circuit as shown and the "DC_IN "at 27 volts there is no place to check the battery voltage.

#### ariondoneda

Joined Apr 8, 2022
8
Can you use a battery connector with a built-in switch?
How they work? If it solves the problem I could use it.
If you have a part number, or something like that, for me to understand.

#### Ian0

Joined Aug 7, 2020
8,947
If you remove D18, then you remove the current limit from the battery charger. When the battery is depleted the and the 27V supply is connected the 27V power supply will be overloaded.
I presume that the battery in question is lead acid. If so, you can detect its absence by detecting the lack of current through R32

#### ariondoneda

Joined Apr 8, 2022
8
Young Jedi.... electricity follows the laws of fluid dynamics (to some extent conceptually). A greater electricity overcomes and pushes a weaker electricity in the opposite direction. Thus, you require 1 and only 1 diode to prevent the 27V from pushing back against the 24V. The 24V can never overcome the 27V so it does not require a diode to prevent it from pushing against the 27V.

In this way, if the 27V is removed the 24V instantaneously supplies voltage and current to the regulator. Your 24V is isolated from the 27V, so you use an optocoupler, like an 4N35 to test your battery voltage.
Well, the battery is "24V" but it's charged to DC_In voltage level, so it's actually 27V when it's fully charged. So D17 is there to charge, D18 to discharge and D16 to prevent the battery from supplying power to the things before DC_In, when it does not exist anymore, 0V.

#### ariondoneda

Joined Apr 8, 2022
8
We have much less than enough information to provide a solution, and so every suggestion is a guess. And my guess is that you do not have access to the battery directly, and at the same time you are unable to switch off the 27 volt source.
The very simple procedure will be to connect the voltmeter between the point tagged "V_Bat" and the battery negative marked as ground. Then switch off, or disconnect the 27 volt source. With the circuit as shown and the "DC_IN "at 27 volts there is no place to check the battery voltage.
The 27V comes from a Fly-Back SMPS, with AC power input. When there is no AC DC_In=0V, in that moment the battery needs to handle the load. The battery is Lead-Acid. When fully charged it will be ~27V.
I have access to the battery, but I need to check it's voltage remotely, so I need to "read" it's voltage electronically, and with or without DC_In, 0V or 27V. I can not measure it with a voltmeter.
I don't need to know the exact voltage, just know if it's below 21V and if it's connected.

I hope that this is enough.

#### ariondoneda

Joined Apr 8, 2022
8
If you remove D18, then you remove the current limit from the battery charger. When the battery is depleted the and the 27V supply is connected the 27V power supply will be overloaded.
I presume that the battery in question is lead acid. If so, you can detect its absence by detecting the lack of current through R32
I thing that the problem is that when the battery is fully charged there will not be any current passing trough R32. So I will get a reading saying that there is no battery, when there is.

#### Ian0

Joined Aug 7, 2020
8,947
I thing that the problem is that when the battery is fully charged there will not be any current passing trough R32. So I will get a reading saying that there is no battery, when there is.
Not with a lead-acid battery - there will always be a float-charge current.

#### ariondoneda

Joined Apr 8, 2022
8
Not with a lead-acid battery - there will always be a float-charge current.
I didn't know that. How much current it will consume when fully charged?

#### Ian0

Joined Aug 7, 2020
8,947
I didn't know that. How much current it will consume when fully charged?
Depends on a lot of things, like the size of the battery and its age. Probably a few tens of milliamps when new increasing as it gets older.
a little circuit like this will give you a yes/no indication if there is any charge current

#### crutschow

Joined Mar 14, 2008
33,358
Below is the LTspice simulation of Ian0's circuit using some typical part models (with a reduction in the value of R2 to increase the circuit sensitivity slightly:
It gives a charging output indication (red trace) for any charging current (yellow trace) above about 10mA, which should be sufficient to indicate a battery is connected.

#### Alec_t

Joined Sep 17, 2013
14,009
How they work? If it solves the problem I could use it.
If you have a part number, or something like that, for me to understand.
Providing the current rating is adequate a switched jack such as this could be used (perhaps via a transistor) to connect/disconnect the 27V when the plug is inserted.

#### ariondoneda

Joined Apr 8, 2022
8
Below is the LTspice simulation of Ian0's circuit using some typical part models (with a reduction in the value of R2 to increase the circuit sensitivity slightly:
It gives a charging output indication (red trace) for any charging current (yellow trace) above about 10mA, which should be sufficient to indicate a battery is connected.

View attachment 268601
Great, but I need to check if the battery is plugged or not, basically. So with this I get a "Not Charging" status even if the battery is connected.

#### ariondoneda

Joined Apr 8, 2022
8
Providing the current rating is adequate a switched jack such as this could be used (perhaps via a transistor) to connect/disconnect the 27V when the plug is inserted.
Interesting. I fear that even if I use this I would have a problem, because If the connector is plugged but without a battery we would have a false positive.

#### Ian0

Joined Aug 7, 2020
8,947
Great, but I need to check if the battery is plugged or not, basically. So with this I get a "Not Charging" status even if the battery is connected.
It will always be charging if it is connected, unless it has gone faulty.

#### MisterBill2

Joined Jan 23, 2018
16,582
OK, understanding the detailed requirements better now.
If more analog inputs are available then there is a scheme to verify the state of the battery and it's presence. That is to read the voltage on each side of the resistor R2, (51 ohms). If the resolution of the reading is adequate you can deduce if the battery is charging or not, and if the supply voltage is also monitored then it is fairly simple to verify that the battery is connected .
A lead/acid battery in a float charge arrangement has a small charging current, and so it is simple to verify that the voltage drop across the resistor reflects that current. That can be found by subtracting the two voltage readings. It will make the math more convenient if R2 is increased to 100 ohms.
Comparing the supply voltage with the between the diode and R2 will indicate if the battery is connected or not, because if not connected then the voltages should be the same, or very close.
So there is the scheme for knowing the status of the battery, needing only one more analog input and some added software.

#### BobaMosfet

Joined Jul 1, 2009
2,102
The 27V comes from a Fly-Back SMPS, with AC power input. When there is no AC DC_In=0V, in that moment the battery needs to handle the load. The battery is Lead-Acid. When fully charged it will be ~27V.
I have access to the battery, but I need to check it's voltage remotely, so I need to "read" it's voltage electronically, and with or without DC_In, 0V or 27V. I can not measure it with a voltmeter.
I don't need to know the exact voltage, just know if it's below 21V and if it's connected.

I hope that this is enough.
Something to be aware of- it's a lead-acid battery. You cannot correctly test its voltage without putting a load on it. Even a 'dead' battery can say it's at proper voltage when you're only drawing mA in current to test it. It only collapses under load- and therefore, that is the condition you need to test with to get a valid reading.

#### MisterBill2

Joined Jan 23, 2018
16,582
Not checking to see the exact voltage, but testing to see that the battery is connecting and functional. The fact is that if it is at the float voltage and also drawing the small amount of float-charge current, then probably it is ready to do a backup supply powering session. If the voltage across the resistor is greater than that small float charge would be, the battery may be a bit discharged. If the voltageacross the resistor is zero, then the battery might be disconnected. The reading accuracy does not need to be perfect, but it does need to be repeatable and have adequate resolution.