EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: bogdant on May 17, 2020, 05:41:46 pm

Title: current sense with LM324D
Post by: bogdant on May 17, 2020, 05:41:46 pm
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.
https://github.com/bogdan-tirzioru/Powersupply/blob/master/factory/sampleB/Job2.PDF
Do you have any idea why is not working ?
Title: Re: current sense with LM324D
Post by: mikerj on May 17, 2020, 07:07:45 pm
Poor common mode rejection is often caused by poor matching between your gain setting resistors, even 1% resistors will limit performance and if you are using unbranded Chinese 1% resistors the chances are they don't meet 1% tolerance.
Title: Re: current sense with LM324D
Post by: Alti on May 17, 2020, 07:55:54 pm
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.

This opamp as the current sink capabilities in the range of 50uA in the range 0V to 0.7V so if you are loading it more there, it won't work. Avoid this range when sinking.
Uout = 3.3*UR1
It should output 0V at Ushunt=0 only if inputs and output and supply pins are within the operating range. And clearly output is not, not sure about the rest.

One option I'd suggest is to measure:
Uout = 3.3*UR1 + 0.5*Vcc
Then at UR1=0 you should get 0.5*Vcc on the output.
Title: Re: current sense with LM324D
Post by: xavier60 on May 17, 2020, 11:04:23 pm
Measuring its input voltage difference will indicate if the opamp is operating closed loop or not.
When a power supply design has a large output capacitor, it can be an indication of inherent instability.
Title: Re: current sense with LM324D
Post by: bogdant on May 18, 2020, 04:33:18 am
I remove the output capacitor C3=470uF and I have the same result. The voltage input difference on the opamp is 0V for no load. I also measure each resistor and the value is spot on. 
Title: Re: current sense with LM324D
Post by: bogdant on May 18, 2020, 04:40:30 am
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.

This opamp as the current sink capabilities in the range of 50uA in the range 0V to 0.7V so if you are loading it more there, it won't work. Avoid this range when sinking.
Uout = 3.3*UR1
It should output 0V at Ushunt=0 only if inputs and output and supply pins are within the operating range. And clearly output is not, not sure about the rest.

One option I'd suggest is to measure:
Uout = 3.3*UR1 + 0.5*Vcc
Then at UR1=0 you should get 0.5*Vcc on the output.
Vcc = 32V => Uout = 0.5*32V= 16V, I do not have this value. But it seems that there is a correlation to the load. If I disconnect the next stage it is better, but no so much(10mV). Can you recommend another opamp for this job ?
Title: Re: current sense with LM324D
Post by: T3sl4co1l on May 18, 2020, 04:44:02 am
Connect pin 11 to a slight negative supply, or connect a pull-down resistor from the output pin(s) to a negative supply.

The latter is probably the better option, as to bias the output stage into class A conduction.  LM324 is a terrible opamp, with enough distortion to be noticeable even in control applications such as this.  It needs all the help it can get (like by biasing the output).

Speaking of bad things being bad, and component paranoia -- mind that even the lowly 324 can and will be counterfeited by cheap suppliers.  You might get salvaged parts, you might get dust, you might get something unexpectedly much better -- who knows?  The same goes for every semiconductor; buy from authorized distributors if possible.

Tim
Title: Re: current sense with LM324D
Post by: xavier60 on May 18, 2020, 05:20:10 am
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.
https://github.com/bogdan-tirzioru/Powersupply/blob/master/factory/sampleB/Job2.PDF
Do you have any idea why is not working ?
According to TI's data sheet, their part has a 50uA current sink to ground so it should go very close to 0V so long as there is very little external pull-up current. With the PSUs output set to 5V, the pull-up current should only be 12uA from R4 and R10 .
With the PSUs output set to 0V there should be no pull-up current.
Have you disconnected the opamp's output from the rest of the circuit?
Title: Re: current sense with LM324D
Post by: bogdant on May 18, 2020, 01:21:05 pm
Connect pin 11 to a slight negative supply, or connect a pull-down resistor from the output pin(s) to a negative supply.

The latter is probably the better option, as to bias the output stage into class A conduction.  LM324 is a terrible opamp, with enough distortion to be noticeable even in control applications such as this.  It needs all the help it can get (like by biasing the output).

Speaking of bad things being bad, and component paranoia -- mind that even the lowly 324 can and will be counterfeited by cheap suppliers.  You might get salvaged parts, you might get dust, you might get something unexpectedly much better -- who knows?  The same goes for every semiconductor; buy from authorized distributors if possible.

Tim
I do not have in the project a negative rail, seems that I need it one, in the end. Any simple way to obtain this in my case ?
Title: Re: current sense with LM324D
Post by: bogdant on May 18, 2020, 01:26:37 pm
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.
https://github.com/bogdan-tirzioru/Powersupply/blob/master/factory/sampleB/Job2.PDF
Do you have any idea why is not working ?
According to TI's data sheet, their part has a 50uA current sink to ground so it should go very close to 0V so long as there is very little external pull-up current. With the PSUs output set to 5V, the pull-up current should only be 12uA from R4 and R10 .
With the PSUs output set to 0V there should be no pull-up current.
Have you disconnected the opamp's output from the rest of the circuit?
The 250mV is with the output disconected from the comparator and the micrcontroller measurement line. If I add them I have 500mV output for 0 current measured! I do not undestand, there are only inputs for other opamp. Any recomandation for an alternative solution for high side current. I search on INA variants but it has very large gain 25 as minim.
Title: Re: current sense with LM324D
Post by: StillTrying on May 18, 2020, 01:55:37 pm
The output of the differential amp will struggle to sink the ~70uA coming through R10 330k down to 0V - I think.

Other than a small -Ve voltage for the LM324's supply I can't think of an easy fix.

I do not have in the project a negative rail, seems that I need it one, in the end. Any simple way to obtain this in my case ?

It would help if you showed us the AC - DC rectification, a diode capacitor voltage inverter might do, just a -Ve volt or 2 would do if the LM324's already have +32V.
Title: Re: current sense with LM324D
Post by: Alti on May 20, 2020, 05:33:32 pm
Vcc = 32V => Uout = 0.5*32V= 16V, I do not have this value.
To make 16V out of 32V you can use voltage divider.
Remove R5 (330k) and put two 660k resistors in series. One end goes to 32V, the other to 0V (AGND in your schematic) and the middle of the divider to TP6. This will be a 330K tied to 16V source, instead of 330K tied to 0V that you have. Then the result is going to be:

Uout = 3.3*UR1 + 16V
Title: Re: current sense with LM324D
Post by: xavier60 on May 21, 2020, 01:27:48 am
I did a high side current measurement, a differential amplifier. But it measure 250mV with no load at all, Vcc = 32V, Vee =0; If I set the voltage to Vcc=25V still I have on the output 180mV.
https://github.com/bogdan-tirzioru/Powersupply/blob/master/factory/sampleB/Job2.PDF
Do you have any idea why is not working ?
According to TI's data sheet, their part has a 50uA current sink to ground so it should go very close to 0V so long as there is very little external pull-up current. With the PSUs output set to 5V, the pull-up current should only be 12uA from R4 and R10 .
With the PSUs output set to 0V there should be no pull-up current.
Have you disconnected the opamp's output from the rest of the circuit?
The 250mV is with the output disconected from the comparator and the micrcontroller measurement line. If I add them I have 500mV output for 0 current measured! I do not undestand, there are only inputs for other opamp. Any recomandation for an alternative solution for high side current. I search on INA variants but it has very large gain 25 as minim.
Although you didn't say what happens when the PSU output is 0V, it seems that the part you have is off spec, possible fake.
To be fully certain, I would test it on a bread-board setup,