0% found this document useful (0 votes)
3 views7 pages

Simulink Arduino DC Motor Control

This paper discusses the speed control of a DC motor using a PID controller implemented through Arduino and Simulink. It compares open loop and closed loop systems, demonstrating that the closed loop system offers improved stability and reduced sensitivity. The study concludes that the PID controller enhances the accuracy of speed control in DC motors.

Uploaded by

ericmendiola
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)
3 views7 pages

Simulink Arduino DC Motor Control

This paper discusses the speed control of a DC motor using a PID controller implemented through Arduino and Simulink. It compares open loop and closed loop systems, demonstrating that the closed loop system offers improved stability and reduced sensitivity. The study concludes that the PID controller enhances the accuracy of speed control in DC motors.

Uploaded by

ericmendiola
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

See discussions, stats, and author profiles for this publication at: [Link]

net/publication/354653179

Speed Control of DC Motor Using Simulink With Arduino

Conference Paper · July 2021

CITATIONS READS

0 363

5 authors, including:

Asma Alfergani
University of Benghazi
36 PUBLICATIONS 352 CITATIONS

SEE PROFILE

All content following this page was uploaded by Asma Alfergani on 10 August 2025.

The user has requested enhancement of the downloaded file.


Speed Control of DC Motor Using Simulink With
Arduino
Asma Alfergani*, Shoroug Alweheshi, Abdelhameed Musbah Saeed, Fathi Adam and Hussamedin S. Mohamed
Electrical and Electronics Engineering Department
University of Benghazi
Benghazi, Libya
[Link]@[Link]

Abstract— Nowadays, DC machines, in particular motors, bridge at required speed. In addition, the PID controller is
are widely employed in most applications. DC machines that used to get the best performance practically in the laboratory,
convert the energy form from mechanical to electrical are where the paper is organized as follows:
called DC generators, whilst the DC machines that convert the
electrical to mechanical are the motors. DC motors currently The following section is dedicated to investigate the open
are the most commonly used due to their high torque at loop controller system behavior, then a practical
starting and easy maintenance and installation compared to implementation of the latter is demonstrated. In the fourth
their AC counterparts. Since the speed of the DC motor is section a closed loop system and its characteristics are
crucial to the functioning of the motor, it is important to illustrated, followed by a comparison the results of both
control it while varying the voltage. Therefore, this paper systems. Finally, results of applying PID controller are
proposed controlling the speed through controlling input showcased.
voltage, using a PID controller with a closed loop system
applied practically via utilizing Arduino and Matlab/Simulink II. OPEN LOOP SYSTEM DESCRIPTION
to generate the control signal. The results of connecting the
Feedback system were compared to their counterparts while A. Open Loop DC Motor Speed Controller system
connecting the open loop system.
In the open loop systems, the signal indicated by the
Keywords— Arduino; DC motor; PID; H-Bridge
Arduino was sent to the H-Bridge to drive the motor at a
certain speed, according to the level of voltage resulted from
I. INTRODUCTION PWM signal. The two aforementioned DC machines
connected to the same shaft, where the first works as a motor
Nowadays, the Direct Current, DC, machines are one of
converting the electric energy into mechanical whose output
the most that commonly used in the field of industry,
is used as an input for the second DC generator and the
precisely the DC motors, due to their low cost, easy
energy converted is considered as the expressing speed.
maintenance and the simple control techniques applied for
speed control [1]. For instance, the parameter's pins, the inputs and outputs
are defined as IN1, IN2 and pulse width modulation (PWM)
DC motors are becoming a great part of many
signals, respectively. For direction of DC motor, the values
applications, such as robot arm drives, machine tools, rolling
of the inputs are assigned as IN1 low and IN2 high, then the
mills, and aircraft control [2].
"serial monitor” function is called as illustrated in Fig. 1,
The DC motor turn electrical energy into mechanical by consequently, a value of the speed is manually appointed
electromagnetic induction, where the circuit is composed of a from 0 to 255 as it is considered the number of samples
stator (the stationary field) and a rotor (the rotating field), the compared to PWM signals.
current carried in the armature generates a magnetic flux
which through interaction will produce torque and rotational
speed [3].
The speed of the motor is controlled through controlling
the value of the input voltage, where it can be adjusted
according to the load demand. As all the DC motors require a
controller to alter the speed to a desired value, the control
technique can be performed manually or by applying some
conventional control techniques such as PID control [4]
The crucial concept of the PID controller is tuning the
proportional, Integral and Derivative gains, P, I, and D, Fig. 1. The serial monitor
respectively [4], this technique is widely utilized due to its
simple structure and fast response to improve the system’s B. The Hardware Connections
transient and the steady state behavior, as well as obtaining As demonstrated in Fig. 2, the system applied in this
fast settling time without causing overshoot [5,6]. paper comprises of two DC machines connected to the same
This paper aims at studying the behavior of DC motor
coupled with DC generator load, which is derived by H-

XXX-X-XXXX-XXXX-X/XX/$XX.00 ©2021 IEEE


Fig. 2 . The Hardware Connections for open loop system

IV. CLOSED LOOP SYSTEM DISCRIPTION


shaft, where the former works as a motor and the latter as
a generator, the module number of the board is B3510 – G- A. Closed Loop DC Motor Speed Controller system
DC motor speed control, H-bridge, Arduino, voltmeter and
power supply. In this section, the feedback was applied to the system to
acquire the closed loop system, which through the voltage of
III. EXPERMINTAL RESULTS OF OPEN LOOP SYSTEM
generator is returned to the Arduino, however the
In this section, the practical results of connecting the Arduino does not receive a voltage greater than the 5 V and
open loop system is showcased. The PWM signal generated the voltage of generator may be greater than this value, a
from Arduino is sent to H-bridge, which a 20 V power voltage divider was used to protect the Arduino.
supply was applied to H-bridge, to drive the motor and the
output voltage is measured by multimeter. Fig. 3. represents the Arduino protection circuit. The
voltage at the power supply equals to 20 V, the feedback to
It was noticed that any increase at the input voltage (Vin) Arduino at pin A0 must not exceed 5 V, therefore, this circuit
by variation of modulation technique pulses, leads to an was used. It composes of two resistances connected in series,
increase in the tachogenetrator voltage (Vg), thus, the speed one of which is connected to Arduino so that the voltage is
increases as can be seen in table I. Also, around 3 V is divided into two parts, and to assure the level of obtained
required for the motor to begin running due to the internal voltage is less than 5 V the feedback was connected the on
friction. With the fluctuations occurred and with the increase terminal of the smallest value resistance, the 5 KΩ
in the tachogenetrator voltage accompanied with the increase resistance. Then, by using the inverted voltage divider the
in the speed of the motor, we conclude the open loop system real value of the voltage was obtained.
is with high error.
Table I. RELATIONSHIP BETWEEN INPUT VOLTAGE AND
GENERATOR VOLTAGE

Speed (0-255 rpm) Vin (0-20V) Vg (volts)


255 20 13.18
230 18 12.3
217 16 11.5
204 15 10.97 Fig. 3. Arduino protection circuit
191 13 10
The calculation of the aforementioned procedure is as
166 11 8.7
follows:
140 10 7.8
102 8 6
Let is the voltage obtained from the terminals of 5kΩ
resistance, where the supply voltage, , is equal to 20 V
64 5 1.83
51 4 0.8 By using voltage divider:
38 3 0
13 1 0
Fig. 4. The Hardware Connections for closed loop system
V. EXPERMINTAL RESULTS OF CLOSED LOOP SYSTEM
(1) The main purpose of utilizing the PWM is to control the
value of the input voltage, thus controlling the speed of the
Then (2) motor to convert to real value of Vin by the following
Here, it was observed that the maximum possible voltage equation
value to be connected to the Arduino will not be higher than (5)
5 volts and so that Arduino is protected from high voltages.
Then the lost value was offset in the code so the inverse The range of , PWM values, is between 0 to 255, the
of the voltage divider is applied, from equation (1) maximum voltage value at the maximum value of pulse
width modulation (255) at Duty Cycle one (100 %). As
Then (3) shown in the Fig. 5 and illustrated in Table II.

Therefore =4* (4)


The parameter's pins, the inputs and outputs were
defined, then the direction of the DC motor was identified
and the analog reading was converted into digital with a
value between (0-5 V). For instance, the Arduino board
contains six channels for converting similar signals into 10-
bit digital, since the value of the voltage will be between 0
and 5 V it will be converted to a corresponding integer value
between 0 and 1023. Thus, the accuracy of the operations of
reading the values is the similarity: 5 V / 1024 units, then the
voltage multiplied by 4, the factor that was obtained by
equation (4). Fig. 5. The form of PWM while duty cycle equals to 100% (10
V/DIV)

B. The Hardware Connections Table II. AN EXPLANATION OF THE DIRECT RELATIONSHIP

The hardware utilized in this research is the Arduino BETWEEN AND IN THE CLOSED LOOP SYSTEM
Uno, two motors, H-Bridge, variable resistor, and DC supply Speed (0-255 rpm) Vin (0-20V) Vg (volts)
as illustrated in Fig. 4. 255 20 13.72
200 15.7 11.4
166 13 9.85
140 11 9.15
102 8 6.47
77 6 2.33
64 5 2.04
The less the value of the duty cycle is, the less the value
of PWM, leading to a decrease of the input voltage value.
Fig. 6. shows the duty cycle when it equals to 50%.

Fig. 6. The form of PWM while duty cycle equals to 50% (10 V/DIV)

As can be seen from the Fig. 7, the values of the


generator voltage Vg through the connection of the closed
loop system, therefore the system performance has been
improved compared to the results obtained from the open
loop system, since the distortion in the system has been
eliminated.
In the closed loop system, the feedback voltage from the
output was unstable, as a huge difference between the
desired and actual voltage values occurred due to the error in
the system, as illustrated in table II.
VI. EXPERMINTAL DISCRIPTION OF CLOSED LOOP SYSTEM Fig. 7. The reading of generator output voltage 𝑣𝑔 by Arduino.
WITH PID CONTROLLER
B. Experimental results
An PID controller is used to study the system response in In the previous section, the closed-loop system without PID
terms of over-shoot, setting time and rise time and to try to controller was applied, the system was unstable, as there was
set the PID parameters in order to get the most optimum a large overshoot ( which is indicated by the oscillation of
possible response for the system to become stable. the motor) and the steady state error that was also large.
A. The Expermintal Set Up Explanation However, through this section, a closed loop with the PID
First, we determined the direction of the motor by using Controller to make the system stable was tested and the PID
the digital Write blocks as can be seen in the bottom side of parameters (Proportional-Integral-Derivative) were adjusted
the Fig. 8, as the switch of pin 7 is off and the switch of pin 8 to tune the best possible response. So, the proportional
is on, where they are the output of Arduino. parameter was increased to reduce rise time to the least,
Then the unit step block at a constant equal to 10 volt with a decrease in rise time, the overshoot increased.
was inserted to be the reference point, furthermore, a block Moreover, by increasing the value of the integral parameter
for PID control was included to change the parameters of to reduce the steady state error, while keeping at a
PID to control the system and make it stable. The signal then fixed value, the overshoot increases, and to overcome the
passes to a block that converts DC into pulses at output 3 high value of overshoot, the derivative parameter was
passing from Arduino to H-Bridge to control the speed via increased.
the PWM. As was mentioned that the PWM is defined by the
samples (from 0 to 255) and then the gain was inserted to
convert it to the actual value.
Finally, a feedback block was added at the A0 port, and
Summation was also included between the set Point and the
Feedback voltage to make it a closed-loop system.
Fig. 8. Simulink of the system by adding a PID controller

Fig. 9. shows the response of the system after tuning the PID VII. CONCLUSIONS
controller parameters manually, as it can be observed that In this paper a study was conducted to discuss the
there is no overshoot, with no steady state error, and a short differences between the open loop system and the closed
rise time to reach the reference point, this result was acquired loop system of the B3510 – G- DC motor speed control
by setting the parameters with values , and equal to module. Three cases of speed control were practically
27, 110 and 12, respectively. implemented; Open loop system, closed loop system and
In this paper, the stability of the DC motor with generator closed loop system using PID. The Arduino is used to
load was applied using Arduino with Simulink to control the control the module, the signal indicated by the Arduino was
speed of the DC motor. It is reported that the stability of the sent to the H-Bridge to drive the motor at a certain speed,
DC motor using PID controller is more accurate. according to the level of voltage resulted from PWM signal.
Furthermore, the system could be improved by using more The main purpose of utilizing the PWM is to control the
than one intelligent control which was verified by simulation value of the input voltage, thus controlling the speed of the
results. This approach will be used to analyze the stability of motor to convert to real value of Vin. The speed is
the time-delay DC motor in future work [7]. controlled through control the input voltage, using a PID
controller with a closed loop system applied practically via
utilizing Arduino and Matlab/ Simulink to generate the
control signal. The results demonstrated that open loop
system is more sensitive and the closed loop is more stable
and less sensitive than open loop.
ACKNOWLEDGMENT
The Authors would like to acknowledge all staff
members in the Electrical and Electronic Engineering
department, at University of Benghazi who helped to realize
and design this system with improved results.

Fig. 9. The response of the system with the optimum value of , and
.
REFERENCES

[1] Z. Has, A. H. Muslim and N. A. Mardiyah, "Adaptive-


fuzzy-PID controller based disturbance observer for DC
motor speed control," in 2017 4th International
Conference on Electrical Engineering, Computer
Science and Informatics (EECSI), 2017.
[2] J. T. Teeter, M.-y. Chow and J. J. Brickley, "A novel
fuzzy friction compensation approach to improve the
performance of a DC motor control system," IEEE
Transactions on Industrial Electronics, vol. 43, p. 113–
120, 1996.
[3] Y. A. Almatheel and A. Abdelrahman, "Speed control of
DC motor using fuzzy logic controller," in 2017
International Conference on Communication, Control,
Computing and Electronics Engineering (ICCCCEE),
2017.
[4] Y. Guo and M. E. A. Mohamed, "Speed control of direct
current motor using ANFIS based hybrid PID
configuration controller," IEEE Access, vol. 8, p.
125638–125647, 2020.
[5] A. Jaya, E. Purwanto, M. B. Fauziah, F. D. Murdianto,
G. Prabowo and M. R. Rusli, "Design of PID-fuzzy for
speed control of brushless DC motor in dynamic electric
vehicle to improve steady-state performance," in 2017
International Electronics Symposium on Engineering
Technology and Applications (IES-ETA), 2017.
[6] B. Hekimoğlu, "Optimal tuning of fractional order PID
controller for DC motor speed control via chaotic atom
search optimization algorithm," IEEE Access, vol. 7, p.
38100–38114, 2019.
[7] A. Khalil, O. Mohamed and J. Wang, "Wireless
Networked Control Systems", 1-6, 2015.

View publication stats

You might also like