LINUSBot - Line Follower Robot - With PID Control
by BIGDOG1971 in Circuits > Microcontrollers
31309 Views, 17 Favorites, 0 Comments
LINUSBot - Line Follower Robot - With PID Control
LINUSBot - PID Control
This is a supplement to the first "instructables" of the LINUSBot (line following robot).
Now the robot has movement control done by a PID controller, control Proportional, Integral and Derivative. This makes the movements at the bends much smoother and during the straights, it can develop faster, reaching maximum speed.
PID control provides the robot a "learning", causing the robot to develop better cornering and straight circuit.
Now, a brief introduction and overview of PID control.
Basically, this type of controller performs the following actions:
1 - Proportional Control:
This controler Multiplies the current "error" by a constant Kp.
The "error" is the difference between actual output and the desired output and is fed back into the system, ie:
The actual output is subtracted from the output desired (the set point), so the error is calculated. This error is inserted into the PID controller as input, and the PID controller (calculating the terms P, I and D), commands the system to eliminate this error.
Thus ensuring gain needed to get close to the desired output signal as fast as possible and with the best stability.
2 - Integral Control:
The term Integral multiplies the current error and its duration by a constant Ki, making a summation of all that information.
The Integral term when added to the proportional term; accelerates the process of reaching the steady state of the system, besides providing a signal closer to the desired output. In other words, it also eliminates (or at least try to eliminate) the residual error, arriving faster to the desired result.
3 - Derivative Control:
The Derivative term, causes the rate of change of the error signal be multiplied by a constant Kd. The intension is to predict the error and thus decrease the rate at which errors produces changes in the system.
We may use these three terms together to form a PID controller, or their variaçãoes such as:
P controller (sometimes used):
In this case the use of small values of the constant Kp is the best way of get to the desired value, but its control is slow (that it takes to get to the desired value). If you increase the value of Kp an overshot can occur.
PI controller (most commonly used):
It removes the residual portion of error in the steady-state case (improving transient response), but in this case you may have more overshoot and also inversion state, occurring system oscillation and causing instability, the system may be over-damped, or under-damped or oscillatory.
This type of control makes the system slower. Using larger values of Ki, you can leave the system faster, however, increases the overshoot and decrease the margin of stability of your system.
PD controller (rarely used):
Used to decrease the overshoot magnetude of the systems that uses integral controller and improve system stability. But Derivative controllers amplifies the noise error term and can leave the system process unstable. The PD controller decreases the time to reach the desired value considerably .... for that the derivative gain Kd should be high. This decreases the control time, but increases the bandwidth of the system, leaving the system susceptible to noise.
PID controller (sometimes used):
Using PID (combination of PI + PD), we can remove the system errors ratio and decrease the response time with a reasonable response transistória (without oscillations or instabilities).
This study can be found at:
http://www.youtube.com/watch?v=wbmEUi2p-nA
http://en.wikipedia.org/wiki/PID_controller
This is the basic way of implementing a PID via software:
previous_error = 0
integral = 0
start:
error = setpoint - measured_value
integral = integral + error*dt
derivative = (error - previous_error)/dt
output = Kp*error + Ki*integral + Kd*derivative
previous_error = error
wait(dt)
goto start
In the "LINUSBot" design was used the following parameters:
Kp = 1/20
Ki = 1/10000
Kd = 3/2
The complete code for Arduino can be downloaded from the link:
http://www.4shared.com/file/iPVAVCwy/LINUSBot_9_3pi_modelo_PID.html
Watch the video and check out the results.
See you in the next project.
Thank You
Others projects:
https://www.instructables.com/id/LINUSBot-Line-Follower-Robot/
https://www.instructables.com/id/Basic-Principles/
https://www.instructables.com/id/PINGBot-Explorer-Robot/
https://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/
https://www.instructables.com/id/3x3x3-LED-Cube-1/
This is a supplement to the first "instructables" of the LINUSBot (line following robot).
Now the robot has movement control done by a PID controller, control Proportional, Integral and Derivative. This makes the movements at the bends much smoother and during the straights, it can develop faster, reaching maximum speed.
PID control provides the robot a "learning", causing the robot to develop better cornering and straight circuit.
Now, a brief introduction and overview of PID control.
Basically, this type of controller performs the following actions:
1 - Proportional Control:
This controler Multiplies the current "error" by a constant Kp.
The "error" is the difference between actual output and the desired output and is fed back into the system, ie:
The actual output is subtracted from the output desired (the set point), so the error is calculated. This error is inserted into the PID controller as input, and the PID controller (calculating the terms P, I and D), commands the system to eliminate this error.
Thus ensuring gain needed to get close to the desired output signal as fast as possible and with the best stability.
2 - Integral Control:
The term Integral multiplies the current error and its duration by a constant Ki, making a summation of all that information.
The Integral term when added to the proportional term; accelerates the process of reaching the steady state of the system, besides providing a signal closer to the desired output. In other words, it also eliminates (or at least try to eliminate) the residual error, arriving faster to the desired result.
3 - Derivative Control:
The Derivative term, causes the rate of change of the error signal be multiplied by a constant Kd. The intension is to predict the error and thus decrease the rate at which errors produces changes in the system.
We may use these three terms together to form a PID controller, or their variaçãoes such as:
P controller (sometimes used):
In this case the use of small values of the constant Kp is the best way of get to the desired value, but its control is slow (that it takes to get to the desired value). If you increase the value of Kp an overshot can occur.
PI controller (most commonly used):
It removes the residual portion of error in the steady-state case (improving transient response), but in this case you may have more overshoot and also inversion state, occurring system oscillation and causing instability, the system may be over-damped, or under-damped or oscillatory.
This type of control makes the system slower. Using larger values of Ki, you can leave the system faster, however, increases the overshoot and decrease the margin of stability of your system.
PD controller (rarely used):
Used to decrease the overshoot magnetude of the systems that uses integral controller and improve system stability. But Derivative controllers amplifies the noise error term and can leave the system process unstable. The PD controller decreases the time to reach the desired value considerably .... for that the derivative gain Kd should be high. This decreases the control time, but increases the bandwidth of the system, leaving the system susceptible to noise.
PID controller (sometimes used):
Using PID (combination of PI + PD), we can remove the system errors ratio and decrease the response time with a reasonable response transistória (without oscillations or instabilities).
This study can be found at:
http://www.youtube.com/watch?v=wbmEUi2p-nA
http://en.wikipedia.org/wiki/PID_controller
This is the basic way of implementing a PID via software:
previous_error = 0
integral = 0
start:
error = setpoint - measured_value
integral = integral + error*dt
derivative = (error - previous_error)/dt
output = Kp*error + Ki*integral + Kd*derivative
previous_error = error
wait(dt)
goto start
In the "LINUSBot" design was used the following parameters:
Kp = 1/20
Ki = 1/10000
Kd = 3/2
The complete code for Arduino can be downloaded from the link:
http://www.4shared.com/file/iPVAVCwy/LINUSBot_9_3pi_modelo_PID.html
Watch the video and check out the results.
See you in the next project.
Thank You
Others projects:
https://www.instructables.com/id/LINUSBot-Line-Follower-Robot/
https://www.instructables.com/id/Basic-Principles/
https://www.instructables.com/id/PINGBot-Explorer-Robot/
https://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/
https://www.instructables.com/id/3x3x3-LED-Cube-1/