circuit protection of series battery voltage measurement

Hi Everyone!

Project: attempts to very ACCURATELY measure the voltages of the series (and parallel) connected batteries.

NOTE: you may identify that their are some redundant connections to series batteries that are there so that the application can identify which are in fact connected in parallel and which in series and also it there are poor connections between the batteries.

You may also question the values and ratios of the voltage divider resistors.
These will likely change and are not my primary focus at this time.
A couple of comments on these.

1- because I may use 3.3v Arduino's I want to limit the voltage divider to 3.3v with some safety margin. Rather than use the Arduino's analog port I have tested and plan to use the ADS1115 16bit ADC but did not include it in the schematic in order to simplify things at least slightly. Of course, I'm open to ideas but have already tested with the Due analog read and the accuracy is almost but not quite as needed.

2- I would also appreciate input on if and how capacitors would allow higher resistance in the voltage divider circuit and still be able to accurately read considering that a voltage does not quickly change and an extra delay, an extra read or averaging is not a problem.

3- Since I am also concerned with the total current used in all these voltage dividers I'm wondering if there is a way to use transistors to turn on and off the dividers when they are going to be used or otherwise limit the current use when not needed and how to calculate the resistance of the transistor.

4- The main concern I have at this time is protecting the circuit or potentially redesigning a circuit that is more robust because it seems there are quite a few potential issues that can cause damage to the components. I've recently added the clamping diodes and an additional 100pf capacitor ( in addition to the .1uf) on the analog input line to help protect it but there still seems to be quite a bit of potential for disaster and I have had some. The worst seems to be damaged components that do not exhibit absolute failure but are degraded or intermittent resulting in bogus readings but not no-readings as I might expect or expected.

5- I'm considering and would like input on the following ideas and of course new ones please:

a fuses - Since I am primarily trying to protect against voltage, how can these help? How
to appropriately size and where to place them?

b is it possible to protect in case of ground disconnect? - when there is a disconnect or bad
ground connection the "divided" legs of the voltage dividers are no longer divided so can
surge - how can you protect against that?

6 Is there a better way to design the ground aspect of the connection? Is it possible
that there is current actually flowing "backwards" from some legs of the voltage dividers thru others because of the differences in voltages? would it be a good idea to add diodes here to protect against that? How can you calculate the resistance and impact on the voltage divider?

7 along this line, since some legs may have "designed" zero voltage - how to better protect against negative voltage? Hoping the clamping diodes will resolve this.

8 additional clamping diodes or similar on each voltage divider output to protect mux Is it best to use standard, schottky, or zener diodes and how? and how to select components? How can I confirm the current signal diodes are not "burned out"? When that happens how do you protect the other components?

9 how do clamping diodes not just redirect the spike or higher voltage to the positive rail and then fry the arduino thru the 3.3v (or 5v) connection and is there a way to protect against that?

10 optio-isolators - how badly would these effect accuracy of the voltage reading? what other negatives are there

11 what safety or circuit concerns would there be if this was part of a commercial product?

12 Is connecting the batteries causing surges? I think so. Should the mux and arduino be disconnected while the batteries are connected and disconnected and is there a way to do this electronically?

Of course, I would appreciate links or better ways to research these questions. I'm not looking for anyone to do the project but would certainly appreciate the ideas.

The attached project attempts to very ACCURATELY measure the voltages of the series (and parallel) connected batteries.

How accurately?

Note that the default is to use Vcc as your ADC reference, so if your power supply is off or unstable, that can affect your readings. If you can get stable readings, you can calibrate your "meter" with a known-good meter to improve accuracy.

[u]This page[/u] shows some protection diode schemes to protect against excessive voltage or reverse voltage. The series resistor limits current and with the Arduino, you can go higher (1K to 10K is fine).

With a resistor in series, there's no need for a fuse. You can fuse the batteries to the load if you wish, but there's no need to fuse the measurement circuit... i.e. Multimeters have a fuse for the current measurement, but not for voltage or resistance measurements. Multimeters (in the voltage or resistance mode) are high impedance, so you can't get excessive current and you only need to protect against excess voltage (which a fuse doesn't do).

You've got batteries in parallel which is normally considered bad practice.

What's that red circuit board?

...but did not include it in the schematic in order to simplify things at least slightly.

You didnt' show us a schematic at all... A schematic would b helpful.

You've only got 4 voltages. All of the 12V points are connected together, so that's one node to be measured. Then, the Three 6V junctions between the batteries. And, there's no need to measure ground.

I would also appreciate input on if and how capacitors would allow higher resistance in the voltage divider circuit and still be able to accurately read considering that a voltage does not quickly change and an extra delay, an extra read or averaging is not a problem.

....I've recently added the clamping diodes and an additional 100pf capacitor ( in addition to the .1uf) on the analog input line to help protect it but there still seems to be quite a bit of potential for disaster and I have had some.

Capacitors can reduce noise, but noise may not be a problem. Capacitors won't provide any protection. A 2nd smaller capacitor isn't going to do anything. Higher resistance in your voltage divider will make your circuit more sensitive to noise, especially if there is a long distance between the voltage divider and the Arduino or ADC input. The time to charge capacitors (especially these small-value capacitors) isn't significant and who cares, since your battery voltage isn't changing quickly anyway...

is it possible to protect in case of ground disconnect? - when there is a disconnect or bad ground connection the "divided" legs of the voltage dividers are no longer divided so can surge - how can you protect against that?

It will only surge if you loose the ground between the voltage divider and the ADC/Arduino, or if you loose the ground to the protection circuit.

I've always thought a setup like this, where relays are used to connect each battery independently to the Arduino ADC for a reading (like using a multimeter with a pair of probes) would be the best way. Care would have to be taken in the code to turn on only one relay at a time. Or a 1 of 8 decoder could be used or similar protection taken with hardware. The relays could also be analog switches to eliminate any chance of shorts from mechanical parts bouncing around; the series resistance of the analog switch would need to be accounted for in the voltage calculations (on the order of 70 to 100 ohms per switch)
Arduino power & Gnd would need to be separate from the vehicle power & Gnd otherwise the Arduino ADC IN becomes too high.
This way the full range of the ADC is available for each battery, vs a smaller & smaller range as the series battery voltage increases.

THANKS guys for the great information!

Will be working to digest your ideas...but will be back with followup questions I'm sure.

How accurate? Well as accurately as possible but needs to be better than 0.1V. The constant DC power supply was certainly necessary. I also used an external voltage reference with the UNO and that was much better. I've tried so many software averaging schemes etc. some helped. An averaging mode calculation helps but takes some time. More samples helps. Twisted pair wiring helped a lot. However, even with the Due's more precise 12 bit analog resolution it was tough to get consistent readings more precise than 0.04V. With the ADS1115 0.02V seems like a starting point and is probably good enough. I'm not sure if it is worth spending a lot of time on better ADCs or worth the time to get the Arduino readings to be more accurate. Plus the added advantage of the ADC differential readings. My main point was that I can't do anything in the circuit that would make the readings less accurate.

I'll work on the schematic. Thought most people here did the other fritzing diagram.

The red board is a 16CH Analog Digital MUX CD74HC4067. Sorry it didn't show up as clearly on the image posted.

You post is very detailed and well written but if I may make a suggestion:
When posting on the forum, it makes it much easier for readers to respond to your questions if you itemize your question topics (numbered 1,2,3 etc ) with a one or two word label for that question topic.
so readers can respond with:
RE # 4, suggest blah , blah, blah

The item numbers make it easier to refer to the questions and the question labels make easy for people to spot areas that correspond to their expertise . Few readers will know everything (some will) so if a reader sees something that is in his area of expertise he can zero in on that.
just a suggestion.

Project: attempts to very ACCURATELY measure the voltages of the series (and parallel) connected batteries.

NOTE: you may identify that their are some redundant connections to series batteries that are there so that the application can identify which are in fact connected in parallel and which in series and also it there are poor connections between the batteries.

You may also question the values and ratios of the voltage divider resistors.
These will likely change and are not my primary focus at this time.
A couple of comments on these.
1- because I may use 3.3v Arduino's I want to limit the voltage divider to 3.3v with some safety margin. Rather than use the Arduino's analog port I have tested and plan to use the ADS1115 16bit ADC but did not include it in the schematic in order to simplify things at least slightly. Of course, I'm open to ideas but have already tested with the Due analog read and the accuracy is almost but not quite as needed.

2- I would also appreciate input on if and how capacitors would allow higher resistance in the voltage divider circuit and still be able to accurately read considering that a voltage does not quickly change and an extra delay, an extra read or averaging is not a problem.

3- Since I am also concerned with the total current used in all these voltage dividers I'm wondering if there is a way to use transistors to turn on and off the dividers when they are going to be used or otherwise limit the current use when not needed and how to calculate the resistance of the transistor.

4- The main concern I have at this time is protecting the circuit or potentially redesigning a circuit that is more robust because it seems there are quite a few potential issues that can cause damage to the components. I've recently added the clamping diodes and an additional 100pf capacitor ( in addition to the .1uf) on the analog input line to help protect it but there still seems to be quite a bit of potential for disaster and I have had some. The worst seems to be damaged components that do not exhibit absolute failure but are degraded or intermittent resulting in bogus readings but not no-readings as I might expect or expected.

5- I'm considering and would like input on the following ideas and of course new ones please:

a fuses - Since I am primarily trying to protect against voltage, how can these help? How
to appropriately size and where to place them?

b is it possible to protect in case of ground disconnect? - when there is a disconnect or bad
ground connection the "divided" legs of the voltage dividers are no longer divided so can
surge - how can you protect against that?

6 Is there a better way to design the ground aspect of the connection? Is it possible
that there is current actually flowing "backwards" from some legs of the voltage dividers thru others because of the differences in voltages? would it be a good idea to add diodes here to protect against that? How can you calculate the resistance and impact on the voltage divider?

7 along this line, since some legs may have "designed" zero voltage - how to better protect against negative voltage? Hoping the clamping diodes will resolve this.

8 additional clamping diodes or similar on each voltage divider output to protect mux Is it best to use standard, schottky, or zener diodes and how? and how to select components? How can I confirm the current signal diodes are not "burned out"? When that happens how do you protect the other components?

9 how do clamping diodes not just redirect the spike or higher voltage to the positive rail and then fry the arduino thru the 3.3v (or 5v) connection and is there a way to protect against that?

10 optio-isolators - how badly would these effect accuracy of the voltage reading? what other negatives are there

11 what safety or circuit concerns would there be if this was part of a commercial product?

12 Is connecting the batteries causing surges? I think so. Should the mux and arduino be disconnected while the batteries are connected and disconnected and is there a way to do this electronically?

Of course, I would appreciate links or better ways to research these questions. I'm not looking for anyone to do the project but would certainly appreciate the ideas.

My only suggestion is learn Ohm's Law and basic electronics. (specifically how to draw a schematic since you can't REALY expect US to trace every wire connection in your Fritzing. We HATE Fritzings here on the forum because they are designed for one purpose only, which is to facilitate wiring a circuit. They are NOT designed to REPLACE a schematic. In 99 % of all cases, posters post Fritzings because they do NOT know how to draw a freaking schematic. PLEASE LEARN.
Your circuit would be much easier to follow with a schematic.

Do us a favor and post a block diagram that shows NOTHING OTHER THAN THE BATTERIES, drawn as a SCHEMATIC, using SCHEMATIC battery symbols.
Then and only then can we really be sure how you have them connected.
JUST THE BATTERIES ! nothing else !
No connections to the batteries other than the connections that show if they are series or parallel.

LABEL THE BATTERIIES "BAT-1, BAT-2 etc
If two batteries are connected in series label them SERIES BAT-1A, SERIES BAT-1B etc.
if four batteries are connected series parallel with two pairs of series batteries connected in parallel,
label them
Parallel Series -1A, 1B

Parallel Seriies -2A,2B
etc.

If you are monitoring battery voltages you don't need fast sampling and I really don't see the need for more than minimal use of capacitors. The ADS 1115 is a good choice. I have one myself.

Hello CROSSROADS!

I've always thought a setup like this, where relays are used to connect each battery independently to the Arduino ADC for a reading (like using a multimeter with a pair of probes) would be the best way. Care would have to be taken in the code to turn on only one relay at a time.

Yes I think there are a lot of advantages, but I'm concerned about the mechanical relays...reliability, size, etc. This is kind of like what I am/was attempting with the 16CH Analog Digital MUX CD74HC4067.

Or a 1 of 8 decoder

Do you have a particular part in mind? Can these handle 16 volts or more? Is this similar to a solid state relay?

analog switches

Are what you are referring to similar to the mux I am using to read the different voltage dividers?
I can re-check the data sheet but I don't think that the mux I am using will handle the higher voltage prior to the voltage divider...and I believe I have confirmed this accidentally as now two have been fried. Are there others that can handle higher voltages? That would really simplify things because then I could have only one or two voltage divider(s) and share them?

Arduino power & Gnd would need to be separate from the vehicle power & Gnd otherwise the Arduino ADC IN becomes too high.

I understand the power will be separate but how can you use the adc without sharing the ground? Even using the ADS1115 differential readings you have to have a common ground. Or at least I found that it is really doing individual voltages relative to ground and returning the difference so I needed to have voltage dividers on both positive and "negative" leads even if the difference was less than vcc. Was initially thinking that was like you referred to using a multimeter which would have worked out fine.

This way the full range of the ADC is available for each battery, vs a smaller & smaller range as the series battery voltage increases.

A complication with this application is that it is quite possible, although not very common, to have up to four batteries in series which certainly complicates things.

Thank you for the reply!

Opamps can be used to bring down the negative voltage of each battery in a stack to ground.
Read these posts.
https://forum.arduino.cc/index.php?topic=346070.0
Leo..

DVDDoug

FUSES - was wondering if an internal milli-amp fuse in combination with a zener diode
and/or clamping schottky diodes which would cause it to blow if the voltage increased would work. If V=IR then if the voltage increased with a constant resistance then the current would increase and therefore blow a fuse if I could get one small enough.

GREAT protection link! - I also really like Grumpy Mike's http://www.thebox.myzen.co.uk/Tutorial/Protection.html. More on that in a minute...

When you say you can go higher on the series resistor ... do you mean that I should add another resistor? IN ADDITION TO those already in the voltage divider?

AND ... how about the idea of a diode or some other method to protect the processor in case the
clamping diodes offload voltage to the top rail (and or to ground)?

You've got batteries in parallel which is normally considered bad practice.

This is our given. It isn't my design but what is being measured. It is common practice on golf carts, boats, rvs, offgrid solar, etc. where higher amp hour capacity is needed for a given voltage. To increase voltage you add batteries serially and to increase amp hour capacity you increase the number of batteries in parallel.

You've only got 4 voltages. All of the 12V points are connected together, so that's one node to be measured. Then, the Three 6V junctions between the batteries. And, there's no need to measure ground.

As I referenced at the beginning, this configuration could be different than shown and the software would determine how the batteries are connected (series or parallel). I'm not hardcoding this configuration in the application. The goal is to measure the individual battery (differential) voltages.

Oh yes! I added the schematic to the attachments!

RASCHEMMEL

Thank you for the suggestion of numbering questions. Guess you saw that I updated the post with that.

I hope you saw that I included a schematic AND a schematic of the batteries only. How is that? (as I duck)

Do you mean V=IR? I think I have that down ... now how to apply it may be a little more involved. Do you think that there is an area that I do not understand and need to study? Please let me know.

CAPACITORS - Now this is a complicated area where I have received a bit of advice that I perhaps do not understand totally.

You said:

If you are monitoring battery voltages you don't need fast sampling and I really don't see the need for more than minimal use of capacitors.

I certainly don't need particularly fast sampling.

Our esteemed Grumpy Mike opined regarding capacitors:

It is such a fundamental of electronics that decoupling capacitors are often missed out of schematics because every one knows you have to have one on EVERY chip.

Also esteemed MarkT added on Jan 27, 2013, 09:07 pm regarding another post:

No need for an op-amp at all for a low bandwidth signal like this - stiffen up the mid-point of the voltage divider with a capacitor - this
reduces the impedance of the divider as seen by the ADC as low as you like (but does low-pass filter the signal).

Lets say you use 1M ohm and 47k ohm (about divide-by-22). The midpoint is about 45k impedance without a capacitor, and
for the timescales involved in charging up the ADC's sample/hold capacitor (12us) even a few nF will bring this down to 10k or
less. So adding a standard 0.1uF decoupling cap will make the value perfectly fine for the ADC, and will act as a low
pass filter with a roll-off freq of 35Hz, no problem at all with even the most rapidly fluctuating cloud cover!

So I added the SCHEMATIC for the schottsky clamping diodes. I also included capacitors of 0.1uf and 47uf for noise per Grumpy Mikes decoupling writeup. The 100pf capacitor is from a number of clamping schematics and frankly I don't understand that one very well.

AND here is where I went off the reservation ... at least for discussion ... the thought process was ...
with the clamping schottsky diodes...in a surge the 3.3v line from the Arduino could get boosted ... so I added a power diode and resistors to limit current to 40 mA ...about 82.5 ohms... well I include 94. The other thing that I added was a zener diode between the 3.3v top rail and ground to also help if/when a signal line dumps voltage to the 3.3v.

I guess I understand a little about the noise decoupling but how MarkT said the capacitor would reduce the impedance pretty much went by me and I have not found anything online that explains this. Clearly it would be GREAT to increase the resistance in the voltage dividers (but to maintain the ratio) to reduce the "wasted" current. This really adds up when you have 14 dividers and 24 hours per day.

Thanks for taking a look!

So you think 1N5817 clamping diodes will work.

Grab the datasheet and look at the leakage current.
1mA@20volt at room temperature.
Even worse with higher temperatures.
That will upset your 22k:47k voltage divider big time.

Clamping diodes are only ok/needed in SOME cases.
In most cases they are NOT.

Dimension your voltage divider correctly and you won't need clamping diodes.
Leo..

RASCHEMMEL

Thank you for the suggestion of numbering questions. Guess you saw that I updated the post with that.

I hope you saw that I included a schematic AND a schematic of the batteries only. How is that? (as I duck)

Do you mean V=IR? I think I have that down ... now how to apply it may be a little more involved. Do you think that there is an area that I do not understand and need to study? Please let me know.

CAPACITORS - Now this is a complicated area that I have a bit of advice that I perhaps do not understand totally.

You said:
Quote
If you are monitoring battery voltages you don't need fast sampling and I really don't see the need for more than minimal use of capacitors.
I certainly don't need particularly fast sampling.

Our esteemed Grumpy Mike opined regarding capacitors:
Quote
It is such a fundamental of electronics that decoupling capacitors are often missed out of schematics because every one knows you have to have one on EVERY chip.
Also esteemed MarkT added on Jan 27, 2013, 09:07 pm regarding another post:

No need for an op-amp at all for a low bandwidth signal like this - stiffen up the mid-point of the voltage divider with a capacitor - this
reduces the impedance of the divider as seen by the ADC as low as you like (but does low-pass filter the signal).

Lets say you use 1M ohm and 47k ohm (about divide-by-22). The midpoint is about 45k impedance without a capacitor, and
for the timescales involved in charging up the ADC's sample/hold capacitor (12us) even a few nF will bring this down to 10k or
less. So adding a standard 0.1uF decoupling cap will make the value perfectly fine for the ADC, and will act as a low
pass filter with a roll-off freq of 35Hz, no problem at all with even the most rapidly fluctuating cloud cover!

I don't have any objection to using decoupling caps on chips. I don't particularly see a need for it on an analog input. Why ? If you were only taking one sample (reading) that might make sense, but common practice for any ADC is to take 10 to 20 samples and average them, making the decoupling cap unnecessary.

I don't think you completely understand my suggestion.The individual batteries would be measured one at a time, same as if you had gone done the string with a multimeter and measured each battery individually. 10 bit ADC will yield results down to 4.88mV per bit. Connect the relay outputs to a 12 bit ADC for ~1mV per bit. Higher voltages do not get connected.
The relays provide electrical separation, anything electrical does not.
Another option is to put individual ADC circuits at each battery, then read digital output via optoisolated connection back to a master.

Also, if you add a Flying Capacitor circuit to Crossroads suggestion the Arduino never has to be connected to a battery.

Wawa

Opamps can be used to bring down the negative voltage of each battery in a stack to ground.
Read these posts.
https://forum.arduino.cc/index.php?topic=346070.0

I've read this but not really sure how the opamps are used for voltage reading. Will have to study more.

WOW THANK YOU for catching that BIG ERROR! I REALLY appreciate that! Yes the schottky leakage current clearly passed right by me. Now I see how Schottky diodes are definitely a bad idea between analog signal and Vcc.

So my problem here is that I keep frying stuff on this project...muxs, ads1115s, fortunatly only one arduino so far. Then I research protection of signal lines and find these and other great articles:

http://www.thebox.myzen.co.uk/Tutorial/Protection.html

...and begin to think I'm understanding this stuff. The first one suggested signal diodes. The problem I see in this application is that there is a forward voltage of 1V and my ADS1115 wants signal -0.3toVddto+0.3. In the second they suggested the schottkys and the forward voltage starting at 0.2V was much better.

So you suggest to correctly dimension my voltage divider. I'm not arguing but just trying to understand how to do that or if there is another method of adding some protection. I think I am well within 80% of positive voltage limits when ground stays connected to the voltage divider. I would like to protect against this disconnect if possible since it's happened a few times. I know this has got to
sound like I'm just being sloppy and maybe that is possible but predominately it has been when the Arduino power is disconnected AND I disconnect or reconnect the connections to the batteries. That's how I came up with the dual ground ...thru the Arduino and to the batteries. Maybe I should be disconnecting the batteries only when the arduino is connected and of course ground is connected but that seems wrong and in "production" it is certainly possible that the ground could be disconnected in the wrong order. That's why I was hoping for a method of using a fuse but as has been pointed out a fuse won't blow from voltage.

Here is a possible scenario where some type of switching would be helpful that I could turn on the input to the voltage divider only when the ground is already connected. I thought maybe a transistor but was having difficulty determining how that would impact the voltage measurement. Maybe there is another type of electronic switch that would work.

I have also measured some small negative voltage at times. Sometimes I see a -0.1V and since the limit is -0.3 perhaps it has reached that and is frying my stuff. This has lead me to wonder if I have a small current/voltage going back up some of the other legs of the voltage dividers when I was only expecting it to go down to ground and what if anything I can do about that. What do you think of the zener idea? Say a 1N5226B to ground? It looks like that would protect from going over 3.6V and then maybe a schottky from ground to quickly protect from a negative voltage? Since the schottky would be forward from ground to signal a current leakeage to ground wouldn't be a problem would it? I thought that since the forward voltage of the zener was 1.2V it wouldn't really help with the negative voltage possibility.

Another thought is...what if I used a zener in combination with a modified voltage divider to chop say 10V off the expected 10-16V? or 5v off the expected 5-8V or would this make the voltage measurement less accurate?

I dont quite understand why you want to use a 16-bit A/D for (lead/acid?) battery measurements.
Battery voltage is not a very good reflection of charge, unless you don't charge or discharge the battery for a day.
I think Arduino's 10-bit A/D (two decimal places) is more than enough for that.

http://www.thebox.myzen.co.uk/Tutorial/Protection.html

These links are not relevant if you use a voltage divider. Note the 22ohm and 100ohm series resistor.

A voltage divider uses higher value resistors, so fault current can't get high enough to damage the internal clamping diodes.
A voltage divider should keep output voltage in range of the A/D.
And current <1mA in case of over-voltage (if the A/D happens to be off, anything is over-voltage).
The ADS1115 can even take 10mA continuous fault current (see datasheet max ratings).

If you use Arduino's A/D, you should use the internal 1.1volt Aref for stability.
A voltage divider dimensioned for that has a 5x higher overvoltage protection as a bonus.

Forget about external diodes and zeners. They simply don't work.
Leo..