Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Abstract—The research proposed an alternative controller and robot Manipulator [35][36][37]. Nevertheless, all
to control the Direct Current (DC) Motor using a sliding mode mentioned researches were limited to simulation purpose
controller (SMC) in Matlab Simulink simulation and Arduino only.
hardware implementation. The proposed controller, SMC, was
designed using the system model (equivalent control) and The simulation about sliding mode controller had been
Lyapunov control design (also to prove the stability). The sliding done before [38][39][40][41][42]. They resulted in a good
mode controller had a better response than PID Controller, with performance, but we need the hardware implementation to
no overshoot response in the simulation result. In the Arduino observe more. This research would do not only the simulation
hardware implementation result, the augmented system could but also the hardware implementation. For a simple
reach the reference but has an oscillation and chattering effect
in the control signal. The chattering could be reduced by
implementation, it would use the Arduino microcontroller.
modifying the switching control. Comparing with PID, SMC The advantage of using the Arduino is low-cost [43][44][45],
had a better response with no overshoot. Thus, the SMC could small [46], and has many applications [47][48][49][50].
be used as an alternative controller for the DC Motor. Thus, it will good for the education purpose [51] and the
hardware implementation.
Keywords—DC Motor, Sliding Mode Controller, Arduino,
PID Control, Matlab The paper will be structured as follows. The first section
of the paper is the introduction. Next, the second section is
I. INTRODUCTION the modeling of DC Motor. Then, the next section is the
Direct Current (DC) motors play an important role in sliding mode controller design. The following section is the
vehicles [1][2], robotics [3][4][5], aircraft [6], and industrial result and discussion that consist of numerical simulation and
[7][8][9]. The common controller used in DC motor is hardware implementation. The last section is the conclusions
Proportional Integral Derivative (PID) Controller [10]. The and the future work.
main weakness of the PID controller is inconsistent II. MODEL OF DC MOTOR
performance [11][12]. The parameter of the controller only
has good performance in one set point. In other set points, the The DC Motor diagram is shown in Figure 1. The variable
given response would be different [13]. 𝑣𝐷𝐶 is the DC power supply, 𝑣𝐸𝑚𝑓 is the back electromotive
force voltage, 𝑅 is the armature resistance, 𝐿 is the armature
The other controller is the Fuzzy Logic Controller (FLC) inductance, 𝑓𝑘 is the friction torque, 𝐽 is the inertia, 𝜔 is the
[14][15][16][17][18][19]. It is not easy to be designed, angular speed, 𝑇 is the motor torque, 𝑖 is the armature current.
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 alternative controller for DC Motor is the Sliding
Mode Controller (SMC) that has the advantage of avoiding Fig. 1. DC Motor Diagram
uncertainties and disturbance [23][24]. It is similar to the
Variable Structure System (VSS) and is included in the The equations with Kirchhoff voltage law analysis is
nonlinear controller [25]. It has been applied to many obtained as
systems, such as Magnetic Levitation System [26][27], Buck
Converter [28][29], Quadcopter [30][31], Quadrotor [32],
Unmanned Surface Vehicle [33], DC/DC Converters [34]
where 𝐾𝑡 is the motor torque constant, and 𝑏 is the motor 𝑦 = [1 0]𝑥 (15)
friction constant.
Based on the state-space model, the transfer function
After using the mathematical processing with (1) and (2), model can be obtained as (it can use Matlab function ss2tf)
we obtained
13.89
𝑑𝑖 𝜔(𝑠) = 𝑣(𝑠) (16)
𝐿 = −𝑅𝑖 − 𝐾𝑒 𝜔 + 𝑣 (3) 𝑠2 + 5.648𝑠 + 1.509
𝑑𝑡
𝐽 0.0004
𝑥2 = 𝑖 (6)
𝐾𝑏 0.0022
𝐾𝑒 0.05
Then, we obtained the derivation of the state space
variable as
III. SLIDING MODE CONTROLLER DESIGN
𝑑𝜃 𝑏 𝐾𝑡
𝑥̇1 = 𝜔̇ = =− 𝜔+ 𝑖 (8) The sliding mode controller needs the model in the state
𝑑𝑡 𝐽 𝐽
space controllable form. Thus, the transfer function model in
(16) can be written time domain as
𝑑𝑖 𝐾𝑒 𝑅 1
𝑥̇ 2 = 𝑖̇̇ = =− 𝜔− 𝑖+ 𝑢 (9)
𝑑𝑡 𝐿 𝐿 𝐿 𝜔̈ + 5.648𝜔̇ + 1.509𝜔 = 13.89𝑣 (17)
Then, we used the substitution to obtain Then, we define the state space variable as
𝑏 𝐾𝑡 𝑥1 = 𝜔 (18)
𝑥̇1 = − 𝑥1 + 𝑥2 (10)
𝐽 𝐽
𝑥2 = 𝜔̇ (19)
𝐾𝑒 𝑅 1
𝑥̇ 2 = − 𝑥1 − 𝑥2 + 𝑢 (11)
𝐿 𝐿 𝐿 𝑢=𝑣 (20)
The state-space model is
We obtain the state-space model in the controllable
canonical form as
𝑥̇ = 𝐴𝑥 + 𝐵𝑢 (12)
𝑥̇1 = 𝑥2 (21)
𝑦 = 𝐶𝑥 (13)
𝑥̇ 2 = −5.648𝑥2 − 1.509𝑥1 + 13.89𝑢 (22)
Where
Alfian Ma’arif, Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Journal of Robotics and Control (JRC) ISSN: 2715-5072 584
Where variable 𝑒 is the tracking error and variable 𝑐 must A. Numerical Simulation
satisfy the Hurwitz condition (𝑐 > 0). In the section, the simulation used the Simulink Matlab
The tracking error and the derivation are Software. The Simulink setup is shown in Figure 2. The SMC
control signal is in (33).
𝑒 = 𝜔𝑑 − 𝜔 (24)
𝑒̇ = 𝜔̇ 𝑑 − 𝜔̇ (25)
𝑒̈ = 𝜔̈ 𝑑 − 𝜔̈ (26)
The derivation of the sliding mode function is TABLE II. SYSTEM RESPONSE PERFORMANCE
1
𝑢= (1.509𝜔 + 5.648𝜔̇ + 𝜔̈ 𝑑 + 𝑐𝑒̇
13.89 (33) 0.5
Reference
+ 𝐾 sgn(s)) PID
SMC
Where
0
1, 𝑠 > 0 0 2 4 6 8
sgn(s) = { 0, 𝑠 = 0 (34) time (second)
−1, 𝑠 < 0 Fig. 3. Response system
Alfian Ma’arif, Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Journal of Robotics and Control (JRC) ISSN: 2715-5072 585
PWM
|𝑠| + 𝛿
40
Where the parameter 𝛿 is the scalar tuning parameter to
reduce the chattering effect.
20
Control Signal
0
0 20 40 60 80 100
Time (ms)
600
500
600
40
500
20
400 Control Signal
Omega (RPM)
0
300 0 20 40 60 80 100
Time (ms)
200 Fig. 8. SMC Control Signal
Reference
100 Response
0
0 20 40 60 80 100
Time (ms)
Alfian Ma’arif, Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Journal of Robotics and Control (JRC) ISSN: 2715-5072 586
Alfian Ma’arif, Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller
Journal of Robotics and Control (JRC) ISSN: 2715-5072 587
[33] C. Xiu and P. Guo, “Global Terminal Sliding Mode Control with the [44] A. A. C. Carcamo, M. G. M. Reyes, and S. M. S. Urbina, “Low cost
Quick Reaching Law and Its Application,” IEEE Access, vol. 6, pp. Pulse Oximeter using Arduino,” in IEEE CHILEAN Conference on
49793–49800, Sep. 2018. Electrical, Electronics Engineering, Information and Communication
[34] S. Lee, Y. C. Jeung, and D. C. Lee, “Voltage balancing control of IPOS Technologies, CHILECON 2019, 2019.
modular dual active bridge DC/DC converters based on hierarchical [45] M. S. Kumar, T. R. Chandra, D. P. Kumar, and M. S. Manikandan,
sliding mode control,” IEEE Access, vol. 7, pp. 9989–9997, 2019. “Monitoring moisture of soil using low cost homemade Soil moisture
[35] W. Boukadida, R. Bkekri, A. Benamor, and H. Messaoud, “Trajectory sensor and Arduino UNO,” in ICACCS 2016 - 3rd International
tracking of robotic manipulators using optimal sliding mode control,” Conference on Advanced Computing and Communication Systems:
in 2017 International Conference on Control, Automation and Bringing to the Table, Futuristic Technologies from Arround the
Diagnosis, ICCAD 2017, 2017, pp. 545–550. Globe, 2016.
[36] S. Ilgen, A. Durdu, E. Gulbahce, and A. Cakan, “Sliding mode control [46] G. Gasparesc, “PID control of a DC motor using Labview Interface for
of a two-link robot manipulator using adams matlab software,” in 2018 Embedded Platforms,” in 2016 12th International Symposium on
6th International Conference on Control Engineering and Information Electronics and Telecommunications, ISETC 2016 - Conference
Technology, CEIT 2018, 2018. Proceedings, 2016, pp. 145–148.
[37] T. N. Truong, A. T. Vo, and H. J. Kang, “A Backstepping Global Fast [47] S. Gunputh, A. P. Murdan, and V. Oree, “Design and implementation
Terminal Sliding Mode Control for Trajectory Tracking Control of of a low-cost Arduino-based smart home system,” in 2017 9th IEEE
Industrial Robotic Manipulators,” IEEE Access, 2021. International Conference on Communication Software and Networks,
ICCSN 2017, 2017, vol. 2017-Janua, pp. 1491–1495.
[38] H. Maghfiroh, A. Sujono, C. Hermanu, and B. Apribowo, “Basic
Tutorial on Sliding Mode Control in Speed Control of DC-motor,” Apr. [48] J. Sheng, “Real Time DC Water Tank Level Control using Arduino
2020. Mega 2560,” in IEEE International Symposium on Industrial
[39] B. A. Reddy and D. Sowjanya, “Control of D.C Motor Using Sliding Electronics, 2019, vol. 2019-June, pp. 635–640.
Mode Control under Disturbance Conditions,” in Proceedings of the [49] S. Dhingra, R. B. Madda, A. H. Gandomi, R. Patan, and M.
3rd International Conference on Inventive Systems and Control, ICISC Daneshmand, “Internet of things mobile-air pollution monitoring
2019, 2019, pp. 32–36. system (IoT-Mobair),” IEEE Internet of Things Journal, vol. 6, no. 3,
pp. 5577–5584, Jun. 2019.
[40] R. Coban, “Backstepping integral sliding mode control of an
electromechanical system,” Automatika, vol. 58, no. 3, pp. 266–272, [50] M. Lobur, D. Korpyljov, N. Jaworski, M. Iwaniec, and U. Marikutsa,
2017. “Arduino Based Ambient Air Pollution Sensing System,” in 2020
[41] S. A. Al-Samarraie and M. Hussein Mishary Me, “A Chattering Free IEEE 16th International Conference on the Perspective Technologies
Sliding Mode Observer with Application to DC Motor Speed Control,” and Methods in MEMS Design, MEMSTECH 2020 - Proceedings,
2020, pp. 32–35.
in 2018 3rd Scientific Conference of Electrical Engineering, SCEE
2018, 2018, pp. 259–264. [51] J. H. Li, “Control system laboratory with arduino,” in Proceedings -
2018 International Symposium on Computer, Consumer and Control,
[42] S. Rakhonde and V. Kulkarni, “Sliding mode controller (SMC)
governed speed control of DC motor,” in 2018 3rd IEEE International IS3C 2018, 2019, pp. 181–184.
Conference on Recent Trends in Electronics, Information and [52] B. Hekimoglu, “Optimal Tuning of Fractional Order PID Controller for
Communication Technology, RTEICT 2018 - Proceedings, 2018, pp. DC Motor Speed Control via Chaotic Atom Search Optimization
1657–1662. Algorithm,” IEEE Access, vol. 7, pp. 38100–38114, 2019.
[43] Z. Tir, O. Malik, M. A. Hamida, H. Cherif, Y. Bekakra, and A. Kadrine,
“Implementation of a fuzzy logic speed controller for a permanent
magnet dc motor using a low-cost Arduino platform,” in 2017 5th
International Conference on Electrical Engineering - Boumerdes,
ICEE-B 2017, 2017, vol. 2017-Janua, pp. 1–4.
Alfian Ma’arif, Simulation and Arduino Hardware Implementation of DC Motor Control Using Sliding Mode Controller