Go Down

Topic: Battery Voltage Measurement with OP Amp (Read 9524 times) previous topic - next topic

Karsten_87

Hello Everybody,


In the past I often found a solution here so now I try with something I could not solve with google.

I build a little current controlled battery simulator to charge and discharge cells with different current profiles. For this I have a cell, the charging/discharging circuit and the cell voltage measurement. I use an OP Amp with the output voltage directly connected to an ADC port of an Arduino Uno. The OP Amp has two functions: 1. multiplying the cell voltage times two (better resolution) 2. giving me just the cell voltage since for the charging the negative pole has not the same potential as ground. (see attached circuit figure)

The Arduino gets its reference voltage from an external precision reference (5V.) As you can see in the "test" figure, the measurements works well (precise enough, not noisy) except for one point:

When hitting about 2.44V the measurement starts to jump weirdly as if the resolution has decreased a lot. Does anybody has an idea why this could happen?

I already tried to measure precisely 2.5V with the result of an output voltage of 5V at the OP AMP and 2.49something as Arduino output. I have a bit of the feeling that it could be the Arduino, but not a slightly hint where to start looking.

In the past I, let's say, mistreated the analogue input at least once with overvoltage but couldn't determine any changes in the measurement quality afterwards. Could the route for my error could be somewhere there?


Thank you very much in advance! I hope somebody had something like this before.

Best regards
Karsten





jremington

What op amp are  you using? With many, there are limits on the allowable input voltage range.

raschemmel

#2
Apr 06, 2016, 06:13 pm Last Edit: Apr 06, 2016, 06:18 pm by raschemmel
The answer might be more obvious if you look up the charged voltage for an NiMh and devide your measured voltage by 2 (assuming you calibrated your op amp circuit and actually KNOW the EXACT GAIN to be EXACTLY 2.000 ) and compare your measured voltage (after dividing by GAIN) to the charged voltage for an NiMh.
I mean if the battery is already charged, what do you expect it to do ? (other than go into some kind of "trickle charge " mode, if that's even possible)

Quote
a freshly charged AA NiMH cell in good condition is about 1.4 volts.[20]
NiMh battery

Judging from your above and your plot, I would estimate your EXACT gain to be about 1.75.

MarkT

What op amp are  you using? With many, there are limits on the allowable input voltage range.
Not an issue with this circuit I think, the inputs are at about 1.2V in the differential amplifer
configuration.

It could be genuine signal - check with a multimeter across the cell.  However I don't see any
decoupling in that circuit - decouple your opamp for stable operation.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

jremington

Post a complete circuit diagram. The battery appears to be floating, so the reference for V1 and V2 is not clear.

raschemmel

As mentioned, the voltage plotted that looks wierd is actually the battery reaching the charged state at 1.4 V (OP's output voltage is about 1.75 times the battery voltage.)
The battery is alternating between charging and discharging at the charged voltage. (probably a few hundred mV)

MarkT

#6
Apr 07, 2016, 12:29 am Last Edit: Apr 07, 2016, 12:30 am by MarkT
Post a complete circuit diagram. The battery appears to be floating, so the reference for V1 and V2 is not clear.
That's not an issue, the differential amplifier circuit will bias it OK - if it wasn't floating there could be
a risk of it departing outside the safe operating envelope of the opamp, but as it is it is sitting balanced
around 1.2V which should be OK for a modern opamp.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

MarkT

As mentioned, the voltage plotted that looks wierd is actually the battery reaching the charged state at 1.4 V (OP's output voltage is about 1.75 times the battery voltage.)
The battery is alternating between charging and discharging at the charged voltage. (probably a few hundred mV)
Interesting theory, but the voltage steps go the wrong way.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

raschemmel

#8
Apr 07, 2016, 01:00 am Last Edit: Apr 07, 2016, 01:46 am by raschemmel
When the battery is fully charged , it no longer presents a load and the voltage reverts to an op amp output with no load .

Try adding a bleeder resistor across the battery. (10 k  to 22 k ohm)

Measure tge battery voltage with a meter and post the value

jremington

#9
Apr 07, 2016, 01:46 am Last Edit: Apr 07, 2016, 01:47 am by jremington
Quote
That's not an issue
Yes, it is an issue. We have no way of knowing what the rest of the charging circuitry looks like, and how it is connected to the existing circuitry.

raschemmel

#10
Apr 07, 2016, 01:54 am Last Edit: Apr 07, 2016, 08:20 am by raschemmel
Quote
We have no way of knowing what the rest of the charging circuitry looks like, and how it is connected to the existing circuitry.
Not to mention we have no idea what the actual resistor values are, what the actual gain is or what the actual battery voltage is when it is charged.  I don't see how posting  a plot from an amplifier with an unknown (actual) gain  will tell us that.  We need the plot to understand the symptoms but we need the (actual)voltage measured with a meter to calculate the actual gain.

The circuit is an Op Amp Subtractor

Try adding Voltage Followers in front of R1 & R2


Connect TWO 10 k resistors in  series from +5V to GND you should measure 1.66 V and 3.33 V respectively at the two points where the resistors connect. If the Gain of your subtractor is really 2,  it should output 4.00 V when you connect V2 to 3.33V and V1 to 1.33V.  You  use whatever it outputs to "CALIBRATE"  it by deviding the output by 4.00 to obtain the "CORRECTION" Factor.

Vo = 2* (3.33V- 1.66V)
   = 2*2.00 V
   = 4.00 V

Suppose the output is 3.50V ( instead of 4.00V)

3.50 V /4.00 V = 0.875
1/0.875 = 1.14285714

Correction factor = 1.14285714
1.14285714* 3.50 V = 4.00. V
  For this case, a battery with a voltage of 1.4 V would (after dividing by gain) read 1.225 V
1.225 * 1.14285714= 1.40 V

Karsten_87

Hi everybody,

thank you for all the kind and very valuable comments!


First, I used two NiMH batteries in series for testing purposes and the shown voltage is the actual one.

 So the charging starts close to the nominal voltage of 1.2V. Since the cell voltage is rising slowly at this point I thought I take this example to show the effect. Sorry for not making this clear in the first place!

@ jremington: The OP AMP I am using is a LM 358 with a maximal supply voltage and difference Voltage of 32V - so I don't think it that,

I also attached a complete circuit diagram of the current controlled battery simulator. Yes, the battery is floating. But since the OP Amp gives me only the differential voltage between the battery poles it should be ok.

@raschemmel: I compared the battery voltage with the Arduino outputs before with a reasonable precision. Like I said I charged the cells close from nominal voltage and expect a slow rise. Also it cannot be the cell because the "jump" also occurs with other cell chemistries, following the same pattern. The start of the "jump" varies a bit (2.43V - 2.443V) but the upper value is always 2.46.

I don't understand how a bleed resistor could solve that. Furthermore I want to get reasonable precise capacity values by integrating the current over time. For this any unmeasured current will increase my error quite a bit.

Also thank you for that suggestion with the correction factor. But I did this already (not as accurate as you) and got reasonable results for the hole voltage range, except the little "jump" always at this position.

I used 56k Ohm for R1 and R2 and 112k Ohm for R3 and R4

@MarkT: Decoupling sounds interesting. However I have no idea how to do this. Would you mind giving me an example or an online link for that? Also suggestions how to make the circuit more robust would be nice.

I tried today to use different ports of the Arduino, no success. But I narrowed down the error a bit: Next to the the figure with the whole circuit I attached my latest measurement: I connected the Vout of the OP AMP directly with the Multimeter and the Arduino (both measured against ground). The result is shown in test3.jpg. The OP AMP output is not governing the "jump".

So it must have something to do with the Arduino or how it is connected? Should I upload these connections as well?

Thank you again for your help!

BigBobby

#12
Apr 07, 2016, 05:49 pm Last Edit: Apr 07, 2016, 08:47 pm by BigBobby
Your schematic isn't 100% clear to me.  For one thing, you have two nodes named Vout but I know they're not connected to each other.

From the red arrows, however, it seems that you have a mode where you charge the battery through a FET/shunt which is controlled to provide a constant current?

Since your cells get ground through this FET/shunt you are putting a common mode signal at the inputs to your op amp.  It sounds like this has the potential to cause the results you're seeing, although I don't have a good reason why it'd happen at the end of charge (when you'd expect the FET to be fully on).

Edited to Add:  wait...no...if your FET was fully on at the end of charge, then you'd have 12V across your battery.  I don't understand how your FET is controlled...

raschemmel

#13
Apr 07, 2016, 06:10 pm Last Edit: Apr 09, 2016, 12:40 pm by raschemmel
Quote
I don't understand how a bleed resistor could solve that. Furthermore I want to get reasonable precise capacity values by integrating the current over time. For this any unmeasured current will increase my error quite a bit. 
i

Quote
The OP AMP output is not governing the "jump". 
There is no "jump" . That's the battery charging current reducing to "0".

Whether you understand it or not, as long as you refuse to add the bleed resistor your results will remain the same, regardless of anything else you do. As I already stated, the battery or batteries only constitute a "LOAD" in so much as they need charging. Once they are charged, they no longer present a load to the op amp and the  op amp see's "no load" and the output oscillates at the last 10 - 15 mV. Adding a bleed resistor ensures that the op amp sees a load and the output will be whatever the charged voltage is because the bleed resistor current with respect to battery current is negligible and it should be obvious that once the battery is charged the charging current approaches 0 mA. Attempting to measure the charging current during the last 0.4 % of the charging cycle is a futile endeavor and you are wasting your time. Your circuit is complete. Just add the bleeder resistors and you should be done. (you may need to experiment a little with the value)
Also , you can't charge batteries in series because when one is charged it will stop conducting current. (that should be obvious) Thus the remaining battery will not get any charging current. (which is no doubt linked to your "problem") ( the op amp output is "floating" because  there is no load after one of the batteries is fully charged) Remove one battery and replace it with a load resistor. The current is the same through the resistor and the remaining battery.
The load resistor needs to drop 1.4 V @ 80% of charging current
R = 1.4 V/ Icharging

It's the most basic law (Ohm's Law) of electronics.
Current is a function of Difference of Potential and resistance. If the sum of the two batteries is the same as the charger output no current will flow.
At some point the current and difference of potential are so small there is nothing to pull down the op amp output and starts to "float" . What you are calling a "jump" (as if it shouldn't occur) is the battery's natural way of telling you one or both batteries are charged and no current is flowing.  If you simply accept that fact you can stop collecting data at that point and call it "charging cycle complete" indication. Otherwise, if you refuse to accept the obvious you can add the "bleeder " resistor, starting at the higher value and adjusting value lower until the "jump" disappears.


Quote
Also it cannot be the cell because the "jump" also occurs with other cell chemistries, following the same pattern. The start of the "jump" varies a bit (2.43V - 2.443V) but the upper value is always 2.46. 
That should tell you something, like , basically, any rechargable battery will no longer present a load once it's charged and your op amp will float and oscillate because it sees no load. (how can it with no difference of potential ? How can the output be pulled low if there is no current ? The only way to pull the output down when the battery is fully charged is to apply a lower voltage and start discharging the battery by sinking current instead of sourcing it. There are no other "options" You are either sinking current (discharging the battery), or sourcing it (charging the battery). You could alternate between the two to keep the voltage at some setpoint but if you simply command the op amp to an output voltage that is exactly the same as the sum of the two batteries, there will be no difference of potential and therefore no current. It's as simple as that. I can't believe how much you are making of a 15 mV fluctuation when the battery is charged. It's not showing up on your meter because it is averaging.  Try changing your code to take 10 to 20 readings and average them and print only the average.


"Jump" = (2.47V-2.45V) = 0.020 V
(@0.00488 V/ per analog count, this is 3 counts)

Based on the step size of the voltage steps, the "jump" appears to be 3 "steps" or analog counts (3*0.00488 = 0.01464 V) or just under 15 mV.

To call a 15 mV voltage change in a 0 to 2.47V range a "jump" is just ludicrous ( because it represents a 0.4 % voltage change)

Total Charged Battery Voltage = 2.47 V

"Jump"(%) = 100* (0.015 V/2.47V) = 0.59 %

I'm curious. How did you plot your readings ?
Did you use a Terminal Capture software and copy and paste into Excel ?

Quote
@MarkT: Decoupling sounds interesting. However I have no idea how to do this. Would you mind giving me an example or an online link for that? Also suggestions how to make the circuit more robust would be nice. 
Google "decoupling caps"
It's just a fancy name for a cap that shunts high frequency noise go ground based on the capacitive reactance (Google "capacitive reactance " and do the math for "Let f = 100000, f = 10000,  then f = 1000 and compare the three. What does that tell you about what the cap is doing ?. )

BigBobby

#14
Apr 08, 2016, 04:52 pm Last Edit: Apr 08, 2016, 05:29 pm by BigBobby
Your schematic isn't 100% clear to me.  For one thing, you have two nodes named Vout but I know they're not connected to each other.

From the red arrows, however, it seems that you have a mode where you charge the battery through a FET/shunt which is controlled to provide a constant current?

Since your cells get ground through this FET/shunt you are putting a common mode signal at the inputs to your op amp.  It sounds like this has the potential to cause the results you're seeing, although I don't have a good reason why it'd happen at the end of charge (when you'd expect the FET to be fully on).

Edited to Add:  wait...no...if your FET was fully on at the end of charge, then you'd have 12V across your battery.  I don't understand how your FET is controlled...
OK, I put some time into it and I understand now.  If you don't mind, I added some labels to your schematic and reattached here.  I'd post it as a picture, but my employer seems to block the free picture hosting sites (BTW - how little sense does it make that the forums will host the pictures as attachments, but not as pictures?).

Edited to add:

So if I understand your circuit correctly, T1 is a voltage controlled resistance that results in a constant current through your cells.  When S1 is closed and S2 is in position 1, the cells are pulled up to 12V and T1 limits the charge current through the cells.  When S3 is closed and S2 is in position 2, the cells are pulled down to GND and T1 limits the cells discharge current.  Nice circuit.

It appears in your data you are always charging, which explains why your schematic shows the charging configuration.  If your cells are balanced, they should be at ~1.23V.  Are you sure they're both 1.23V?  If they are, then they should be far away from end-of-charge where their impedance might do weird things.

It seems like your control for T1 must be unstable.  As a test, when you see the A/D reading fluctuating like that, could you ground the + input to the amplifier controlling it to see if the A/D reading goes back to normal?

It also seems that the instability must be affecting your Arduino beyond just putting a high frequency on your cells.  If your multimeter was just averaging the signal clean, it would be in the middle of the Arduino's samples where your Arduino samples are clearly higher.  Possibly T1 being unstable could result in common mode signals getting through the op-amp, or maybe its ground currents aren't separated from the grounds of your op-amp and avr.

Seeing if the A/D readings go back to normal when T1 is forced off, however, would be the first step before figuring out how T1 is affecting your reading.

Go Up