DC Motor Speed Control with Proportional Integral Derivative (PID) Control on the Prototype of a Mini-Submarine

— DC (Direct Current) motors are widely used as controllers in the industrial and robotics fields. In the rotation of the DC motor, there is still an unstable rotational speed so that a controller is needed to be able to stabilize the speed at the rotation of the DC motor. The control used in this study used the PID (Proportional Integral Derivative) control method. The PID control system works by processing calculations based on control variables 𝑲𝒑 , 𝑲𝒊 , and 𝑲𝒅 to achieve conditions according to the expected setpoints. To achieve the expected conditions, the trial and error method is used. PID control in this study was implemented on a DC motor with a brushed type using an Arduino Mega microcontroller. The speed of the DC motor is read by the encoder sensor and entered in the PID equation. The output of the PID value will produce data in the form of PWM (Pulse Width Modulation) which will be the input of the L298N driver via Arduino Mega. The DC motor will produce a rotational speed in the form of RPM (Revolution Per Minute) data up to the specified set point. The implementation of PID was produced by giving parameter values to 𝑲𝒑, 𝑲𝒊 , and 𝑲𝒅 . The best PID parameter usage in this study was in the form of 𝑲𝒑 = 0.6; 𝑲𝒊 =0.3; and 𝑲𝒅 =0.01. The application of the PID parameter obtains a stable system response curve at a predetermined set point. The resulting 𝑲𝒑 , 𝑲𝒊, and 𝑲𝒅 parameter data is used as graph data in MATLAB software


I. INTRODUCTION
The PID (Proportional Integral Derivative) controller is a conventional controller that is still widely used in the industrial world compared to more modern types of controls [1]. The linear squared regulator and predictive control model used for optimal control of DC motor speed were studied by Sahoo. In DC motor models, different control techniques are used to control the speed angle [2]. The technique of obtaining good precision angular position control of DC motors is directed using PID controllers. The implementation code is considered to produce PWM output using the PID (Proportional Integral Derivative) tuning algorithm. According to the PID tuning method, the error is not only solved but also brought to its minimum value by a very low number of error oscillations [3]. The Proportional Integral Derivative (PID) controller is one of the classic controllers popular in various applications. One of the challenges of the PID controller is to obtain optimal values from proportional, integral and derivative parameters [4]. PID (Proportional Integral Derivative) controllers have a wide range of applications, such as power generation, chemical processing, automated control, and industrial processes, although many other controllers are available. The demand for a PID controller arises from its simple but effective structure. However, the effectiveness of the PID controller depends on adjusting its parameters [5]. There are several PID tuning methods, including the Ziegler-Nichols method and the Fuzzy method. Most of these tuning methods require extensive knowledge of the control system. So there is a need for alternative tuning automation and practitioners who do not need in-depth control system knowledge [6]. The equation of output values in the PID control system can be formulated: Equation (1) explains that the output value of u(t) is the sum of proportional gain (Kp), integral gain (Ki) and gain derivative (Kd) which are affected by a certain error (e) and time (t) respectively. However, the uncertainty that exists, is nonlinear, and manually tuned parameters of a typical PI, PD, or PID controller make it difficult to determine the appropriate gain to achieve optimal performance of the system [7]. The PID controller has only three parameters, but it is not easy to find accurate values to achieve system stability. There are common trade-offs between the durability and performance of control systems [8].
The PID controller is responsible for correcting the error it receives from the difference between the input signal and the tachometer output signal, the corrected error enters the amplification stage before entering the plant [9]. The control parameters are set to achieve a stable closed-loop response of the system and reach the desired position within a certain time [10]. The proportional controller speeds up the ride time and increases the overshoot. The integral controller eliminates the fault of the stuck state and increases the overshoot. The derived control slightly reduces the overshoot. Overshoot is not a top priority setting for autonomous platform performance. But, what is used is the turnaround time and the resulting error [11].
DC motors are considered adjustable speed machines. The speed of the DC motor can be controlled over a wide range through proper adjustment of the terminal voltage proportional [12]. One method that is often used for controlling DC motors using microcontrollers is the Pulse Width Modulation (PWM) method. The speed of the electric motor depends on the modulator voltage. The greater the Qolil Ariyansyah, DC Motor Speed Control with PID Control (Proportional Integral Derivative) on The Prototype of a Mini-Submarine voltage, the faster the rotation of the electric motor [13]. When applying the PWM control method, keep in mind that using a DC motor as a low pass system. The PWM method is to avoid high frequencies and we know that large motors are mainly inductive so avoiding high frequencies, then it will not work well using high frequencies. This method works at low frequencies so lower frequencies are better than higher frequencies [14]. Early conventional approaches were used for PID controllers to control motor rotation for purposes requiring low accuracy such as trial and error and MATLAB tuner applications [15].

A. Research Instruments
The instruments in this study used an electronic system consisting of an encoder sensor, a DC motor driver, and an Arduino Mega microcontroller. While the actuator of the robot consists of a DC motor as the drive, and the robot driver, here is the explanation:  This microcontroller communicates serially by using a USB cable used specifically on the Arduino port to send programs from the Arduino IDE software.

L298N Driver
The rotation of the DC motor is controlled by using a microcontroller, but the current coming out of the microcontroller is very small to run the motor so an external circuit capable of running the motor is needed. Therefore the L298N IC is used as a driver circuit to run the motor based on the commands of the microcontroller [16]. L298N Driver show in Fig. 2. The module consists of an L298 motor driver IC and a 78M05 5V regulator. The L298N module can control up to 4 DC motors, or 2 DC motors with direction and speed control [17].

Encoder Sensor
A speed sensor (Rotary Encoder) is mounted on the roller belt to obtain accurate read speed. This sensor will transmit data on each PWM increase to accurately measure speed and control speed at the same time, based on set points. Encoder sensor show in Fig. 3.

Fig. 3. Encoder sensor
The mechanism is carried out a large measurement of RPM (Rotation Per Minute) from the propeller. To determine the performance of the rotary encoder, the rotary encoder was tested using an electric motor with variations in the input voltage and the rpm value of the rotary encoder was tested by measurement using a Tachometer [18].

DC Motor
A DC Electric Motor or DC motor is a device that converts electrical energy into kinetic or motion energy. Generally speaking, the torque generated by a DC motor is proportional to the anchor current and magnetic field strength [19]. DC Motor show in Fig. 4.

B. Block Diagram System
The system block diagram in the design of the minisubmarine system is used as an initial design such as the components used, system inputs and outputs, and the system work process in sequence. The block diagram system can be seen in Fig. 5. Mega is implemented as a microcontroller module to control and process data from input devices and then forward it to the output tool. The speed of the DC motor will be read by the encoder sensor and entered into the PID equation. The output of the PID value will produce data in the form of PWM (Pulse Width Modulation) which will be the input of the L298N driver via Arduino Mega. DC motors will produce angular velocities in the form of RPM data up to the specified set point. The RPM data on the serial monitor will be converted into a system response graph in the MATLAB software.

C. PID Control Block Diagram
PID control block diagram used to provide an overview of the input and output functions of the system. The PID controller consists of 3 elements, namely proportional parameters, integral parameters, and derivative parameters, all three of which are connected in parallel. All of them take error data as input. , , and are gains from parameters P, I, and D respectively [21]. Refers to the system response time domain with the calculation of error values. The P value refers to the current error, the I value refers to the previous accumulation of error and the D value based on the prediction of the error afterwards. The resulting error is given to the controller that gives the control signal as input to the PWM module to drive the DC motor [22]. Then, the output of the PID control is calculated by summing the results of the values P, I, and D multiplied by their respective errors.
This research will be used to search for the controlling constant experimentally (trial and error). The PID control block diagram can be seen in Fig. 6.

D. PID Control Flow Chart
The microcontroller system initializes the (set point) program to determine the value of the parameters , , , . The speed sensor (encoder) will read the speed of the motor which will then be reversed. Then there is a comparison between the read speed and the set point value, the comparison will produce an error value.
The result of the error value is used as the calculation of the PID control signal equation. The output of the equation will produce the PWM duty cycle value of the DC motor. If there is an error data or more than 0, it will produce a duty cycle value, the greater the error that occurs, the greater the duty cycle generated. The duty cycle on the PWM exit of the DC motor will produce output pulses from the PID controller which is used to divert the transistor on the DC motor driver. DC motors with PID control method can stabilize the system's response to changes in the input signal (set point) and minimize errors. The PID control flow chart can be seen in Fig. 7.

E. Wiring Diagram
Wiring diagram is the process of connecting one electronic component with another using a cable or on a PCB board (Printed Circuit Board). All components are recommended to be connected to the Arduino Mega microcontrollers. The system wiring diagram can be seen in Fig. 8. DC motor PID testing is carried out to obtain data from the system so that it can be known the working ability of the system that has been designed. To be able to produce PID data, it is necessary to design a hardware system such as Fig.  9.  75,125,175,225,250. The PWM value of the motor is given a PID control to obtain a stable voltage value. The L298N driver is directly connected with voltages from the adapter of 5V and 12 V DC. L298N driver test data can be seen in Table I. In this test, PWM values were given variably with values of 75, 125, 175, 225, and 250. The smaller the PWM value given, the driver will provide a low voltage to supply the DC motor.  Fig. 10. it shows that the smaller the PWM value given, the lower the rotational speed of the resulting motor. In this test, the motor speed produced was due to the influence of the PID controller, so as to get a different system response.

B. DC Motor Speed Calibration Testing
DC motor speed calibration testing is carried out with PID controllers. The test was carried out as many as 5 times with the PWM values used were 75, 125, 175, 225, and 250. After calibration testing, results such as Table II were obtained.
Calibration testing is carried out using the best PID controller which is 0.6; 0.3; 0.01. Calibration is carried out using the Tachometer tool to compare the error rate of calculation between the measuring instrument and the program on the system created.

C. Proportional Control Testing (P)
The proportional control (P) can be applied by multiplying the error value by the value of the control parameter P. The error value is generated from subtracting the set point value by the resulting RPM (Revolution Per Minute). Proportional control testing (P) show in Table III. Based on Fig. 11. the response of the system has not arrived at the set point value and cannot follow the steady state. This test must be carried out by giving various values of control parameters P. to be able to reach the set point value. The system response by providing different values of parameters P, I produces the values of rise time, overshoot, peak time, settling time, and error as in Table III.

D. Proportional (P) and Intergral Control Testing (I)
The test is carried out by providing various P parameter values and I parameter values. The test was carried out 5 times.  In Table V  The results of data conversion can be seen in table 5. In this part of the test, there is an overshoot value that is calculated because the response from the graph exceeds the given set point value. The error value displayed also affects because the graph has exceeded the set point limit so that the error produces a minus (-) value.

F. Best PID control control testing
The best PID control testing is performed by providing fixed values of the control parameters P, I, and D. and the values of the varied parameters. The test was carried out in five attempts.  Table VI is generated from the calculation of Arduino data that is converted using MATLAB so that it produces the values of rise time, overshoot, peak time, settling time, and error. The system response graph data can be seen in Fig. 11.  Fig. 14. of the best PID system response in this test, it can produce overshoot values. Overshoot occurs because the system response exceeds the given set point value. And the smaller error value from the previous experiment indicates that the control of P, I, D is stable enough to be applied to DC motors.
The control must do various ways, namely by changing the control parameter values of , , and variously, this technique is called the trial and error technique in order to get the best P, I, D response values.

G. PID Control Testing with Air Load
PID control testing when given mineral water loads is carried out by changing the parameters of , , and variably to achieve the stable rotation of the DC motor. The parameter data can be seen in Table VII.

H. System Testing in Open Spaces
PID control testing in open spaces is carried out by changing the parameters of , and variably to achieve DC motor rotation stability. The parameter data can be seen in Table VIII.  Table VIII is the result of the system response obtained using MATLAB software. The resulting data is in the form of rise time, overshoot, peak time, settling time, steady state error. The system response graph data can be seen in Fig. 16.  Table VIII. The sistem response results in a smaller overshoot value and the system stabilizes at set point 400.

IV. CONCLUSION
The PID control system used uses a closed loop system where the control depends on the system output or through feedback. The trial and error method is used to find the best PID parameters by varying the values of the , and parameters to be able to provide the best system response that can be stable at the specified set point.
The PID controller response when the DC motor is given a load affects the resulting rotational response, the speed of the DC motor decreases further so that it is necessary to change the parameters of , and . The greater the load given to the DC motor, the more it will affect the rotational speed.
The speed of the DC motor can be affected by different PWM inputs. The PWM signal can be obtained in various ways, such as on a microcontroller by generating a PWM signal on the motor driver IC circuit. If the PWM value is low, the width of the pulse produced will be smaller, thus affecting the speed of the DC motor due to the division of voltage output.