Ground problem when monitoring 2 batteries in series. - Page 1
Forum section: electronics / beginners

author: YoTech
author_rank: Contributor
timestamp: March 26, 2018, 11:28:50 am
content: Hello evryone! I am making a battery monitor circuit. When I monitor 1 battery its ok, but if I want to make the PCB for 2 batteries, i meet a problem. I have 2 batteries in series (12V per battery). I monitor each battery separately with this circuit bellow. If I put 2 separate PCBs for each battery and the bottom copper layer of each PCB is filled so it can act as groun, everything is ok. But If I put the 2 (exactly the same circuits) on 1 PCB, they will have a common ground. What bothers me is this: if there is a connection between the upper battery's "-" and ground ,and the lower battery's "-" wont that cause a problem? Wont the voltage for the upper battery rise to 24V, or this to short circuit the 2 battries in series.

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2018, 01:05:01 pm
content: Yes, connecting the - of the top battery to the - of the bottom, will short out the bottom battery.The easiest way is to monitor the voltage of the top battery using a differential amplifier, with a gain of 1.

author: SebG
author_rank: Regular Contributor
timestamp: March 27, 2018, 05:24:06 am
content: If i understand correctly then you are indicating the voltage using LEDs so you can put them on a single board but you would need to keep two separate grounds, that is each circuit would be disconnected from the other. Use GND1 and GND2

author: YoTech
author_rank: Contributor
timestamp: March 27, 2018, 12:23:48 pm
content: I dont know how to use 2 grounds.Also I want to add an MCU to record which LED is on, any circuit would be appreciated. I was thinking of something like the circuit in this post.Edit:Sorry for the zener explanation, here is the fixed circuit.

author: Zero999
author_rank: Super Contributor
timestamp: March 27, 2018, 01:07:36 pm
content: Quote from: YoTech on March 27, 2018, 12:23:48 pmBuilt two circuits: one with its power connected to the top battery and the other with its power connected to the bottom battery. Make no other connections between the two circuits.QuoteNot good.Build two circuits, as mentioned above and use opto-couplers to interface with the MCU. Connect each opto-coupler's emitter in series with each LED. Connect each MCU input to 0V, via a pull-down resistor, say 10k and to +VCC, via the opto-coupler's photo transistor.

author: ManCave
author_rank: Regular Contributor
timestamp: March 27, 2018, 01:23:44 pm
content: If you are using an MCU, this seems a bit backwards design to me.What you are trying to do (if I understand it correctly) is to use analogue solution to measure and display the battery levels via LEDs, and then connect the LEDs to the microcontroller to read the battery voltage level displayed by the LEDs.Since you are going to use a microcontroller, why not design this properly? Use resistor voltage divider from each battery (as your current circuit uses) to bring the voltage down to the microcontrollers range (say, divide by 6, this will give you 4 volts per 24V). Measure positive of each battery using two equal dividers and an ADC in the microcontroller, then in the microcontroller subtract the voltage of the bottom cell from the voltage of the top cell and you get both voltage levels. You can then set the indication using GPIO to LEDs or any other means you like.

author: YoTech
author_rank: Contributor
timestamp: March 27, 2018, 02:20:33 pm
content: Thats not good. The MCU needs to stop the battery for 30sec, a minute in order for the battery voltage to settle and thats not possible. I also have 10 digital I/O and 1 analog pin, which makes it hard.

author: ManCave
author_rank: Regular Contributor
timestamp: March 27, 2018, 02:50:52 pm
content: Quote from: YoTech on March 27, 2018, 02:20:33 pmJust use a supercap to keep the MCU alive while the battery is resting. Might be worth changing the microcontroller for one with two ADCs or get an analog multiplexer before the ADC as your design still seems way too overcomplicated for what it needs to do.

author: MrAl
author_rank: Super Contributor
timestamp: March 27, 2018, 03:04:01 pm
content: Quote from: YoTech on March 26, 2018, 11:28:50 amHi,Yes, the problem is that the lower battery gets shorted out.The simplest way to handle this is to measure the bottom battery in the usual way, then to treat the top battery terminal (not the battery itself) as another battery. With two 12v batteries this means you would see two batteries, one 12v and the other 24v. However, this is enough information to get the voltage of each individual battery.The formula is simple:vB1=vB1vB2=vTop-vB1so you simply subtract the lower battery voltage from the top terminal voltage and that gives you the second battery voltage, and that will be the true voltage as if measured with a volt meter.The way to get the voltages is to scale the input to the ADC so that the two channels have either the same scale or different scales.For example, for a 5v ADC to read 12v you can scale to say 15v, which means for example a 10k resistor in series with a 5k resistor so when the voltage is 15v the ADC sees only 5v.Same for the top, but now you need to scale to 30v, so 25k in series with 5k and now when the top is 30v the ADC sees 5v only.Then just subtract readings as above to get vB2.There is some loss of accuracy due to the scaling, but that's the way it goes unless you want to go to a much more complex system. The loss of accuracy is not usually too much anyway. If you start with a 12 bit ADC a ratio of 2 to 1 brings it down to an equivalent 11 bits, and a scale of 4 to 1 brings it down to 10 bits, which is good enough for almost everything. Since you will have one channel at 5 to 1, it will be a little less than 10 bits but better than 9 bits. So that's still pretty good. If you can use oversampling of course you get better than that too.Note that you way want to scale to 20v and 40v instead of 15v and 30v so you have a little head room.This is the simplest possible method which still provides decent accuracy.

author: YoTech
author_rank: Contributor
timestamp: March 27, 2018, 05:54:35 pm
content: Quote from: MrAl on March 27, 2018, 03:04:01 pmQuote from: ManCave on March 27, 2018, 02:50:52 pmYes, I know this (except the scalling accuracy), but if I have 1 battery highly discharged at 10.5V and the other battery at 14.4V, the total will be 24.9V, which will still show as very charged for the bank. Thats why I cant use it. Its better to scale at 1/10, like 1k and 9k,

author: MrAl
author_rank: Super Contributor
timestamp: March 28, 2018, 12:58:58 pm
content: Hi again,Yeah the only way it to do the math and look at both batteries not just the top value. That's the only way to know if they are both charged or not. You then compare to the known nominal values. You can never JUST measure the top value and make any decision.I had to do this too with four batteries. I divided them into 2 and 2, and then used the idea shown previously where we measure both batteries in series. I had to know the voltage of all four batteries.

author: YoTech
author_rank: Contributor
timestamp: March 28, 2018, 06:03:06 pm
content: Ok. The problem that I meet is that I have to measire the battery voltage while the battery is charging also or at least when its plugged and when the charger stops (about 6h). It will be charged from an ABC-1220D FST charger, rated for 20 ampers. The load will consume 24V, 25A. And the shit of having to charge separately and discharge toghether while measuring. That is the reason behind the analog components which are then checked by the MCU. Because I dont see another way to measure the battery while its charging.If anyone can give me a good MCU circuit to measure the 2 batteries in series, thank you very much, you are very well appreciated!

author: MrAl
author_rank: Super Contributor
timestamp: March 28, 2018, 06:18:01 pm
content: Hi,Measure the voltages? You were given an idea using resistor dividers.If you change the topology then you just use more resistors and read the voltages associated with the new topology.If you are saying that you have separate grounds, then you need to go to the opto coupler idea.If the grounds really are isolated that is and have to stay that way.Another idea is ot use analog opto couplers.Another, use one uC for each channel, then send the RS232 data to the master with cheap opto couplers.