0% found this document useful (0 votes)
29 views15 pages

Lab Report 3 Speed Control

This laboratory report investigates the implementation of P, PI, and PID control strategies for regulating the speed of a DC motor at 4 rpm using an Arduino system. The study evaluates the performance of each controller based on ramp-up time, control deviation, overshoot, and stability, revealing that adding integral and derivative terms enhances accuracy and response dynamics. Results indicate that while increasing proportional gain improves speed control, it can also lead to instability if not properly tuned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views15 pages

Lab Report 3 Speed Control

This laboratory report investigates the implementation of P, PI, and PID control strategies for regulating the speed of a DC motor at 4 rpm using an Arduino system. The study evaluates the performance of each controller based on ramp-up time, control deviation, overshoot, and stability, revealing that adding integral and derivative terms enhances accuracy and response dynamics. Results indicate that while increasing proportional gain improves speed control, it can also lead to instability if not properly tuned.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

LABORATORY REPORT

Degree Program: Master IT


Course: Sensor-/Actor Systems & Control Theory

SPEED CONTROL

By: Joan Ferreres Expósito, Matías Molina Fernández-Murga, Josip Rotjtinic


Student Number: mb24x322, ee24x006, tm24x502

Supervisor: Kollmitzer Christian

Place, Date 27/05/2025


ABSTRACT
This laboratory experiment explores the implementation and comparison of P, PI, and PID control
strategies for regulating the speed of a DC motor using an Arduino-based system. The target speed was
set at 4 rpm, with controller parameters determined from theoretical calculations. The performance of
each controller was assessed based on ramp-up time, control deviation, overshoot, PWM behavior, and
sensor feedback. The results were then compared against theoretical predictions and simulations to
evaluate the controllers' effectiveness. The study highlights how the addition of integral and derivative
terms improves accuracy, stability, and response dynamics in closed-loop control systems.
Table of Contents
1 AIM OF THE EXERCISE ........................................................................................... 4

2 THEORICAL BACKGROUND ................................................................................... 4


2.1 Proportional Controller .............................................................................................. 4
2.2 Proportional-Integral Controller ................................................................................ 4
2.3 Proportional-Integral-Derivative Controller ............................................................... 4
2.4 Poles & Zeros Control System ................................................................................. 5

3 TEST SET UP ............................................................................................................5


3.1 Hardware Component .............................................................................................. 5
3.2 Software Components .............................................................................................. 5

4 TEST PROCEDURE ...................................................................................................5

5 RESULTS & COMPARATION(Simulation & Arduino) ................................................ 6


5.1 Control circuit ............................................................................................................6
5.2 Proportional Controller .............................................................................................. 6
5.2.1 Kp (20) ......................................................................................................................6
5.2.2 Kp (40) ......................................................................................................................7
5.2.3 Kp (60) ......................................................................................................................7
5.2.4 Conclusion Table ......................................................................................................8
5.3 Proportional–Integral Controller ................................................................................ 8
5.3.1 Calculations Ki ..........................................................................................................8
5.3.2 Kp (20) Ki (77) ..........................................................................................................9
5.3.3 Kp (40) Ki (154) ......................................................................................................10
5.3.4 Kp (60) Ki (230) ......................................................................................................10
5.3.5 Conclusion Table ....................................................................................................11
5.4 Proportional-Integral-Derivative Controller ............................................................. 11
5.4.1 Conclusion Table ....................................................................................................13

6 List of Images ...........................................................................................................14

7 List of tables .............................................................................................................14

8 Bibliography .............................................................................................................14

3
1 AIM OF THE EXERCISE
The aim is to analyze and compare the performance of P, PI, and PID controllers in maintaining a motor
speed of 4 rpm, using Arduino for implementation and Simulink for simulation. The goal is to evaluate
control quality and dynamic behavior in both simulated and real environments.

2 THEORICAL BACKGROUND
2.1 Proportional Controller
The Proportional controller modifies the control signal in direct proportion to the current error between
the desired setpoint and the actual process variable. A larger error results in a bigger error signal and
hence a larger corrective effort or control signal. It can reduce an error but often not to zero, resulting in
steady-state error.
Its transfer fucnton is:

2.2 Proportional-Integral Controller


A PI controller applies a proportional term with an integral term that adds up the error over time. This
allows for the error, or steady-state error, to be eliminated, something that a P controller is unable to do.
A downside to the integral action is that it may lead to overshoot and slow the system down.
Thats why, the transfer fucntion of a PI controller is:

2.3 Proportional-Integral-Derivative Controller


A PID controller is basically a PI controller with a derivative term added to it. A derivative term will
predict how the system responds based on the magnitude of the error, which is the time-rate-of-change
of the error. By combining these terms, we can stabilize the system and improve its transient response
characteristics. A well-tuned PID controller will minimize the overshoot and settling time, and provide
an overall response that is somewhat balanced and responsive.
Its transfer funciton is:

4
2.4 Poles & Zeros Control System
In control systems, the dynamic behavior of a system is defined by the poles and zeros.

• Zeros: They are the values of 𝑠𝑠 that make the transfer function equal to zero in the
Laplace domain. Zeros affect the transient response, specifically how the output
responds to inputs. Zeros can create a response with peaks or dips.

• Poles: They are the values of 𝑠𝑠 that make the transfer function go to infinity. Poles
determine the dynamic characteristics of the system such as stability, speed of
response, oscillations and damping.

3 TEST SET UP
3.1 Hardware Component
• Arduino Uno
• DC Motor with Encoder
• Motor Driver
• Power Supply
• Breadboard and Wiring
• PC with USB connection.
3.2 Software Components
• Arduino IDE
• MATLAB/Simulink
• Simulink Support Package for Arduino

4 TEST PROCEDURE
 Configure the Arduino with each control strategy: P, PI, and PID.
 Set the nominal speed to 4 rpm in all cases.
 Run the motor and record the system response for each controller:
• Ramp-up time
• Control deviation
• Overshoot
• PWM signal behavior
• Log and analyze the time-domain response for step input

5
5 RESULTS & COMPARATION(Simulation & Arduino)
5.1 Control circuit

Image 1 (Control Circuit)


5.2 Proportional Controller
In the initial phase of the experiment, a Proportional (P) controller was implemented to regulate the
speed of a DC motor using an Arduino-based system. The primary objective was to assess how varying
the proportional gain (Kp) influences the system's performance in maintaining a target speed of 4 rpm.
We use 3 different parameters for Kp.
5.2.1 Kp (20)

Image2 (Kp = 20 , Red line: Simulink & Yellow line Arduino Outputs)
Observations
- Ramp-up: Longer, resulting in a slower approach to the target speed.
- Steady-State-Error: Present, as the system does not fully reach the setpoint.
- Overshoot: None, leading to a smooth response.
- Stability: High, with no oscillations observed.

6
5.2.2 Kp (40)

Image2 (Kp = 40 , Red line: Simulink & Yellow line Arduino Outputs)
Observations
- Ramp-up: Faster than Kp 20, but quite slow.
- Steady-State-Error: Present, as the system does not fully reach the setpoint.
- Overshoot: A small overshoot. .
- Stability: High, with no oscillations observed.
5.2.3 Kp (60)

Image 4 (Kp = 60, Red line: Simulink & Yellow line Arduino, Outputs)
Observations
- Ramp-Up Time: Significantly reduced, leading to a rapid approach to the target speed.
- Steady-State Error: Minimal, as the higher gain effectively reduces the discrepancy
between the setpoint and the actual speed.
- Overshoot: Noticeable, with the system exceeding the target speed before stabilizing.
- Stability: Slight oscillations observed, indicating a tendency toward instability at higher gain
values

7
5.2.4 Conclusion Table
Simulation with Simulink
Overshoot
Kp Tm (ms) Output (V) Error % Resolution (V)
20 179 1,83 54,25 80 -
40 119 2,5 37,5 160 2,69
60 100 2,85 28,75 240 3,286
Table 1 (Simulink values P controller)
Measurements Arduino
Overshoot
Kp Tm (ms) Output (V) Error % Resolution (V)
20 140 1,58 60,5 80 -
40 103 2,33 41,75 160 3,15
60 100 2,74 31,5 240 4,387
Table 2 (Arduino values P controller)

The data includes simulation results and measurement data from Arduino. As the proportional gain (Kp)
increases, the steady state error diminishes; therefore a measure of improvement. But as there is a
measurable improvement, the overshoot & oscillations are also getting larger and larger thus decreasing
the settling time (Ts). These patterns reaffirm the theory of control. The larger the value of Kp the faster
it will respond, but if mis-tuned, it can lead to poor stability.
5.3 Proportional–Integral Controller
In the next step of the experiment, a Proportional-Integral (PI) controller was implemented to control
the speed of a DC motor using an Arduino platform. The main goal was to test the relationship of
proportional gain (Kp) and integral gain (Ki) on the system performance to maintain the target speed of
4 rpm overall.
5.3.1 Calculations Ki
In order to calculate all the elements we need, we must consider the transfer functions of the plant and
the noise reduction filter. This results in us deriving the transfer function for the overall system.
0,041 1
𝐶𝐶 (𝑠𝑠)𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 = 𝐶𝐶 (𝑠𝑠)𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 =
0,06 ∗ 𝑠𝑠 + 1 0,2 ∗ 𝑠𝑠 + 1
0,041
𝐶𝐶 (𝑠𝑠)𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 ∗ 𝐶𝐶 (𝑠𝑠)𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 =
0,26 ∗ 𝑠𝑠 + 1
From this transfer function, we can find the poles of the system by zeroing the denominator and find out
the complex frequency variable 𝑠𝑠. This is an effort to understand the system's stability and dynamic
response.
1
0,26 ∗ 𝑠𝑠 + 1 = 0 → 𝑠𝑠 = − = −3,846153
0,26
Once the pole(s) are identified, we can relate them to the controller parameters. For a PI controller, the
characteristic equation typically takes the form:

8
𝐾𝐾𝐾𝐾
0 = 𝐾𝐾𝐾𝐾 + = 𝐾𝐾𝐾𝐾 ∗ 𝑠𝑠 + 𝐾𝐾𝐾𝐾
𝑠𝑠
By substituting the previously calculated value of sss into this equation, we can solve for the integral
gain Ki corresponding to a given proportional gain Kp.
−𝐾𝐾𝐾𝐾 = 𝐾𝐾𝐾𝐾 ∗ 𝑠𝑠 = 𝐾𝐾𝐾𝐾 ∗ −3,846153
After doing these calculations, we have the next values of Ki, for each Kp.

Calculation of Ki
Kp S Ki
20 -3,84615385 76,9230769
40 -3,84615385 153,846154
60 -3,84615385 230,769231
Table 3 (Values of Ki)
5.3.2 Kp (20) Ki (77)

Image 5 (Kp = 20, Ki = 77, Red line: Simulink & Yellow line Arduino, Outputs)
Observations
 Ramp-Up Time: The system exhibits a moderate ramp-up time, reaching the target speed of 4 rpm
more swiftly than with a P controller alone.
 Steady-State Error: Effectively eliminated due to the integral action, ensuring accurate speed
maintenance.
 Overshoot: No overshoot is observed.
 Stability: The system remains stable with minimal oscillations, demonstrating effective damping.

9
5.3.3 Kp (40) Ki (154)

Image 6 (Kp = 40, Ki = 154, Red line: Simulink & Yellow line Arduino, Outputs)

 Ramp-Up Time: The system reaches the target speed of 4 rpm more quickly compared to the
configuration with Kp = 20, indicating improved responsiveness.
 Steady-State Error: Effectively eliminated due to the integral action, ensuring precise speed
maintenance.
 Overshoot: A slight overshoot is observed, which is typical when increasing the proportional gain in
a PI controller.
 Stability: The system remains stable with minimal oscillations, demonstrating effective damping.

5.3.4 Kp (60) Ki (230)

Image 7 (Kp = 60, Ki = 230, Red line: Simulink & Yellow line Arduino, Outputs)

10
Observations
 Ramp-Up Time: The system achieves the target speed of 4 rpm rapidly, indicating a swift response
due to the higher proportional gain.
 Steady-State Error: Effectively eliminated, as the integral component corrects any residual error
over time.
 Overshoot: A big overshoot is observed, which is typical when both Kp and Ki are increased.
 Stability: The system exhibits some oscillations before settling, suggesting that the higher gains may
be pushing the system toward the edge of stability.
5.3.5 Conclusion Table
Simulation with Simulink
Overshoot
Ki Kp Tm(ms) Output (V) Error % Resolution (V)
77 20 300 4 0 80 -
154 40 160 4 0 160 4,066
230 60 140 4 0 240 4,55
Table 4 (Simulink values PI controller)
Measurements Arduino
Overshoot
Ki Kp Tm(ms) Output (V) Error Resolution (V)
77 20 320 4 0 80 -
154 40 140 4 0 160 4,133
230 60 120 4 0 240 5,42
Table 5 (Arduino values PI controller)
With the increment of proportional gain (Kp) in a PI controller, Kp and Ki will also be incremented.
This helps remove steady-state error, since the integral action will eventually remove it. However, there
are tradeoffs. In particular, while the settling time (Tm) is less, so the system responds faster, the
overshoot will increase. This will result in a greater frequency and overshoot will eventually result in a
loss of stability.
5.4 Proportional-Integral-Derivative Controller
In order to obtain the correct PID controller gains for our system, we first observe that the DC motor is
a second order system, i.e. PT2 (the transfer function takes the following form):
K
C(s) = 2
T∗s +T∗s+1
In light of this, we continue designing the PID controller using the PID Tuner tool in Simulink, which
automatically tunes the PID gains to optimize both performance and robustness.
Setting the proportional gain 𝐾𝐾𝐾𝐾 to 60 or close to 60, the PID Tuner calculates the derivative gain 𝐾𝐾𝐾𝐾
and integral gain 𝐾𝐾𝐾𝐾 that are best suited to the system dynamics. The controller parameters are as follows:

11
Image 8 (Controller parameters and measurements values, PID)

Image 9 (Graph response of PID controller)


After analyzing the control parameters, we can simulate the system's response in Simulink and observe
the actual performance on the Arduino hardware.

Image 10 (Kp = 58,36, Ki = 352,75 Kd = 2,35, Red line: Simulink & Yellow line Arduino, Outputs)

12
Observations
 Ramp-Up Time: The system reaches the target speed of 4 rpm swiftly, indicating a fast response
time.
 Steady-State Error: The steady-state error is effectively eliminated, maintaining the target speed
without deviation.
 Overshoot: A moderate overshoot is observed, where the system exceeds the target speed before
settling.
 Stability: The system exhibits minimal oscillations and maintains stability throughout the operation.

5.4.1 Conclusion Table


Overshoot
Kp Ki Kd Output (V) Resolution (V) Tm (ms)
58,36 351, 75 2,35 4 25 4,97 119
58,36 351, 75 2,35 4 25 4,78 140
Table 6(First line Arduino values, second line Simulink values)

In this comparison between results from a physical implementation with Arduino and a simulation in
Simulink, we found some key differences in performance with identical PID controller, (Kp = 58.36; Ki
= 351.75; Kd = 2.35)
The overshoot was slightly higher from the Arduino (4.97 V) in comparison to Simulink (4.78 V),
suggestive that the real system is more sensitive or less damped. The settling time (Tm) was less from
the Arduino (119 ms) compared to Simulink (140 ms), suggestive that the response time in the physical
system is faster, possibly the result of unmodeled dynamics.

13
6 List of Images
- Image 1 (Control Circuit)
- Image 2 (Kp = 20 , Red line: Simulink & Yellow line Arduino Outputs)
- Image 3 (Kp = 40 , Red line: Simulink & Yellow line Arduino Outputs)
- Image 4 (Kp = 60 , Red line: Simulink & Yellow line Arduino Outputs)
- Image 5 (Kp = 20, Ki = 77, Red line: Simulink & Yellow line Arduino Outputs)
- Image 6 (Kp = 40, Ki = 154, Red line: Simulink & Yellow line Arduino Outputs)
- Image 7 (Kp = 60, Ki = 230, Red line: Simulink & Yellow line Arduino Outputs)
- Image 8 (Controller parameters and measurements values, PID)
- Image 9 (Graph response of PID controller)
- Image 10 (Kp = 58,36, Ki = 352,75 Kd = 2,35, Red line: Simulink & Yellow line Arduino,
Outputs)

7 List of tables
- Table 1 (Simulink values P controller)
- Table 2 (Arduino values P controller)
- Table 3 (Values of Ki)
- Table 4 (Simulink values PI controller)
- Table 5 (Arduino values PI controller)
- Table 6 (First line Arduino values, second line Simulink values)

8 Bibliography

• LibreTexts, 2023. System Poles and Zeros. [online] Available at:


https://espanol.libretexts.org/Ingenieria/Ingenieria_Industrial_y_de_Sistemas/Libro%3A_Intro
ducci%C3%B3n_a_los_Sistemas_de_Control_(Iqbal)/02%3A_Modelos_de_funci%C3%B3n_
de_transferencia/2.01%3A_Polos_y_ceros_del_sistema [Accessed 17 May 2025].

• Universidad Don Bosco (UDB), 2019. Guide 4 – Automatic Control Systems. [online]
Available at: https://www.udb.edu.sv/udb_files/recursos_guias/electronica-
ingenieria/sistemas-de-control-automatico/2019/ii/guia-4.pdf [Accessed 17 May 2025].

• Control Systems Lectures, 2020. Poles and Zeros - Control Systems. [video online]
YouTube. Available at: https://www.youtube.com/watch?v=l4qCBo13syE [Accessed 17 May
2025].

• Douglas, B., 2012. Poles and Zeros - Control System Lectures. [video online] YouTube.
Available at: https://www.youtube.com/watch?v=4uJMynhjx5g [Accessed 17 May 2025].

14
15

You might also like