Module 04
Module 04
Sluice gates are important structures used in various water management and control sys-
tems for a variety of purposes such as Water Flow Control, Flood Control, Irrigation, Water
Reservoir Management, Navigation and Transportation, Hydropower Generation etc. In order
to operate the gates, motors are used. The speed at which the gates are to be opened or closed
are important in many applications. In this module, we want to control the speed at which the
sluice gate will operate. We will use a DC motor with encoder to replicate a motor used in sluice
gate. Note that the speed of rotation of motors is directly related to the input voltage. The
higher the input voltage, the higher will be the rotational speed of the motor. Of course, the
input voltage should not be more than the recommended operating voltage of the motor. Thus,
in order to control the speed of a DC motor, we will need to provide a variable voltage to the DC
motor. Usually, a pulse width modulation technique is used to generate a variable DC voltage
from constant DC voltage source. For more on this check: https://microcontrollerslab.com/dc-
motor-l293d-motor-driver-ic-arduino-tutorial/
Objectives:
3. Assuming that the maximum rpm of the motor is r at maximum rated voltage, we provide
the desired speed for motor using a DIP switch. As indicated in the table below, 4 different
reference speeds can be given using the DIP switch:
Display the desired rpm on the LCD, as well. The format to display the rpm is as follows:
The maximum rated voltage of the motor will be provided by the TA.
4. Design a PID controller to attain the desired rpm. While tuning the controller gains first
start with only proportional controller, i.e, keep KI = 0 and Kd = 0. Increase Kp and
check the output using serial port plotter of the IDE. Based on your requirement, whether
you want steady state or transient performance improvement change KI and Kd value.
1
Pre-lab work:
1. Read about controlling speed of a DC motor using PWM and L293D module.
(see https://microcontrollerslab.com/dc-motor-l293d-motor-driver-ic-arduino-tutorial/).
5. Observations, if any.
Snap shots of the serial monitor needs to be submitted with your observations. You
have to show how is the performance of the system effected for different values of
Kp , KI , and Kd .
– With KI = Kd = 0 and increasing Kp .
– With Kp = Kd = 0 and increasing KI .
– With Kp = KI = 0 and increasing Kd .
– Finally, with the tuned Kp , KI and Kd value.
Plot of the output from the encoder with and without the filter.
2. Why did you choose a closed-loop system for speed control? Could an open-loop system,
which involves simply providing the required PWM input to the motor to achieve the
desired RPM, be sufficient?
3. What is the value of r for the motor provided, and what is its maximum rated voltage?
4. How did you tune the controller gains? Did you use the Ziegler-Nichols Method? Provide
a justification for your approach.
6. What happens when you increase the value of Kp while keeping KI and Kd at zero?
Relate your observations to the root locus diagram you created earlier.
7. What type of filter did you use to clean the recorded data (e.g., high pass, low pass)?
Based on the encoder output plot, explain how the filter helped improve data quality.
2
OBSERVATION SHEET
This sheet needs to be attached to the report (print on both sides)
1. Demonstrate the interfacing of the motor and the LCD to the Arduino UNO. You should
be able to display the desired and current rpm on the LCD in the format provided.
2. Show the TA how the data from the encoder is cleaned using a filter. Provide screenshots
of the data before and after applying the filter to demonstrate the effect.
4. Demonstrate the effect of increasing Kp keeping KI and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of Kp .
3
5. Demonstrate the effect of increasing KI keeping Kp and Kd zero. Show the TA that you
have taken screenshots of the plot for various values of KI .
6. Demonstrate the effect of increasing Kd keeping Kp and KI zero. Show the TA that you
have taken screenshots of the plot for various values of Kd .
7. Demonstrate the tuned system to the TA, ensuring that the desired RPM matches the
actual speed after tuning. Note that once the controller is tuned, you cannot adjust the
controller gains. The TA will verify all four desired speeds and ensure that the system
reaches at least 95% of each desired speed. Additionally, the observation sheet should
include the settling band for the tuned system.