Question on speed control for treadmill application - Page 1
Forum section: electronics / projects

author: XaviPacheco
author_rank: Regular Contributor
timestamp: October 26, 2018, 01:37:23 am
content: I'm building a DC motor controller for a treadmill application using PWM. So far, the hardware works okay in open loop. I mean, I can control the duty cycle with the microcontroller. The motor responds really fast to step changes, which is not so desirable in this app. The commands given to the treadmill are Start, Stop, Speed up and Speed down. However, I don't have a special controller for this. The idea is to have a controller which increases/decreases the speed smoothly and mantain the speed under load conditions. I need some advice. Does a PI/PD/PID controller is critical for this? How do I effectively design one for this specific application? I believe I have to adjust the response time in order to have a smooth control and not to change speed abruptly. I'm measuring RPM of the motor, which is the closed loop element.

author: jbb
author_rank: Super Contributor
timestamp: October 26, 2018, 09:31:48 am
content: DC motor speed control is a classic.Are you using a microcontroller for the control?The typical strategy is to use a fast 'inner' control loop to control the motor current. A slower 'outer' control loop then adjusts the motor current reference to get the desired speed.The inner current control loop sets torque. Limiting the current reference gets you torque limiting and (to a large extent) overload protection. Theelectricalspeed of the system is quite fast (some ms), so you probably aren't after the maximum possible bandwidth.I would suggest a PI (Proportional + Integral) controller for motor current. I would recommendagainstPID (PI + Derivative) here, because the derivative term actually turns out to be a high pass filter and sensitive to noise. There will be noise aplenty given the switching action. A simple P (Proportional only) controller may be sufficient - you probably don't care if the torque isn't perfectly controlled.To get a constant speed, we use a speed control loop. It runs slower than the current control loop because the motor (and belt) has inertia to deal with - typically 10s to 100s of ms. Because you do care about true speed, I suggest a PI controller. The Integral action results in accurate speed tracking (after some settling time). You will need some kind of limiting on the integrator state value to preventwindup.To prevent sudden changes in speed, the trick is to use a rate limiter for the speed reference. That is to say, your master speed setting from the UI should be turned into a real speed limit which doesn't change very quickly.So the signal path might look like:Speed ref => Rate Limiter => + => Speed Controller => Current reference => + => Current controller => PWM duty- -^ ^| |Measured speed Measured CurrentI haven't reviewed the material, but a little bird tells me thatthese course videosmight be useful. Well, at least the Motion Control bit might be useful.

author: XaviPacheco
author_rank: Regular Contributor
timestamp: October 27, 2018, 01:19:44 am
content: Thank you. Yes, I'm using a microcontroller.Quote from: jbb on October 26, 2018, 09:31:48 amIs it like adjusting the response time of the controller with the proportional term?

author: jbb
author_rank: Super Contributor
timestamp: October 27, 2018, 06:44:57 am
content: Quote from: XaviPacheco on October 27, 2018, 01:19:44 amNot exactly. Generally, the PI controller is tuned for 'best' dynamic response (for assorted values of 'best'). You want a good dynamic response so that changes in mechanical load (e.g. footsteps on the belt) don't change the speed too much.But...If you start at zero speed, and suddenly try to spin up to running speed (say 20 km/h tops), the treadmill will start really aggressively - see first image. So the trick here is to modify the speed referencebeforeyou send it to the speed controller. This gives a gentler start - see second image - without changing the true dynamic response of the system.