## OT: Measuring volts and amps of batteries in series

33 posts / 0 new
Author
Message

Hrm, not sure how to approach this. I want to measure the voltage on each of four 6V batteries that are in series for 24V. These are part of a UPS backup system, and I want to be able to track each battery in the bank. I also want to track the current going through them, which can range up to 200A DC.

My initial thought was to use a pair of muxes to connect the -ve and +ve terminals to AGND and a microcontroller A/D input, but I'm fairly sure that won't work ... AGND is internally connected to GND, and suddenly having 12V or 18V whacked on it couldn't do it any good.

I'm guessing at differential opamps, one for each battery, with a voltage divider in front to drop the voltage down to the AGND-AREF range of the A/D (2.5V). They would have to be able to handle high common-mode voltages, something like an AD8206, which can handle 42V ...

That one happens to have a fixed gain of 20, so the divider would have to drop 7V down to 125mV. (R1 = 10k, R2 = 180R) I'm sure there are other opamps out there, this just happens to be one I saw in an Analog bulletin.

I also want to measure total current through the bank. I have a 300A shunt that puts out 50mV at full rating (system does 200A normally). Again, if this is in the +ve line, the conditioning opamp would have to be able to discern some 35mV riding on top of 24V. Question: Can/Should the shunt be put into the GND/0V/-ve line ?

The AD626 looks good for this. The gain can be set anywhere up to 100 - I would a gain of 83 to amp 30mV up to 2.5V.

It can handle a CMR of 24V when operating from a 5V supply. For headroom I guess it should run from a 12V supply.

Is this the right direction to be looking in ? Is there an easier way to do this ? That is, measure large (200A) DC currents using a 50mV shunt, and measure 4 different battery voltages that are in series.

Thanks for any tips :)

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Sounds like the right approach to me.

I did a similar thing for a fuel cell stack and used an array of AD629s (48 count 'em, 48 8) ). It was a gain=1 differential amplifier that could take +/-270 volts of common mode offset. It sounds like you may want unity gain or less depending on your ADC but it's easy to mux the outputs of the different amps to a common gain stage to set whatever gain you want and have it be the same for all batteries if that is important to you.

Regarding the shunt, I would set it up with one leg at ground. It's generally a differential measurement but any common modes you can get rid of are good things especially when dealing with comparatively low signal magnitudes. And with one leg at ground, it then doesn't have to be a differential measurement.

Please note - this post may not present all information available on a subject.

How accurate do you need to be with the voltage measurements? Can't you just measure between Gnd and battery 1, Gnd and battery 2 etc. (via a mux if you like) and do the maths?
Maxim make some nice high-side current measuring chips that can feed an ADC, but I don't know if they work up to 24V, I can dig out the datasheet if you're interested.

Four legs good, two legs bad, three legs stable.

You can measure the voltage of the first battery with respect to ground, then the second with respect to ground, subtracting the previous value, and so forth.

There are quite a number of high side current sensors, now, with common mode voltages in excess of 50V. You supply the shunt. Be careful, however, to usea 4-terminal shunt at those currents.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Quote:

There are quite a number of high side current sensors, now, with common mode voltages in excess of 50V. You supply the shunt. Be careful, however, to usea 4-terminal shunt at those currents.

Check out the Allegro ACS750 and see if it would be suitable. We had good results with initial testing, but then the project was cancelled. :)
http://www.allegromicro.com/sf/0...

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Lee -

I have some samples of the ACS750 already, based on an earlier recommendation of yours :). They would be a nice simple method, but they can only handle 100A max. The inverter here can do up to 200A when charging the batteries, and will do 360A shortcircuit ... I think the ACS750 would let out its magic smoke at those levels. The connecting cables are 4/0 ! Massive thick im-bloody-possible to bend. Thank goodness I got some expensive fine-strand cables a while ago - I can bend these fairly easily.

I had a recommendation for the Linear LT1787 on a yahoo forum I asked the same question in. Looks like it will do the trick.

http://www.linear.com/pc/productDetail.do?navId=H0,C1,C1154,C1009,C1077,P1779

I will be using a 2.5V reference for the A/D inputs. That allows for a 5V zener to protect the inputs, and also to use a comparator to detect when the input goes out of range.

John/Jim -

The trouble with referencing everything to GND is that I have to put in a set of voltage dividers in front. This would introduce tolerances error which I think can be avoided by measuring the batteries individually.

Linear makes a neat opamp - LT1991 - that has built-in precision resistors. Just by strapping the input pins you can set up lots of different gains.

http://www.linear.com/pc/productDetail.do?navId=H0,C1,C1154,C1009,C1126,P7569

Jim -

What did you mean a 4-terminal shunt ? The one I have is a fairly hefty one, two large brass/bronze screw lugs for the main cables, and two smaller screws in the sides for the measurment wires. Is that what you meant ?

Thanks for the help guys !

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Yes, the shunt you described is exactly what I meant. The whole idea is NOT to measure the I*R drop in the interface between the high current cable and the shunt. The extra two terminals let you do that. The current sensors I was thinking of have no shunt and will use what-ever shunt you supply Example is MAX4008 that can handle a common-mode input of 76V. I think there are others - new sources have been advertising in the last month or so including Zetex.

That new Linear Tech opamp (LT1991) looks like it ought to be just the thing. Some of the inputs have a 60V common mode range. LT1190 is supposed to handle +-250V!

Your challenge may well be the multiplexer/switch.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

I don't think I'll use a mux at all. Four LT1991s, with their outputs going right to AD0 - AD3. One LT1787/MAX4008 with the output going right to AD4. The comparators watching each of the inputs could go to other AVR pins which would indicate if an input is out of spec.

It's really just a matter of software calibration then.

As I said in the other thread, I'm also watching the AC output from the generator. I'm using the Maxim MX536a for both voltage (with appropriate divider and fuse in front) as well as the output from a CurrentTransformer for current.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Sounds like a winner!

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Look at http://www.lem.com they have lot of sensor

I'd agree the 4 opamps for each of the batteries is the go. I don't forsee a problem with using standard op-amps as you arrange the input divider to keep the input voltage within the op-amp input spec, then you select your gain to give you ,say 0-4v output for 0-12 differential in.

As one of the other respondents noted, LEM do some nice hall effect current sensors as do Honeywell. Some of these will work for AC also. These give you isolation as a bonus.

After looking around at various high-side current sensors, I think I'll go with the Maxim MAX4081 for the total current measuring actually. The SASA version has a gain of 60, so my nominal 200A max which produces 20mV across the shunt will be amplified up to 1.2V. This is almost exactly halfway between GND and the 2.5V ref that the A/D inputs in the AVR are using. Perfect - see below.

The MAX4081 will read both charging as well as discharging current. Vout swings from GND to 1/2 of ref, or 1.25V to show discharge current, and from 1.25V to 2.5V to show charge current. Means a little weird math to calculate the current and direction, but oh well.

Kartman -

I like the LT1991/5/6 amps because you don't need any external resistors. They're all internal, selectable just by strapping the right pins. These are 6V batteries, 4 in series for 24V. The inverter shows the total as sitting normally at around 26.8V, the individual batteries are around 6.7V. Under bulk charging the individual batteries may see as high as 8V depending on battery type. To gain 8V down to 2.5, the amps need a gain of 0.313.

The cool Configurator spreadsheet from Linear shows that the LT1991 can do a gain of 0.3. That gives a range of 0-8.3V. Perfect. Four of these and it's good to go. Just some bypassing caps.

I think I'll bring the SPI interface out to a header or edge connector. That way if one has more than the four batteries that I have, it's easy enough to add a small board with a bunch of the MAX4081s and a multi-channel ADC in an outboard box. Options, always good to have or design in options.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Quote:

I have a 300A shunt ...

Well, at least you won't have to worry about the AVR's performance at the lower temperature limit as was discussed in a recent thread. :)

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Just had a good point raised in another forum that I started this thread in. The effective range of each battery in the system is really only 5.8V (10% charge) to 6.4V (100% fully charged. So I don't really need to be able to measure below about 5.7V or so.

Right now, four of the LT1991 amps in the tiny msop10 package take up practically no room, so they're easy to put on the PCB. What would be a space-effective way to map the 0.6V (5.8V - 6.4V) range to the 0-2.5V range for the A/D inputs ?

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Quote:
What would be a space-effective way to map the 0.6V (5.8V - 6.4V) range to the 0-2.5V range for the A/D inputs ?

One way to do it is to follow your 1 per battery differential amps with a 4:1
multiplexer which drives one input of another diff amp. To the other
input of this stage, apply a fixed "offset", derived from Vref, that is
subtracted from the "battery" voltage of whatever batterry is selected
by the mux. Also design gain into this stage so that the resulting
"expanded scale" output fills the desired range of the adc. I do this
in an application where temperature is accurately measured with platinum
thermocouples over an "expanded scale" of 1400 to 1500 deg F. The avr's
adc is then used used to drive a PID loop and setpoint temp is maintained
within about 1 deg F with the "only10 bit" adc precision. Works slick!

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

Tom -

Can you give a bit more detail on how you did this for us (me, actually) mere mortals ? Because the way I see to do it is ugly.

I've been reading through Opamps for Everyone, and a couple of other opamp treatises. Head hurts. Basically, it looks like I would need a bias voltage different per battery to be added to the lower voltage side of the differential inputs.

For example, the batteries would look like this :

```24V --\
Batt 4 > diff amp 4
18V --<
Batt 3 > diff amp 3
12V --<
Batt 2 > diff amp 2
6V --<
Batt 1 > diff amp 1
0V --/
```

So if the range should be 5.6-7V, then we need to add 5.6V to the low input of each amp. So the 0V point would become 5.6V, the 6V point becomes 11.6V, the 12V becomes 17.6V and the 18V becomes 23.6V.

And they would need to be switchable on/off. No good measuring diff amp 1 if the upper point (6V) is actually 11.6V ... I think generating those extra four voltages, and controlling their application would be a bear. At least, if I'm understanding how offsets/biasing works. Ick.

Looking at the accuracy required, I'm thinking that it would just be simpler to accept the "lost" resolution, and just use the upper range of values. I would like the measurements to be accurate to at least 0.1V, with a reasonable view of 0.01V.

If the range is 0-7V mapped to 0-2.5V, and dropping one bit from the A/D to make it 9 bits, the codes range from 0-511. For a usable range of 5.6-7V, that's a code range of about 382-511, and we lose or rather ignore codes 0-381. There are an average of 7 codes per 0.1V change by my excel spreadsheet - for example :

451 = 6.6V
452 = 6.6V
453 = 6.63V
454 = 6.63V
455 = 6.66V
456 = 6.66V
457 = 6.69V
458 = 6.69V

It would be nice to know that one battery is at 6.253V and another is at 6.259V, but really, who needs it that close ? The purpose here is to make sure that the batteries are charging/discharging equally, to spot a potential problem before it becomes a problem ...

Now of course, another wrinkle :) A colleague living in upstate NY has just put in a similar system to mine - generator, inverter, battery bank. But instead of my paltry 4 6V batteries, he has 16, in two strings of 8 in parallel. A 48V system. "Hey Dean, can you set it up so I can monitor all my batteries too ? Please ?"

There is no WAY I will fit in 16 of the LT1991's, even if they are in msop10 package. Never mind there not being enough A/D inputs. So I'm thinking of a small separate box with a daughterboard, connected via SPI. Put the 16 LT1991's in there, in two blocks of 8 feeding into two MAX148/192 8-channel 10bit ADCs. Use a DB15 as the connector for all the batteries, with a single screw-term for the 0V/GND connection.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

There is another option: take the outputs of the OPAmps1-4 and feed them to another four with the - leg to a fixed 5.4V, and then you have it in an expanded range from 5.4 to whatever you want. Of course, it is more expensive, but with a simple LM224D you've done it.

Guillem.

Guillem.
"Common sense is the least common of the senses" Anonymous.

How about going V/F? With a pulse frequence proportional to the measured voltage you can even add optocouplers and have no worries over grounds and voltages. One VCO per battery i all that it takes, each supplies from the battry it measures. Current measuring could be done the same way, by taking the power supply from the uppermost battry, amplifying the signal from the shunt and feeding it to a VCO. Signal translation to CPU level could be done easily with or without opto couplers.

Guillem -

That's cool ! I think that's the way to do it. Or almost. I need to get the output to a 0-2.5V range. The LT1991/5 are nice in that they have internal resistors. I could either set up the first stage as a voltage follower to get a 0-7V range for each battery, then feed that into a second stage of LT1991s to drop it down to 0-2.5V, using 5.4V as the lower - input.

Hrm - anyone know of a quad-opamp with a good high (at least 40V) common-mode-voltage on the inputs ? That would let me use just 5 chips, one quad and four LT1991s.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

One of the few op-amps with big common mode range is from that Linear Tech family you started with.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Yeah, but they're only single amps per package. At least, the ones I've seen so far. Ideal would be the LT1991 in a quad package, just two chips then. Pity.

So, it looks like if I want to really use the full range to measure between say 5-7V, I will need eight LT199x opamps, two per battery, plus a 2V reference. That 2V reference on the second stage equates to an input of 5.41V. Or, just eat the loss in resolution and make do with the four opamps. That still gives a better than 0.1V resolution, close to but not quite 0.01V.

I think I'll stick with the simpler/cheaper :) For now. I'm still putting the SPI interface on a header at one end of the PCB, so one can always do a daughterboard with as many opamps/ADCs as one wants.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

Sounds like you have the scale expansion trick figured out. My thought was only to
add an analog mux to steer the signal from the four diff amps to a single diff amp
where the 5.4v "subtraction" is done, in order to save some cost and real estate.
Essentially, on the 24v system you would be using five diff amp chips and 1 analog
mux. This scheme might be helpful especially with 48 volt system you described.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

When a system like this begins to get complex, I begin to look for ways to simplify it.

Have you considered using a Tiny(15?) dedicated to each battery, and then using (opto)isolated communications to the master? This would allow your friend to scale your exact same components up to as many batteries as he can afford.

I would make the satellite boards as small as possible, and seal them against the acid environment that they may encounter (even near "sealed" batteries). I might even pot them.

I know what you mean. I always suffer dreadfully from featuritis ... For me, I only want to be able to watch four batteries. Well, I may extend the bank, so have expandability for eight maybe, but four at a minimum.

Are you suggesting using a Tiny15 for each battery, essentially taking power from that battery ? Hrm ... Interesting idea. No crystal needed - it has an internal oscillator. 5.5V max, so would need a voltage drop - the batteries can see up to almost 8V when they're charging. I always hear that the internal voltage reference isn't all that accurate, so one would need a 3-pin reference. Can probably use the main one for the main AVR. The Tiny15 has a differential ADC in it - without fully reading the datasheet, I would imagine that the external reference can't be above Vcc, so the battery input would have to go through a divider to get it down.

While thinking about a daughter-board, I was intending to use a small RatShack plastic box and screw it directly to the side of the main RatShack 8x3x1" box. A small hole in either side that matches up would allow a connecter ribbon cable to snake between them. No electronics would actually be right near the battery, so no potting needed. The battery box is about six feet from the inverter and electronics etc.

Right now I'm leaning towards putting the footprints for eight LT1991s on the main board, with solder-jumpers to enable them. That would handle each of four batteries (one amp each), and also the scaling to 5.5V-7V or so. If I can't fit them all in, then just four footprints, and to blazes with the bleeding-edge accuracy of the scaling :) These four batteries are measured by the ADC in the Mega.

That's fairly cheap - four LT1991s at best, eight at worst, not much space, and that covers what I need :)

I would put a header for SPI and power near the edge of the board, to allow connection to a daughter-board/box. Contents of which is yet to be determined ... I lean towards more LT1991s feeding a muxed ADC like the MAX148. Or maybe Tiny15s - might be cheaper.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

All this offsetting and such. For really quick and easy, though the amps cost a few bucks a piece, the AD629 is a nice solution. I've used it and it works. You get a ground-referenced (i.e. single-ended) voltage out even when the inputs are offset well over 100 volts. If you want to apply the same gain to each amplifier, just mux into your gain stage. Hook up address lines for the mux and connect the gain stage output to your ADC and you are done.

Please note - this post may not present all information available on a subject.

Why do you need another four LT1991? The 'substraction' stage gets only 5.4 to 8 volts at their inputs, so suppliying this stage with voltage about 10V you could use any OpAmp in quad package like the LM224D that I'm using.

Guillem.

Guillem.
"Common sense is the least common of the senses" Anonymous.

The internal reference is terribly inaccurate, but I haven't heard that it's unstable. Semi-automated calibration?

I think that using real resistors for the offset bias on the op-amps will introduce really big errors. Have you done a tolerance study?

I agree. The LT1991/5/6 is simular to the AD629/AD626, it can take up to +-60V on the inputs. The nice feature they have is the precisely matched internal resistors for gain setting. 0.04% worst-case matching, 3ppm/degC temp. You just strap the input pins going to each resistor appropriately to set any gain you want. Very slick, just one tiny msop10 package, no resistors or caps.

The way I see it, the two stages look like this. First stage is a basic unity-gain, so it maps the battery 0-7.5V differential input riding on up to 18V to a GND-referenced 0-7.5V. That feeds into the second stage + input, while the - input has a reference of 5V. This stage is set up as unity-gain as well, though it may need a tad of attenuation - I'll check the inverter to make sure of the charging voltage - it may be as high as 8V per battery.

So the voltage differential across the second stage inputs is from 5-7.5V, which gets mapped to 0-2.5V. That feeds directly into the ADC inputs.

Ah, SwitcherCAD has a model of the LT1991 and LT1996. I'll mess around with it to make sure things look as expected.

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

I just had a long look at the data sheet - it looks like a part I should play with.

Where are you getting your LT1991s? My usual sources don't seem to have any. :(

Hah. Good thing I checked with SwitcherCAD. My first shot at the design forgot that the opamp can only go rail-to-rail. So it can't just do unity-gain for 0-7.5V, it just goes to 5V. So the first stage needs some attenuation. I was also using the suggested (by the cool configurator Excel spreadsheet) 2.5V bias etc. which is really for a differential signal that can reverse, like a sine wave.

So a little changing here and there, and I came up with ...

First stage gain = 0.4. This takes a 0-7.5V signal and maps it to 0-3V. The second stage has a gain of 2.5 with a 2V reference on the - inputs. That maps the 2-3V input signal to 0-2.5V. Ta dahh. See below - that's a sweep of the input signal V1 from 0-7.5V. The red OUT2 would be the input to the A/D.

Now, to find the damn LT1991 ... I usually use http://www.findchips.com and http://www.freetradezone.com for searching, and they showed Digikey with them. I didn't notice the Non-Stock bit though. Ah well, can always buy direct from Linear on their site.

Check Electronic Design magazine, 1.13.05, in the grey DesignNotes advertisement page. There's a nice little howto about them, DesignNote 348. "Precise Gain without External Resistors".

They have a nice Configurator Excel spreadsheet that makes figuring the pin strapping dead easy. It includes the LT1996, which isn't/wasn't on the website. I complained, and they said the datasheet was going up shortly, and sent me a copy.

## Attachment(s):

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)

I don't have the data sheet handy, but didn't they mention that all input resistors except the 450K have protection diodes?

Yup, you're right. Only the 450K resistors can be taken up to 60V. That's not too big a deal though - the LT199x can operate on supplies up to 36V. So the Vcc pin will be at 12V in my case rather than the system 5V. I just checked it in SwitcherCAD, and the results are exactly the same - this is a good thing :) I need 12V for the temp and pressure senders for the diesel engine, so it's already on the board.

This does mean that I can't use these for the 48V battery strings my friend has though. Have to come up with another solution for that ...

Dean 94TT
"Life is just one damn thing after another" Elbert Hubbard (1856 - 1915)