EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Shark on August 26, 2013, 08:54:38 pm

Title: Differential amplifier for measuring current
Post by: Shark on August 26, 2013, 08:54:38 pm
Hi guys! I'm trying to create my own SLA battery charger and I'm preparing the current sense part. I would like the circuit to:
1) Measure charging current when the battery is being charged, and
2) Measure discharge current when I discharge the battery with a load.

I came up with a solution to use a low-side current sense 100mOhm resistor which is passed to a differential amplifier with a gain of 10. I used two amps so that I can invert the polarity to get readings in both cases (charging and discharging).

First of all I would like to know if I'm on the right track. Secondly, I will be passing output of the two differential amplifiers to Arduino ADC and need to avoid negative voltage, or at least make it minimal.
Title: Re: Differential amplifier for measuring current
Post by: Paul Price on August 26, 2013, 11:53:29 pm
Some suggestions:

Use .01 ohm and set gain to 100, saves wasted power and works as well.
Make two x101 gain amps, identical (R output to neg in =100k, R neg-input to sense resistor =1k). Connect both across the .01 ohm sense resistor, but reverse the plus/minus inputs to the sense resistor with the second current sense op-amp. The first op-amp gives you the charging current (+ input of op-amp to battery - terminal side of sense resistor)
The second op-amp gives you discharge current (-input of op-amp to battery - terminal sense resistor).
Use a LM358 since you only need two op-amps.
Let the MCU calculate and correct the gain factors to 100.
Ground the neg. power pin 4 on the LM358.
There will never be any negative voltage output to your MCU A2D inputs.
Title: Re: Differential amplifier for measuring current
Post by: tszaboo on August 27, 2013, 11:33:45 pm
Hi,
I wrote in my blog a solution for your problem, as I find it an excellent question, and want to keep it for future : http://nandblog.com/current-shunt-monitors/ (http://nandblog.com/current-shunt-monitors/)
Title: Re: Differential amplifier for measuring current
Post by: ivan747 on August 28, 2013, 01:47:47 am
Some suggestions:

Use .01 ohm and set gain to 100, saves wasted power and works as well.

I differ. The power wasted in the resistor is 0.08W, even less than 1/4W. I would consider changing the value only at 10A, when power wasted is 1W. It then makes sense to use a 10m-ohm resistor, but then you have to take into account the op-amp's offset voltage because the gain is 100 instead of 10.
Title: Re: Differential amplifier for measuring current
Post by: Shark on August 28, 2013, 07:53:45 am
Hi again!

Paul, I used a 0.1 ohm resistor because it was easier to come by and as ivan747 pointed out, power loss isn't very big. I also estimated that the voltage drop when charging (50mV @ 0.5Amp) is negligible as I currently use a slow charger. Thanks for your tip about LM358, as I don't need four channels.

NANDBlog, thank you for a very thorough look and explanation, I promise to be more doubtful of the simulation software (Multisim). You exposed a problem of two different grounds. I tried with the grounds joined and the results were pretty much alike, huge negative voltage on U2B. Then, yes, I've been avoiding instrumentation amplifiers because I've never dealt with them before, but I'll give a look at them now and the datasheet you recommended.

Thanks to all, I'm learning a lot!
Title: Re: Differential amplifier for measuring current
Post by: tszaboo on August 28, 2013, 05:56:01 pm
Analog devices has a very thorough application note on In-amps, i highly recommend to at least read the first 2 chapters. After they understood, it is clear, that they are superior in a lot of aspects, compared to opamps.
But for this application, a current shunt monitor should be enough.
http://www.analog.com/en/power-management/power-monitors/ad8557/products/CU_dh_designers_guide_to_instrumentation_amps/fca.html (http://www.analog.com/en/power-management/power-monitors/ad8557/products/CU_dh_designers_guide_to_instrumentation_amps/fca.html)