You are on page 1of 5

GRD Journals- Global Research and Development Journal for Engineering | Volume 4 | Issue 4 | March 2019

ISSN: 2455-5703

Speed and Position Control of a DC Motor using


ATmega328
Gokul. V Karthikeyan. S
UG Student UG Student
Department of Robotics and Automation Department of Robotics and Automation
PSG College of Technology, Coimbatore, Tamil Nadu, India PSG College of Technology, Coimbatore, Tamil Nadu, India

Renu Karthick R. J Sundar Ganesh C. S


UG Student Research Scholar
Department of Robotics and Automation Department of Electrical and Electronics Engineering
PSG College of Technology, Coimbatore, Tamil Nadu, India PSG College of Technology, Coimbatore, Tamil Nadu, India

Abstract
The mechatronic systems represent one of the most challenging control applications due to their interdisciplinary nature. Numerous
control algorithms have been proposed to deal with nonlinear dynamics of the mechatronic systems. For linear mechatronic
systems, the proportional-integral-derivative (PID) controller is often used owing to its simple structure and robustness. One of the
most common applications in all mechatronic domains is the control of DC motors. To develop a product which will can be used
efficiently. In this case, develop a PCB (Printed Circuit Board) to control a servomotor position and speed. Arduino UNO
ATMEGA 328 is used to control the motor. This motor is controlled using PID logic (Proportional Integrative Differential). The
PID logic is implemented in the motor using the Arduino UNO ATMEGA 328 micro controller. After implementing the above,
proteus design is made and PCB is printed. The final printed circuit board will be able to control the motor using PID logic.
Keywords- DC Motor, PID, Proteus, ROS, Printed Circuit Board, Arduino UNO ATMEGA 328

I. INTRODUCTION
The control of DC motors has been the interest of many researchers, due to the wide variety of applications that require the use of
different types of DC motors. The controllers designed for these DC motors range from simple traditional PIDs to advanced control
algorithms, among which fractional order control has been gaining more and more popularity. Fractional calculus has been used
relatively recently in modeling and control applications. The attractiveness of the fractional order PID controllers resides in their
potential to increase the closed loop performance and robustness of the closed loop system, due to the extra tuning parameters
available, as compared to the conventional controller. With fractional order controllers, the order of differentiation and integration
may be used as supplementary tuning parameters and thus more specifications can be fulfilled at the same time, including the
robustness to plant uncertainties, such as gain and time constant changes.

II. LITERATURE SURVEY


Shivanand Pandey and Bhagirath Pandey explained about a DC Motor Torque Control using Fuzzy Proportional-Derivative
Controllers [1]. They have illustrated with a neat simulation of how it looks when a motor is controlled using a Fuzzy logic
controller. This is helpful to know about the basics to control the DC motor. They have also stated how they would want the future
generations to work on specific areas for the betterment.
LadislavJurišica and Roman Murár discussed about Mobile robots and their subsystems [2]. This journal gives us some
basic structure of the mobile robots with the help of the block diagrams. It explains the complex structure of sub-systems, and how
to make a mobile robot intelligent. It gives methods to make autonomy and intelligence which lies not only on control algorithms
or information subsystems.
J. Borenstein, H. R. Everett, L. Feng, D. Wehe, discussed about the Mobile Robot Positioning & Sensors and Techniques
[3]. This gives us the basics about the ranging of t sensors to be used and the arrangement of the parts in the robot for tidy movement.
This paper gives an insight into the mobile robot positioning and various sensor technologies that can be implemented in a mobile
robot. This also gives detail about the working of Odometry, landmark navigation, Global positioning system and Inertial
navigation.
Siti Nurmaini and AngginaPrimanita explained about the Modeling of Mobile Robot System with Control Strategy Based
on Type-2 Fuzzy Logic [4]. This paper provides the information about the advantages, disadvantages and complications of building
a mobile robot using a fuzzy logic controller. This system has complicated connections but work with some accuracy and precision.

All rights reserved by www.grdjournals.com 8


Speed and Position Control of a DC Motor using ATmega328
(GRDJE/ Volume 4 / Issue 4 / 002)

Max Schwarz, Tobias Rodehutskors, Michael Schreiber, Sven Behnke discussed about the Hybrid Driving-Stepping
Locomotion with the Wheeled-legged Robot Momaro [5]. This paper explained about the locomotion of robots and the best ways
in which they can be controlled.
Muhammad Rafay Khan et al, Speed Control of DC Motor under Varying Load Using PID Controller [6]. This is oneof
those journals where the basics can be seen. For the ones who would like to learn about the dynamic model of a DC motor, they
might find it very useful but most of the derivations are skipped which makes them hard to understand.
Tayfun Abu, Modeling and Optimal control of a DC motor [7]. This detail gives in detail about the circuits which are to
be used. These circuits in this journal are a way simpler and are easier to understand with just a glance and also easy for execution.
Yukio Hasegawa, Volume 2 No. 3, March 2012 ISSN 2223-4985 International Journal of Information and
Communication Technology Research [8]. This journal deals with the construction of robots ranging from the basics. This journal
deals with simple constructions.
Katie Byl and Russ Tedrake, Dynamically Diverse Legged Locomotion for Rough Terrain [9]. This deals with how the
robots can be mobile in harsh environments. They have proposed some innovative ideas.
Steve Scott, Motor Control Learning and Performance [10]. This is one of the journals which gives the introduction and
certainly it’s pure basic as it deals with how the speed varies with the help of the varying the load. And this gives a neat introduction
to the project.
Zhu Haishui et al, Design on a DC Motor Speed Control [11]. This journal gives about brief idea of speed control of DC
motor and their deals with the design strategies.
Santosh Kumar Suman et al, Speed control of DC motor using optimization techniques based PID Controller [12]. In this
journal, how the PID is optimized in DC motor speed with some algorithms.
Jamal A. Mohammed, Modeling Analysis and Speed Control Design Methods of a DC Motor [13]. This journal tells
about the design methods of a DC motor and some analysis taken for effective DC motor.
K.H Ang, G.C.Y. Chong, Y Li, PID control system analysis design and technology [14]. This journal gives the basic idea
about the PID control system and how the system is analyzed and designed.
V. Antanio, Research Trends for PID Controllers [15]. This journal for new approaches taken for PID controllers and how
its modernized and tested.
A. S. Othman, Proportional Integral and Derivative Control of Brushless DC Motor [16]. In this journal, implementation
of PID in brushless DC motors and working model of clearly explained.

III. PID
Proportional Integrative Differential (PID) controller is used for a variety of applications. A proportional controller stands in a case
where the input is proportional to the output. Here if the input has less noise, the output will be all most exact with no errors but
minimal errors in some cases. In contrast, if the noise content is much in the input, then even the errors will be very high and the
process is very slow. So this process wanted an updation to it and hence came the Proportional Differential controllers.
In PID controllers, the Integrative part does the operations by integrating the current values and minimizing the errors as
much as possible. Next part is the Differential part where the output can soon be predicted with the help of differentiating the
current values thus making the operations as fast as possible and also as accurate as possible. This PID controllers as costlier
compared to the other controllers but they are worth their cost. They are now being used in control systems in most of the industries.

(1)
They mainly find their applications in the large scale industries where large scale control systems as being used. Their
logics are also being used in small scales. In this project, the logic to control the motor accordingly so that it’s position can be
controlled through the program. It is common that servo motor’s position is being monitored using than encoder. But in this case,
a lot of components are being used. The drive part consists a H-Bridge motor drive. The micro controller used in this case is the
Atmega 328 micro controller and it is interfaced with the help of an Arduino UNO. So the PID logic is programmed accordingly
in the Arduino. Then feedback here with the help of an encoder and only use that same data to control motor in terms of the PID
logic. One of the motors is controlled according to our favorable outcome, the rotor can be stopped when needed and it can also
be adjusted to a certain speed levels in some cases. These motors can be used to function in the areas such as AGVs (Automated
Guided Vehicles) etc. The programming part of the PID might be tough and complex but once when it is completed, the processes
will be more efficient thus enabling us to achieve the goal without much errors involved. By doing, it will be able to control the
motor efficiently.

All rights reserved by www.grdjournals.com 9


Speed and Position Control of a DC Motor using ATmega328
(GRDJE/ Volume 4 / Issue 4 / 002)

Fig. 1: PID Logic Diagram

A. Loop Tuning
Tuning a control loop is the adjustment of its control parameters (proportional band/gain, integral gain/reset, derivative gain/rate)
to the optimum values for the desired control response. Stability (no unbounded oscillation) is a basic requirement, but beyond
that, different systems have different behaviour, different applications have different requirements, and requirements may conflict
with one another.PID tuning is a difficult problem, even though there are only three parameters and in principle is simple to
describe, because it must satisfy complex criteria within the limitations of PID control. There are accordingly various methods for
loop tuning, and more sophisticated techniques are the subject of patents; this section describes some traditional manual methods
for loop tuning. Designing and tuning a PID controller appears to be conceptually intuitive, but can be hard in practice, if multiple
(and often conflicting) objectives such as short transient and high stability are to be achieved. PID controllers often provide
acceptable control using default tunings, but performance can generally be improved by careful tuning, and performance may be
unacceptable with poor tuning. Usually, initial designs need to be adjusted repeatedly through computer simulations until the
closed-loop system performs or compromises as desired.
Some processes have a degree of nonlinearity and so parameters that work well at full-load conditions don't work when
the process is starting up from no-load; this can be corrected by gain scheduling (using different parameters in different operating
regions).

B. Servo Tuning
If the PID controller parameters (the gains of the proportional, integral and derivative terms) are chosen incorrectly, the controlled
process input can be unstable, its output diverges, with or without oscillation, and is limited only by saturation or mechanical
breakage. Instability is caused by excess gain, particularly in the presence of significant lag. Generally, stabilization of response is
required and the process must not oscillate for any combination of process conditions and setpoints, though sometimes marginal
stability (bounded oscillation) is acceptable or desired. Mathematically, the origins of instability can be seen in the Laplace domain.
The optimal behavior on a process change or setpoint change varies depending on the application.

C. PID Tuning Software


Most modern industrial facilities no longer tune loops using the manual calculation methods shown above. Instead, PID tuning and
loop optimization software are used to ensure consistent results. These software packages will gather the data, develop process
models, and suggest optimal tuning. Some software packages can even develop tuning by gathering data from reference changes.
Mathematical PID loop tuning induces an impulse in the system, and then uses the controlled system's frequency response to design
the PID loop values. In loops with response times of several minutes, mathematical loop tuning is recommended, because trial and
error can take days just to find a stable set of loop values. Optimal values are harder to find. Some digital loop controllers offer a
self-tuning feature in which very small setpoint changes are sent to the process, allowing the controller itself to calculate optimal
tuning values.
Other formulas are available to tune the loop according to different performance criteria. Many patented formulas are now
embedded within PID tuning software and hardware modules. Advances in automated PID loop tuning software also deliver
algorithms for tuning PID Loops in a dynamic or non-steady state (NSS) scenario. The software will model the dynamics of a
process, through a disturbance, and calculate PID control parameters in response.

IV. INTERFACING ROS WITH ARDUINO


The integration of an enormous amount of sensors and actuators could be a real problem. The complexity is transferred also to the
area of algorithms and to the hardware platforms dedicated to integrating the robotics components. The Robot Operating System
(ROS) is engineered to solve the problems from the software side. It contains a series of libraries that support a wide range of
sensors and actuators. You’re allowed to write a ROS node for your sensor. In addition, it has a good integration with other robot
middleware software like OpenCV, Point Cloud Library, etc. ROS can run on single board computers such as Raspberry Pi, or
integrated with microcontroller boards such as the Arduino.

All rights reserved by www.grdjournals.com 10


Speed and Position Control of a DC Motor using ATmega328
(GRDJE/ Volume 4 / Issue 4 / 002)

In this article, the focus is to explore the best tutorials to start working with ROS on both Raspberry Pi and Arduino.
Arduino is a quite attractive embedded platform among hobbyists for several reasons, including here the low price, an easy way to
interface different sensors and actuators, a large community that share information and resources, and of course it can be interfaced
with ROS using the rosserial package.
With no extra effort, you can control an advanced robot without writing a single hardware drive, only by setting up a
network of custom ROS center nodes. You can use the ROS with Arduino for a wide range of applications such as monitoring,
measuring the values from a sensor, control R/C servos, and many other applications with support from ROS side. It is very easy
to use the ROS with Arduino. Between the Arduino and ROS is the Arduino IDE tool designed for a quickly and easily
programming hardware. The communication between ROS and Arduino is done through the rosserial_arduino package, which
provide a ROS communication protocol able to work with Arduino’s serial ports. The rosserial_arduino package is a dedicated
tool engineered to work directly with ROS messages, get the ROS system time, or publish TF transformer.

A. Steps to Interface ROS with Arduino


The open-source Robot Operating System is a well-documented framework that help you to explore all the features and
functionalities on a long list of operating systems. You have available all the information to setup the ROS in minutes on Linux
and start using the ROS with Arduino.
Here are the steps to setup the ROS for Arduino:
– Setup the Arduino IDE and rosserial on Raspberry Pi 3 (Linux) for Arduino – this tutorial shows you how to setup the Arduino
IDE to use rosserial that allows the communication between ROS and the serial port of the Arduino board.
– From this tutorial you can learn how to setup a virtual machine with Ubuntu and ROS on Windows machine.
– This tutorial show you in details how to setup ROS and Arduino IDE on Mac OS X;
Examples of ROS and Arduino.
– The “Hello World” example,
Every new project starts with a “Hello World” example. The best way to enter into the world of ROS and Arduino is also
to build the “Hello World” application. Here is the tutorial that shows you how to run the first application for ROS and Arduino
using the rosserial.
In the following, I explore several other tutorials about how to use the ROS framework and Arduino board. From the
beginning, you can start using this series of ROS tutorials for beginners that uses rosserial_arduino package for a long list of
applications. Arduino Double Sonar With ROS – this example shows you how to use the Arduino together with ROS and build a
simple double sonar application with PING))) sensors. Sending Data from Arduino to ROS – a comprehensive tutorial from where
you can start digging to find how the Arduino board to send data to the ROS. Android + Arduino + ROS – with these, you enter
into the area of advanced applications where a ROS compatible robot based on Arduino board can be controlled via an Android
device.

V. WORKING
The main aim is to control the speed of the motor. As there are lots of components, the main aim is to reduce the number of
components. There are a lot of components from ATMEGA328 to the bridge motor driver. Considering the Arduino UNO board,
only the ATMEGA328 microcontroller is needed from the Arduino other components are not as so important, so that require
ATMEGA328 hence printed a PCB with the help of PROTEUS. Thus after the design have printed the PCB accordingly. Then,
the circuit is soldered with lead and the connections are being made. After that, this PCB can be used to control the speed of the
motor.

Fig. 2: Block Diagram

All rights reserved by www.grdjournals.com 11


Speed and Position Control of a DC Motor using ATmega328
(GRDJE/ Volume 4 / Issue 4 / 002)

A. Results

Fig. 3: Working Model

VI. CONCLUSIONS
Thus a PCB has been developed using which that can control the speed of the motor. The PID logic is implemented in the motor
using the Arduino UNO ATMEGA 328 micro controller. Proteus design is made and PCB is printed. The final printed circuit
board will be able to control the motor using PID logic. This product is very compact in and it has been reduced to a single
component. This will be robust than the method where that use motor driver, Arduino UNO and ATMEGA 328 as these three are
very fragile in nature as they are being built in plastic. This board is comparatively strong as the medium here is Cu(Copper). This
particular motor drive will find its use in most of the automation industries as there are a lot of motors being used in the current
scenario. Even in the electric cars, there are requirements for these kinds of uses as motors need to be controlled. In these cases,
with proper research and development, these can be developed into further rugged components where they can be used in such
cars. They are also cheap when compared to the currently used circuits. These circuits can also be used in most of the areas where
motors are used and the speed of these motors can be controlled efficiently using programs and printed circuit boards as used in
this project. These can be made as compact and as efficient as possible with proper programming and PCB printing.

REFERENCES
[1] Shivanand Pandey et al, DC Motor Torque Control using Fuzzy Proportional-Derivative Controllers, ISSN: 2249 – 8958, Volume-3 Issue-6, August 2014.
[2] LadislavJurišicaet al, Mobile robots and their subsystems, AT&P journal PLUS1 2008.
[3] Muhammad Rafay Khan et al, Speed Control of DC Motor under Varying Load Using PID Controller, International Journal of Engineering (IJE), Volume
(9) : Issue (3) : 2015.
[4] J. Borensteinet al, Mobile Robot Positioning & Sensors and Techniques Invited paper for the Journal of Robotic Systems, Special Issue on Mobile Robots.
Vol. 14 No. 4, pp. 231 – 249.
[5] SitiNurmainiet al, Modeling of Mobile Robot System with Control Strategy Based on Type-2 Fuzzy Logic, Volume 2 No. 3, March 2012 ISSN 2223-4985
International Journal of Information and Communication Technology Research.
[6] Tayfun Abu, Modeling and Optimal Control of a DC Motor, International Journal of Engineering Trends and Technology (IJETT) – Volume 32 Number 3-
February 2016.
[7] Yukio Hasegawa, Professor Emeritus Waseda University 1-7-12, Motocho Urawa-ku Saitama-shi, 330-0073, Japan, Volume 2 No. 3, March 2012 ISSN
2223-4985 International Journal of Information and Communication Technology Research.
[8] Max Schwarz, Hybrid Driving-Stepping Locomotion with the Wheeled-legged Robot Momaro.
[9] Katie Bylet al, Dynamically Diverse Legged Locomotion for Rough Terrain.
[10] Steve Scott, Motor Control Learning and Performance, February 2002.
[11] Zhu Haishui et al, Design on a DC Motor Speed Control, International Conference on Intelligent Computation Technology and Automation 2010, Accession
Number: 11467161
[12] Santosh Kumar Suman et al, Speed control of DC motor using optimization techniques based PID Controller, 2016 IEEE International Conference on
Engineering and Technology (ICETECH) 2016.
[13] Jamal A. Mohammed, "Modeling Analysis and Speed Control Design Methods of a DC Motor", Eng. & Tech. Journal, vol. 29, no. 1, 2011.
[14] K.H Ang, G.C.Y. Chong, Y Li, "PID control system analysis design and technology", IEEE Transactions on Control Systems Technology, vol. 13, no. 4, pp.
559-576, 2005.
[15] V. Antanio, "Research Trends for PID Controllers", ACTA Polytechnicia, vol. 52, no. 5, 2012.
[16] A. S. Othman, "Proportional Integral and Derivative Control of Brushless DC Motor", European Journal of Scientific Research, vol. 35, no. 2, pp. 198-203,
2009.

All rights reserved by www.grdjournals.com 12

You might also like