Author Topic: Inconsistent Battery Reading under load  (Read 4377 times)

0 Members and 1 Guest are viewing this topic.

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #50 on: February 20, 2024, 05:54:13 pm »
I flipped the inputs just to test, and that does make it work...  But now I am even more curious.  Measuring the high potential on the pin gives half the voltage.  Voltage divider, so that makes sense.  Measuring the voltage on the inverting pin gives half the voltage as well.  Which if the output is the full voltage would make sense.  Right, the inverting essentially is a voltage divider from the Vout to the low potential.  If the resistors are the same value, half of Vout.  Interesting.  I realize there is a lot more to it, and I have watched a few videos and read a few articles on this now.  But this is the way my brain is processing it...
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #51 on: February 20, 2024, 09:50:21 pm »
I cut some traces and soldered in jumpers.  Now both sides are working.  I had to remove the resistor from the output filter, but leaving the cap still seems to get rid of the pwm frequency, so...  Stable voltage on the outputs and all the way up to the pins on my microcontroller, but the adc is fluctuating a lot more.  Will have to track that down.
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #52 on: February 20, 2024, 10:04:26 pm »
And, as a follow up.  All that work and it solved nothing.  Voltage under load still reads about 0.01V lower than either of my bench DMMs. 
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: Inconsistent Battery Reading under load
« Reply #53 on: February 20, 2024, 11:19:25 pm »
I cut some traces and soldered in jumpers.  Now both sides are working.  I had to remove the resistor from the output filter, but leaving the cap still seems to get rid of the pwm frequency, so...  Stable voltage on the outputs and all the way up to the pins on my microcontroller, but the adc is fluctuating a lot more.  Will have to track that down.

You can't remove filter resistor, it may lead to op amp instability and oscillation. It's a must for most op amps.

All that work and it solved nothing.  Voltage under load still reads about 0.01V lower than either of my bench DMMs. 

Are you serious? 10mV lower than bench DMM? That's actually a very good result you got there. DMM is a precision instrument, your circuit is not.
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #54 on: February 20, 2024, 11:55:54 pm »
You can't remove filter resistor, it may lead to op amp instability and oscillation. It's a must for most op amps.

Not the feedback resistor.  The low pass filter resistor after the op amp. 

Quote
Are you serious? 10mV lower than bench DMM? That's actually a very good result you got there. DMM is a precision instrument, your circuit is not.

I understand that.  And I need to do some more testing, but I originally started this thread because of that issue.  Voltage under load was 10mV less than what my DMM read.  At least at the battery terminals.  I coded out the error, but it was proportional to the current, luckily it was just a simple slope.  But if I change the load resistance, the values change, so I was hoping to fix that. 

EDIT:  Hah, I started this thread with a 100mV difference, now I am down to 10mV.  Well, that is 10x better, lol.  Ok, I will do more testing to confirm results, and if it stays at 10mV, I can live with that.
« Last Edit: February 20, 2024, 11:59:12 pm by trilerian »
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: Inconsistent Battery Reading under load
« Reply #55 on: February 21, 2024, 12:11:03 am »
You can't remove filter resistor, it may lead to op amp instability and oscillation. It's a must for most op amps.

Not the feedback resistor.  The low pass filter resistor after the op amp. 

Yes, the low pass filter resistor! You CAN'T remove THAT.

Stable voltage on the outputs and all the way up to the pins on my microcontroller, but the adc is fluctuating a lot more.  Will have to track that down.

Stable only because your DMM is averaging and integrating. In reality your op amp is most likely oscillating. That's why adc is fluctuating. Put back the low pass filter resistor!

I understand that.  And I need to do some more testing, but I originally started this thread because of that issue.  Voltage under load was 10mV less than what my DMM read.  At least at the battery terminals.  I coded out the error, but it was proportional to the current, luckily it was just a simple slope.  But if I change the load resistance, the values change, so I was hoping to fix that. 

EDIT:  Hah, I started this thread with a 100mV difference, now I am down to 10mV.  Well, that is 10x better, lol.  Ok, I will do more testing to confirm results, and if it stays at 10mV, I can live with that.

You stated like 120mV or something. Well, 10mV in 4 volt range is like 0.25%. That's GOOD. Come on, think about that, you have only 10bit ADC, your resolution is 4mV, plus ADC likely has some offset, ADC is sampling single ended, not differential, layout not perfect, maybe some small ground level shifts, plus op amp offset, gain error, plus maybe some other errors. That's very good what you got. Real engineering is not like math on a paper where everything is perfect. Otherwise engineers whould have no job, only mathematicians would.
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #56 on: February 21, 2024, 01:57:02 am »
Yes, the low pass filter resistor! You CAN'T remove THAT.

Wait, the low pass filter isn't in any of the designs I saw online.  And when I have that in, it decreases the output to 0.7V instead of 3.4V.
I am attaching a pic of the schematic and arrows pointing the resistors I have removed.



 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: ua
Re: Inconsistent Battery Reading under load
« Reply #57 on: February 21, 2024, 06:31:05 am »
I would try to use at least 22-47 R there. But as you know look at the resulting voltage drop. Seems you ADC is consuming a lot of current. You may play with different capacitances there too. And you may add opamp buffer/filter instead of pure passive. But 10 mV error is pretty fine for existing simple solution.
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: Inconsistent Battery Reading under load
« Reply #58 on: February 21, 2024, 09:17:46 am »
Yes, the low pass filter resistor! You CAN'T remove THAT.

Wait, the low pass filter isn't in any of the designs I saw online.  And when I have that in, it decreases the output to 0.7V instead of 3.4V.
I am attaching a pic of the schematic and arrows pointing the resistors I have removed.

Simple to remember: most op amps can't drive capacitive loads. Capacitor on the output of op amp generally is big no-no. With series resistor it's ok, because then the op amp "sees" a resistor, not capacitor, or at least "less" the capacitor, "more" the resistor.

Your filter with 5k1 is a good filter, keep it. If you see such a voltage drop with series resistor in, than something is hugely wrong. Maybe capacitor is cracked, maybe ADC is half fried or something else. Is it so on both channels?
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #59 on: February 21, 2024, 01:39:02 pm »

Simple to remember: most op amps can't drive capacitive loads. Capacitor on the output of op amp generally is big no-no. With series resistor it's ok, because then the op amp "sees" a resistor, not capacitor, or at least "less" the capacitor, "more" the resistor.

Your filter with 5k1 is a good filter, keep it. If you see such a voltage drop with series resistor in, than something is hugely wrong. Maybe capacitor is cracked, maybe ADC is half fried or something else. Is it so on both channels?

Ok, that makes sense.  I can remove the capacitor too and see what it looks like on my scope.  I can also try other values for the low pass.  But yes, it has the big voltage drop on both channels.  This filter works fine without the op amp setup. 


EDIT:  Alright, nevermind.  I must have had something wrong.  I put the resistors back in and it is fine.
« Last Edit: February 21, 2024, 02:45:32 pm by trilerian »
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #60 on: February 22, 2024, 06:39:29 am »
I have another question . This is related to the input conditions of the op amp. It states that neither input voltage can exceed Vdd-Vss. In my case that is 5V. Technically, cell2 of the lipo positive side is up to 8.6V above ground due to it being in series. However, there is the voltage divider on the non inverting input. So does that mean the input only sees the divided voltage? If I measure the voltage at that node it is fine, and I just want to make sure I am not stressing the max ratings.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: ua
Re: Inconsistent Battery Reading under load
« Reply #61 on: February 22, 2024, 08:07:46 pm »
There are two modes or two states which you may want to investigate to be sure: steady state and transients (when power-up and outboard external).
You are fine with steady state mode because as you see you have a voltage divider. And it is not so obvious with all types of transients. You may quite in a simple way look at power-up transients with an oscilloscope, I guess. And it is much more variants what you may get from external world (like battery loose contacts and any other possible outer influence.
 

Online Jwillis

  • Super Contributor
  • ***
  • Posts: 1711
  • Country: ca
Re: Inconsistent Battery Reading under load
« Reply #62 on: February 22, 2024, 09:14:05 pm »
Arbitrary changing resistors on an opamp is'nt going to get you far. Know what gain you want. From the looks of it you are looking at a 2 gain for each opamp. so each resistor needs to be measured to give exactly 2 gain for each opamp. You work this out  a non-inverting design formula. So for a 2 gain Re 1,3, 5,and 6 need to be measured and matched to give a precise gain.
Another problem is the Input Offset Voltage. The MCP6497 has an input Offset Voltage of  -1.6mV min and +1.6mV max, That's a span of 3.2mV, which is quite a bit. That then  is multiplied by the gain. Then that error is multiplied again because your using 2 opamps to give a finale result. Compounding errors.
Do you know what the actual  Input Offset Voltage of each opamp?
The The MCP6497 has no Offset trim built in, so that has to be done externally. By being able to trim the offset and having a precise gain you can guarantee that the output will be correct.
« Last Edit: February 22, 2024, 10:14:33 pm by Jwillis »
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #63 on: February 23, 2024, 12:35:43 am »
There are two modes or two states which you may want to investigate to be sure: steady state and transients (when power-up and outboard external).
You are fine with steady state mode because as you see you have a voltage divider. And it is not so obvious with all types of transients. You may quite in a simple way look at power-up transients with an oscilloscope, I guess. And it is much more variants what you may get from external world (like battery loose contacts and any other possible outer influence.

Ok, I will check power up, connecting and disconnecting with my scope, so long as it doesn't go over Vdd-Vss, i should be good?

Arbitrary changing resistors on an opamp is'nt going to get you far. Know what gain you want. From the looks of it you are looking at a 2 gain for each opamp. so each resistor needs to be measured to give exactly 2 gain for each opamp. You work this out  a non-inverting design formula. So for a 2 gain Re 1,3, 5,and 6 need to be measured and matched to give a precise gain.
Another problem is the Input Offset Voltage. The MCP6497 has an input Offset Voltage of  -1.6mV min and +1.6mV max, That's a span of 3.2mV, which is quite a bit. That then  is multiplied by the gain. Then that error is multiplied again because your using 2 opamps to give a finale result. Compounding errors.
Do you know what the actual  Input Offset Voltage of each opamp?
The The MCP6497 has no Offset trim built in, so that has to be done externally. By being able to trim the offset and having a precise gain you can guarantee that the output will be correct.


I do know what I want, and I chose resistors to get the gain I want...  R1 and R2 are 11K5 and R3 and R4 are 10K.  This is what I am looking for.  Drop up to 4.35V to below 4.096V.  4.096V is my ADC reference.  I am using 0.1% resistors, and still matching them. 

Is there a mathematical way of determining the input offset, or is that just do some measurements?  As of right now, the measurement is within 3mV for both channels added together, and since I am using a 10 bit ADC, I'm not getting more accurate than that.  Well, without oversampling at least. 
 

Offline helius

  • Super Contributor
  • ***
  • Posts: 3643
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #64 on: February 23, 2024, 02:58:06 am »
A lot of advice about optimizing the circuit, but have you researched if you are just seeing normal battery voltage delay?
Lithium and lithium-ion cells have passivation covering the plates, and this causes voltage to dip and then recover when they are put under load.
 

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #65 on: February 23, 2024, 04:39:28 am »
A lot of advice about optimizing the circuit, but have you researched if you are just seeing normal battery voltage delay?
Lithium and lithium-ion cells have passivation covering the plates, and this causes voltage to dip and then recover when they are put under load.

Well that is interesting.  I will have to look into that as well.  How long would this delay happen for? 


There are two modes or two states which you may want to investigate to be sure: steady state and transients (when power-up and outboard external).
You are fine with steady state mode because as you see you have a voltage divider. And it is not so obvious with all types of transients. You may quite in a simple way look at power-up transients with an oscilloscope, I guess. And it is much more variants what you may get from external world (like battery loose contacts and any other possible outer influence.

Ok, I will check power up, connecting and disconnecting with my scope, so long as it doesn't go over Vdd-Vss, i should be good?

I checked this out on my scope and on my SDM3055 in fast mode.  I never saw the voltage go over 3.8V after the divider.  I performed quite a few manual tests and it just goes to 3.8V right away.  I tested at 2Hz sample rate and faster sample rates.  Attached is a screenshot of the scope output.  I tapped the plug to the terminal a few times to make sure I wasn't missing anything.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1419
  • Country: ua
Re: Inconsistent Battery Reading under load
« Reply #66 on: February 23, 2024, 11:50:34 am »
I checked this out on my scope and on my SDM3055 in fast mode.  I never saw the voltage go over 3.8V after the divider.  I performed quite a few manual tests and it just goes to 3.8V right away.  I tested at 2Hz sample rate and faster sample rates.  Attached is a screenshot of the scope output.  I tapped the plug to the terminal a few times to make sure I wasn't missing anything.
Seems fine to me. In general, when you have at least several kOhms between any opamp input and any potential harm source those several kOhms (11 k in your example) work as good enough resistance to make any possibly harmful opamp input current low enough (less than 1 mA), if it will arise somehow. Typically that is a quite safe current which must not harm typical opamp input.
So, this may be it ('Good enough for Australia'  :) :-+).
« Last Edit: February 23, 2024, 11:53:45 am by Vovk_Z »
 
The following users thanked this post: trilerian

Offline trilerianTopic starter

  • Regular Contributor
  • *
  • Posts: 163
  • Country: us
Re: Inconsistent Battery Reading under load
« Reply #67 on: February 27, 2024, 07:27:20 pm »
Got a new question, on the same subject, but not this design.  I opened up a premium charger/discharger to see how it handles the voltage sensing.  Looks like it is using components marked "E23", which after a search come up as biased resistor built-in transistor.  The inputs from the cells go into the transistors and the outputs go straight to the mcu. And nothing it seems to take care of the grounding issue...  Would this still be considered a 4 wire?  Also, this is dividing the voltage, or reducing the voltage on the output, I understand that it can act like a regulator on the output, just not sure how that is calculated.  All the cells use the same part, one for each cell. 
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf