# How to implement a closed loop control circuit for slow process?

Given a slow process Vout = Process(Vcontr) which takes a control voltage Vcontr and produces an output voltage Vout but with some lag of the order of one second.

I am looking for a good way to implement a closed loop control circuit for setting Vout to a target voltage Vtarget.

My starting point is a circuit as follows:

• op amp
• inputs: Vout and Vtarget
• output: connected to Vcontr-input of the slow process but with a capacitor shunted to ground to slow the rise time (or alternatively some analogue filter?)

Is there a better way to do this? How should I setup the feedback for the op amp?

• For help with servo design (rather than implementation), considering asking at dsp.stackexchange.com . – nibot Mar 30 '12 at 9:29

You can do this entirely with analogue components if you want. First, decide how fast and how perfect you really need the control to be. If you don't care if it takes several seconds to reach the target, then you can perform the control with a simple I (integrator) controller.

It works like this:

• Use a capacitor to hold the Vcontr voltage.
• Use an amplifier (make sure it has push-pull output) to measure the error between the voltage error.
• Set up the amplifier so that it charges the capacitor when the error is negative, and discharges the capacitor when the error is positive. (Or vice versa).

You can adjust the speed at which the controller operates by changing the size of the capacitor, or the resistor that feeds it.

• You should show how you control the amplifier gain. You have drawn a normal op-amp and an integrator. Integrator phase shift + slow plant with 1-second lag + high gain from op amp = guaranteed oscillator. – markrages Mar 29 '12 at 23:53
• You're right, I should have taken the time to add some feedback to reduce the gain. – Rocketmagnet Mar 30 '12 at 0:09
• Actually, would it still oscillate if the RC time constant is much larger than the plant propagation delay? – Rocketmagnet Mar 30 '12 at 0:20
• Is this better ? – Rocketmagnet Mar 30 '12 at 0:42
• If you get phase shift of 180 degrees and a gain of 1 or more at some frequency the loop will oscillate at that frequency. Loop gain will obviously depend on the plant characteristics. – markrages Mar 30 '12 at 2:26

Is there a better way to do this? Yes, do it digitally. You can eventually get something stable with analog parts, but it will be easier to do and a lot easier to tweak if done digitally. Then you also don't have problems of drift, leakage current issues with long time constants, temperature dependence, etc.

You can start with a simple PI controller in firmware. That's a PID controller with the D term zero. There are other, perhaps better, control schemes, but PI will be simple to implement and there is MUCH information out there about it. So much that there is no need to go into details here. Look for "PID controller" and you will find lots more than you can read in your lifetime. You can always come back here if you have specific implementation questions.

Given the very slow response of your system, any microcontroller with a A/D can do this job. Conceptually you need a D/A to produce Vcontr, but that can be done by low pass filtering a PWM output, which is a very common thing for microcontrollers to have. Perhaps your system can even be controlled directly by pulses, in which case using PWM directly will be more efficient and eliminates the step of converting it to a analog voltage.

• Thanks Olin. I was considering this but have shied away so far as I have no experience at all working with micro-controllers. I thought an analogue solution would be far quicker to implement and require less know-how... – ARF Mar 29 '12 at 19:10