I have a motor which drives a string connected to a load cell. I would like to implement a closed loop controller to control the load applied by the motor to the string.

Motor driving string connected to a load cell

How do I go about determining the required loop frequency in order to create a stable control system? Is it something like the Nyquist frequency, where the loop speed should be at least twice the highest frequency inherent in the mechanical system?

  • $\begingroup$ It would be beneficial for answers to focus on the practical OR the theoretical side of the question. Is this a pure theoretical question (where friction, sensor errors, motor biases etc are ignored)? The frequency of the controller would not be required to be higher than the sensor's validity range and would also be defined by the characteristics of the motor. $\endgroup$ Commented Jun 28, 2015 at 7:31

2 Answers 2


The loop frequency is a parameter that needs to be tuned just like your proportional, integral, and/or derivative terms. Varying it has a similar affect on your output as varying your other parameters. Too low a frequency and you'll never reach your desired steady state. Too high and the output will oscillate.

To determine the optimal loop frequency, you will first need to construct Bode plots from real world test or simulation data:

Bode plots concisely display all relevant frequency input and output information on two plots: amplitude ratio as a functions of frequency and phase shift as a function of frequency. The amplitude ratio plot is a log-log plot while the phase angle plot is a semilog (or log-linear) plot.

To construct a Bode plot, an engineer would have empirical data showing input and output values that vary as sinusoidal functions of time. For instance, there might be inlet temperature data that varies sinusoidally and the outlet temperature data that also varies sinusoidally.

The amplitude ratio, AR, is the ratio of the amplitude of the output sinusoidal curve divided by the amplitude of the input sinusoidal curve.

$$AR = \dfrac{outputamplitude}{inputamplitude}$$

To find the phase shift, the periods of the input and output sine curves need to be found. Recall that the period, P, is the length of time from one peak to the next.

$$P = \dfrac{1}{f} = \dfrac{2\pi}{\omega}$$ $$f = frequency$$ $$\omega = frequency(rad/sec)$$

AR vs. freq

phase vs. freq

Rules of Thumb when analyzing Bode plots

Generally speaking, a gain change shifts the amplitude ratio up or down, but does not affect the phase angle. A change in the time delay affects the phase angle, but not the amplitude ratio. For example, an increase in the time delay makes the phase shift more negative for any given frequency. A change in the time constant changes both the amplitude ratio and the phase angle. For example, an increase in the time constant will decrease the amplitude ratio and make the phase lag more negative at any given frequency.

Then you will need to determine the cross-over frequency:

The proportional term moves the magnitude of the frequency response of the open loop up or down and hence is used to set the cross-over frequency of the open loop. The cross-over frequency is the frequency at which the magnitude has a gain of 1 (or 0dB). This frequency is important as it is closely related to bandwidth of the closed loop response.

In an ideal system the proportional gain could be made (almost) infinitely large leading to an infinitely fast, yet still stable, closed loop. In practice that is not the case. Rather, two design rules of thumb come into play.

Firstly the sample rate of the digital hardware on which the controller is going to be executed needs to be considered. A typical rule of thumb is that the cross-over frequency should be set to be at least 10 times lower than the sample rate of the controller. Conceptually this ensures that the controller is running at a fast enough rate that it can adequately handle changes in the signal being controlled.

The second rule of thumb is related to the slope of the frequency response at the cross-over frequency. If the roll-off of the open-loop magnitude response at cross-over can be made to be close to -20dB/decade then the closed-loop bandwidth can be expected to be close to the cross-over frequency. Note that the integral and derivative terms, not just the proportional term, are used to control the slope at cross-over.

bode cross-over graph

(emphasis mine)

So the optimal control loop frequency should be around 10 times that of the cross-over frequency of your system's phase delay which can be obtained through empirical test data or, ideally, computer simulation.

  • $\begingroup$ Great answer, but I would use the term limit cycle rather than oscillation in this context, since it is more control theory specific. The important thing being Any small perturbation from the closed trajectory would cause the system to return to the limit cycle, making the system stick to the limit cycle. This differs from simple oscillation in that this undesirable situation doesn't decay on its own and is indeed actively perpetuated. $\endgroup$
    – Mark Booth
    Commented Oct 26, 2012 at 17:22
  • $\begingroup$ @MarkBooth I never studied control theory formally but rather fell into it when I got a job writing embedded software for motor controllers. I've never heard the term limit cycle before and the Wikipedia article on it is quite brief. The Wikipedia articles on PID Controllers and Control Theory both use the term oscillation but don't mention limit cycles. Could you point to some other references that discuss limit cycles in control theory specific context? I'm quite interested to learn more. $\endgroup$ Commented Oct 26, 2012 at 17:45
  • 1
    $\begingroup$ The statement that a too high loop frequency can make a system unstable is essentially wrong. The x10 the control bandwidth is a good rule of thumb but there's no downside to go higher (beyond cost). Obviously if your integrator does + every cycle then you may need to bring down your I term (e.g.). $\endgroup$
    – Guy Sirton
    Commented Jul 5, 2013 at 20:48
  • 1
    $\begingroup$ I've never heard the term "loop frequency" used for the sampling frequency of the loop before, yet that seems to be the usage here. Old analog loop-closers will think you mean the loop bandwidth (AKA loop closure frequency). $\endgroup$
    – TimWescott
    Commented Jul 8, 2013 at 4:41
  • 1
    $\begingroup$ Setting a high sample rate in a control loop will only cause noise problems (and not just from quantization) if there is a need for low-pass filtering in the loop that is somehow being met by lower-frequency sampling. This can always be dealt with by putting in explicit low-pass filters, should the situation warrant it. $\endgroup$
    – TimWescott
    Commented Jul 8, 2013 at 4:43

When the string isn't under tension you have a non-linear system (i.e. you're pushing on a rope) which may also make this harder to control. The stiffness of your string is going to limit your bandwidth. (The string acts as a low-pass filter, at least when it's under tension). I've actually worked a little on a similar setup and it was really hard to control.

Since you're sampling the sampling theorem absolutely applies and you must sample at least x2 the highest frequency in your input (either by increasing the sample rate or filtering the input before sampling or both) otherwise you'll get aliasing.

As Kyle points out the other factor is your desired control bandwidth. I concur with the rule of thumb that the loop should run at least ~x10 that frequency.

Both these conditions need to be met.

There's a pretty good discussion of this in Chapter 6: Sampling in closed loop control systems of Marten Derk van der Laan's (1995) dissertation Signal sampling techniques for data acquisition in process control:

Selection of sampling rates is an important issue. For economical reasons, sampling rates are kept as low as possible: A lower rate means that there is more time available for control algorithm execution, which can thereby be carried out on slower computers. Digitizing well behaved analog control systems can heavily affect system response. If sampling frequencies is too low, the systems may even become unstable. According to the Nyquist criterion, the sampling frequency should at least be twice as high as the bandwidth of the error signal. This bandwidth is bounded by the system bandwidth, hence ws 2wB. However, in order to guarantee satisfactory response, a factor of 10 to 20 may be required

  • $\begingroup$ It is very dangerous to start appealing to the Nyquist theorem in a sampled-time control system. One ends up with all sorts of oddities, not least of which (and definitely undesirable in the majority of circumstances) is anti-aliasing filters inside the control loop. That cited paper is using an old approach to digital control loop design best suited for personnel who need to spend some time getting used to the z transform and direct design in sampled time. wescottdesign.com/articles/Sampling/sampling.pdf $\endgroup$
    – TimWescott
    Commented Jul 8, 2013 at 4:51
  • $\begingroup$ @TimWescott: Your paper looks very interesting. I'll read it in more detail. I agree that people misapply the theorem to the real world in variety of ways (and not only in a control setup). Nevertheless whenever you're sampling the theorem applies. I absolutely agree with what you say in your last paragraph of the "Finally" section. Intuitively the controller can never be better than the sampled error signal so you can prove that if you have aliasing no controller can take out that error. $\endgroup$
    – Guy Sirton
    Commented Jul 8, 2013 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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