Electronics > Projects, Designs, and Technical Stuff

Simple constant current with op-amp, oscillating at very low currents

(1/4) > >>

I'm trying to make a simple current injector to calibrate DMMs, the idea is to connect the reference and testing ammeters in series.
I don't need a reference standard, just something that doesn't drift like crazy depending on temperature or voltage changes, so if I set it to 99.8mA it won't slowly drift to 110mA as it heats up while I'm adjusting the trimmers.
A TL431 should do a pretty nice job here, it worked as expected in the 20-500mA range, then I though it would be nice to add a second range to provide 0-1mA for the micro amps.

So I simply amplified the shunt voltage by ~500 using the second op-amp in the LM358.

Made this circuit in a small board, taking care of grounding loops and current voltage drops, with heavy ground and all that (sorry no pictures).

Sadly this gave me nasty oscillations, I guess the loop gain is too high or/and the loop itself might cause phase reversal?

Dont hesitate to correct me and call this design absolute trash, changes I'm very wrong with this are huge, I'm not an expert in analog (Nor in anything  :D)

Tried adding caps in several places, best I got was a slow sawtooth ripple of 50-200Hz.

Later I got the simulator to produce the same spikes by toggling the switch several times until it started oscillating. (Sorry, cropped the image and realized later, it's about 20KHz)

How to improve this? Or better just trash it and simply use the TL431 output with different resistors to output 50-100-200-500-1000uA?

Does your low current range work at all? Or does it just oscillate at the low end of the range?

A gain of 500 is asking a lot for the LM358. The offset voltage can be up to 7mV, which which is an output of up to +/-3.5V. If this is causing the opamp to saturate it could be causing some non-linear effects that lead to oscillation.

In addition to the offset voltage of the LM358, some people report issues using the LM358 for control loops because of hysteresis in the output due to crossover distortion. Thats another non-linear effect that is hard to model.

If the oscillation is due to a poor phase margin that can be modeled with small signal analysis you can simulate it in LTSpice and its a bit easier to discuss. For a feedback system to be stable you want to have only one pole before your crossover frequency. The current amplifier is adding another pole at ~700KHz GBP/500 gain = 1.4 kHz, which is going to be before the crossover frequency.

From a control loop perspective you need to add one or more zeros to null the added poles from the additional amplifier. And possibly change your loop gain.
I would have to model the system to be sure about the frequency and implementation, but I think you should be able to stabilize it by adding a resistor between the switch and pin 2 of the LM358 and adding a capacitor from pin 1 to pin 2. This will bypass the added amplifier at high frequency, eliminating its effect on the phase margin at crossover. You effectively just have a single op-amp in the unity gain configuration, which should be stable.

You also might be able to stabilize it with some combination of increasing R1 to reduce loop gain and a capacitor across R7 to add a zero and cancel the first pole of the current amplifier.

You have a heck of a lot of gain your loop, and I doubt if you'll ever get it stable.
Even "simple" current sinks can give problems with this.
It would be nice if your plot includes labels, It's impossible to interpret.

Tried lots of caps, still getting oscillations, the larger the cap the lower it is,but still there.
Any other op-amp better for this job? I have a pretty big inventory of - everything, as it's a fab, I'm allowed to steal few parts from time to time (Pick'n place machines drop few anyways).

Ditch the second x500 OPAMP and switch in a second 500 ohm shunt using a DPDT switch, one pole to switch the shunt and the other to switch the sense connection so it doesn't 'see' the voltage drop across the switch ON resistance.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod