Electrical – Stabilising a constant current load opamp feedback loop

constant-currenthall-effectloadoperational-amplifierstability

I designed a constant current load around the ACS712 Hall-effect current sensor (module from eBay). This module gives a voltage output of 185mV/A superimposed on VCC/2. Its current range is +-5A altho I'm only interested in +I for this design. The schematic below shows the basics of the design.

schematic

simulate this circuit – Schematic created using CircuitLab
I had some trouble stabilising the feedback loop. The "error amp" (OA3) was open loop and gave a bang-bang output. The loop was unstable producing an oscillation in the 100's of Hz. Then I added C2 and increased the value of R13 to 100k. This reduced the oscillation to a great extent but there was still a low-level less than 100Hz oscillation producing a sawtooth gate drive on the MOSFET. After poking around adding bypass and roll-off caps to the opamps without much success I instinctively added C1, bypassing the "Gain Amp" OA2 and this completely cured the oscillation. My question is why did these changes kill the oscillations? I'm not the best at this kind of circuit design but my instincts led me in the right direction and I would like to understand why adding caps C1 and C2 made the difference. Also, do I have them in the right place or what other changes would you recommend to ensure stability.

I have not checked the impulse response of this loop nor how it behaves under dynamic conditions. I would appreciate some guidance on how to approach such tests.

Best Answer

Short answer: The closed loop has a resonance point, when you add the capacitor you are either flattening this point or eliminating it all together. It would be better to get spice out in a situation like this and get an idea (it won't be exact without the parasitics and it isn't worth the time to go through and find what they are on the board and model them). Once you have an idea, you can find ways to mitigate the problem. Or you could just add capacitors wherever and see if that fixes it.

http://dcontrolsystems.com/specifications/classical-specifications/closed-loop-frequency-response-specs/

It really depends on the system AND implementation. Sometimes board parasitics can make a difference. I've ran into a simmilar setup with a BJT for the current amplifier and the difference in the parasitics of a 10ohm resistor being cut and soldered on vs being soldered directly to a PCB with solder pads. The difference was nH's and pF's. Usually the oscillations are high frequency. The amplifiers can also cause problems since they have a cutoff and the mosfet usually has a higher frequency cutoff. If you don't do some kind of frequency analysis these problems will crop up more.