1
\$\begingroup\$

So I am building a rather simple constant current load to test power supplies. I am using an INA138 for high-side current measurement with only 5V power (and I have reasons for that, unfortunately) and a couple of opamps to control the current through the Q1 mosfet. On the schematic, VCC is 5V power, CURSENSE is the voltage proportional to the current passing through the R1 resistor and Q1 mosfet and CONTROL is some voltage setting the constant current (e.g. DAC output or well-filtered PWM straight from a uC). The power input is on the left.

At first, I tried to simply put an opamp in a comparator mode. The schematic started oscillating and crashing in the simulation. Then I tried to lower the error amplifier gain to 100 V/V (second schematic). This schematic kinda works in the simulation, however, that raised a number of questions in my head.

  1. Since I've essentially created an analog PID controller with only proportional coefficient in the second schematic - do I need to implement a full-scale analog PID controller (like the one in this question) with an integrator and differentiator or will the second schematic be sufficient?
  2. When exactly (excluding cases with mechanical systems and such) do I need to implement a PID controller or lower the error amplification gain? For example, a simple opamp voltage follower is also essentially a controller that tries to set it's output voltage equal to the input one and somehow it is fine without PID or gain reducement.
  3. If I only need to lower the gain - how should it be selected?
  4. What could be the requirements for the error amplifier opamp?

enter image description here enter image description here

\$\endgroup\$
  • \$\begingroup\$ An op-amp is dominant-pole compensated, and will be stable for any resistive gain you choose. However, in your first circuit you have an additional gain from Q1, raising your overall open-loop gain and causing you instability. In your second circuit you lowered the gain restoring stability, but if the overall open loop gain is too high you will still suffer from poor phase margin. If so, you can reduce the gain further, or add some phase compensation. You don't need to add amplifiers for integral and derivative terms, a simple lead-lag compensator should work. \$\endgroup\$ – John D Apr 12 '19 at 15:27
  • \$\begingroup\$ The response of your current sense amp will come into play as well, adding phase shift to your loop. You should probably sketch out the bode plot of the open loop, and see what kind of compensation you need to get your target phase margin. \$\endgroup\$ – John D Apr 12 '19 at 15:44
0
\$\begingroup\$

Since I've essentially created an analog PID controller with only proportional coefficient in the second schematic - do I need to implement a full-scale analog PID controller (like the one in this question) with an integrator and differentiator or will the second schematic be sufficient?

If you don't need to adjust the I or D component, then don't include them. Many controllers are only PI controllers. The question is, "what do you need to be adjustable?", and "what controller is suitable for the final design?". No two components are created equal, if component tolerances affect the operation of the controller (which they almost always do) then you'll most likely need to adjust the gain. If the pole is changing with component tolerances then it might be wise to include I to compensate for changes in frequency.

The best thing to do would be to include the full PID controller for testing, and then reduce it to a bare minimum for production.

If I only need to lower the gain - how should it be selected?

Either by trial and error, preferably with a variable resistor or by actually calculating what the gain should be with a controller/plant model and by using control theory.

When exactly (excluding cases with mechanical systems and such) do I need to implement a PID controller or lower the error amplification gain? For example, a simple opamp voltage follower is also essentially a controller that tries to set it's output voltage equal to the input one and somehow it is fine without PID or gain reducement.

The feedback path of a simple voltage follower has a gain of 1, and the plant has a gain of 1 which makes it a stable system. The problem with control systems is they go unstable when the phase on any given frequency reaches -180, then you get positive feedback.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.