Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller

—The research proposed an alternative controller to control the Direct Current (DC) Motor using a sliding mode controller (SMC) in Matlab Simulink simulation and Arduino hardware implementation. The proposed controller, SMC, was designed using the system model (equivalent control) and Lyapunov control design (also to prove the stability). The sliding mode controller had a better response than PID Controller, with no overshoot response in the simulation result. In the Arduino hardware implementation result, the augmented system could reach the reference but has an oscillation and chattering effect in the control signal. The chattering could be reduced by modifying the switching control. Comparing with PID, SMC had a better response with no overshoot. Thus, the SMC could be used as an alternative controller for the DC Motor.


I. INTRODUCTION
Direct Current (DC) motors play an important role in vehicles [1] [2], robotics [3][4] [5], aircraft [6], and industrial [7][8] [9]. The common controller used in DC motor is Proportional Integral Derivative (PID) Controller [10]. The main weakness of the PID controller is inconsistent performance [11] [12]. The parameter of the controller only has good performance in one set point. In other set points, the given response would be different [13].
The other controller is the Fuzzy Logic Controller (FLC) [14][15] [16] [17][18] [19]. It is not easy to be designed, especially if it has many inputs. It requires experience, as in experimental data, to be able to design a suitable controller. It also needs more memory if it has many rules. Thus, we need an alternative controller for DC Motor. Another controller is the state feedback controller [20][21] [22]. However, the controller needs all of the state must be measurable in hardware implementation. Thus it cannot work only using one sensor.
The simulation about sliding mode controller had been done before [38][39] [40][41] [42]. They resulted in a good performance, but we need the hardware implementation to observe more. This research would do not only the simulation but also the hardware implementation. For a simple implementation, it would use the Arduino microcontroller. The advantage of using the Arduino is low-cost [43][44] [45], small [46], and has many applications [47] [48][49] [50]. Thus, it will good for the education purpose [51] and the hardware implementation.
The paper will be structured as follows. The first section of the paper is the introduction. Next, the second section is the modeling of DC Motor. Then, the next section is the sliding mode controller design. The following section is the result and discussion that consist of numerical simulation and hardware implementation. The last section is the conclusions and the future work.

II. MODEL OF DC MOTOR
The DC Motor diagram is shown in Figure 1. The variable is the DC power supply, is the back electromotive force voltage, is the armature resistance, is the armature inductance, is the friction torque, is the inertia, is the angular speed, is the motor torque, is the armature current.
where variable is the electromotive force constant.
The equation with Newton second law for rotation is obtained as where is the motor torque constant, and is the motor friction constant.
After using the mathematical processing with (1) and (2), we obtained Define the state space variables and the control signal variable as Then, we obtained the derivation of the state space variable as Then, we used the substitution to obtain The state-space model is The parameter value of DC Motor is shown in Table I. The parameter was used in the simulation and controller design.
The state-space model in (12) and (13) Then, we define the state space variable as We obtain the state-space model in the controllable canonical form as ̇2 = −5.648 2 − 1.509 1 + 13.89 The first step to designing the sliding mode controller was designing the sliding mode function as = +̇ where variable is the reference signal, and is the actual angular speed.
Define the Lyapunov function as To guarantee the stability condition, the derivation of the Lyapunov function in (27) must be ̇< 0 as ̇< 0 The derivation of the sliding mode function is To satisfy the condition ̇< 0, the sliding mode controller is designed as The section will be divided into two. The first part is the numerical simulation using Matlab Software. Then, the second part is the hardware implementation using the Arduino microcontroller.

A. Numerical Simulation
In the section, the simulation used the Simulink Matlab Software. The Simulink setup is shown in Figure 2. The SMC control signal is in (33).

Fig. 2. Simulation Setup in Simulink Matlab
Comparing system response with PID, the result for the step reference signal is shown in Figure 3. The detailed system response is shown in Table II. It can be seen that the SMC response did not have an overshoot. Meanwhile, the PID response had a 22.48% overshoot. Thus, the SMC response was better than the PID Controller.

B. Arduino Hardware Implementation
In this section, the hardware implementation would be conducted using Arduino, DC Motor JGA25, Driver Motor L298, Encoder, and Current Sensor INA219. The device setup is shown in Figure 4.
The result is shown in Figure 5. The SMC control signal is shown in Figure 6. It can be seen that the system could reach the reference but had an oscillation. The SMC control signal had a chattering effect.
Where the parameter is the scalar tuning parameter to reduce the chattering effect. The system's responses and control signal using modified switching function in (36) is shown in Figure 7 and Figure 8. It can be shown that the chattering effect was reduced, and the system response was better than before.
The subsequent examination was a comparison between the SMC and PID controller. The result is shown in Figure 9. It can be seen that SMC 1 and SMC 2 did not have any overshoot. Meanwhile, the PID control had an overshoot. The PID had a small oscillation than the SMC.

V. CONCLUSIONS AND FUTURE WORK
The paper proposed DC Motor control using the sliding mode controller in simulation and hardware implementation. Based on the simulation, the SMC had a better response than PID Controller. Meanwhile, in hardware implementation, SMC had oscillation to follow the reference. Thus, the SMC could be implemented in the hardware system but still need improvement to reduce the oscillation.