Neural Network Based Closed Loop Speed Control of DC Motor Using Arduino Uno.
Neural Network Based Closed Loop Speed Control of DC Motor Using Arduino Uno.
Neural Network based Closed loop Speed Control of DC Motor using Arduino Uno.
Neerparaj Rai#1, Bijay Rai#2
Electrical and Electronics Engineering Department, Sikkim Manipal University Sikkim, India
Abstract This paper presents the design and implementation of Arduino Uno based DC motor speed control system using Multilayer Neural Network controller and PID controller. A model reference structure is developed using PID control to obtain the neural controller .The artificial neural network is trained by Levenberg-Marquardt back propagation algorithm. Feed forward neural network with two hidden neurons and one output neuron is used. Speed of the dc motor is controlled by varying the duty cycle of the pwm signal which is fed to the gate of the mosfet irf 640. Simulation and practical results are presented to demonstrate the effectiveness and advantage of the control system of DC motor with ANNs in comparison with the conventional control scheme in Matlab/Simulink R2009b. PID algorithm and ANN controller is implemented in Arduino Uno because of its easy compatibility and portability. KeywordsDC motor, Arduino, Artificial neural networks, Atmega 168. Introduction
methods mentioned before: model reference direct inverse control and indirect adaptive control. The proposed method uses Levenberg-Marquardt back-propagation training algorithm and is desired to track a reference model. The method can be considered as a direct controller design. Although it does not require any knowledge of the system dynamics, it requires the sensitivity of the controlled system. This paper describes a method of implanting a fully connected multi-layer neural network with multi-layer connections on a very inexpensive Atmega 168 microcontroller I. DC MOTOR CONTROL WITH ANN A dc motor is widely used for control purposes because of its stability and straight forward characteristics. For effective analytical purposes, mathematical models are indispensable. The separately excited dc motor is the simplest of all dc motors and it is the one most commonly found in industrial applications. A. Mathematical model of DC motor: The separately excited DC motor is described by the following equations: KFp(t) = Raia(t) La[dia(t)/dt] + Vt(t) (1) KFia (t) = J[dp(t)/dt] + Bp (t) + TL(t) (2) where, p(t) - rotor speed (rad/s) Vt (t) - terminal voltage (V) ia(t) - armature current (A) TL(t) - load torque (Nm) J - rotor inertia (Nm) KF - torque & back emf constant (Nm/A) B - viscous friction coefficient (Nms) Ra - armature resistance () La - armature inductance (H)
DC motors are one of the most widely prime movers in industry today. There are many ways for DC motor speed control such as Proportional-Integral-Derivative (PID) control, state space control, digital PID control and others. However, Artificial Neural Networks (ANN) have emerged as a tool for difficult control problems of unknown non-linear systems. Neural networks are used for modelling and control of complex physical systems because of their ability to handle complex input output mapping without detailed analytical models of the systems.
There are several control strategies for neural networks such as: 1) Feed forward control, 2) Direct inverse control (extracting inverse dynamics), 3) Indirect adaptive control method based on NN identification, 4) direct adaptive control with guarantied stability, 5) Feedback linearization, 6) Predictive control [1]. In the direct inverse control method, a MNN is trained by specialized back-propagation algorithm [2]. From these equations mathematical model of the DC motor This method has attracted much attention in recent years can be created. The model is presented in Fig1. Where, because it is intuitive, and simple to be implemented [3]. Ta -Time constant of motor armature circuit, Ta=La/Ra(s) However, the plant to be controlled may not have a unique or and, stable inverse, which is the drawback of direct inverse Tm Mechanical time constant of the motor Tm=J/B (s). dynamics method. In this study, a control strategy is proposed for the real time control of single-input single-output linear and nonlinear systems. The proposed method resembles previous two
ISSN: 2231-5381
http://www.internationaljournalssrg.org
Page 137
B. PI control method: Firstly, for controlling the speed of DC motor PI control strategy is applied. The block diagram for the PI control is developed in Matlab/Simulink and the transfer function for the PI control is obtained using Ziegler-Nicholas method.
There are different methods to synthesize control systems of DC motor, but for a comparison with method using ANNs, a conventional PI control of DC motor is used. The plant obtained in fig2 is used as the reference model to obtain the input and target samples. C. The control system of DC motor using ANNs: A neural network comprises simple elements operating in parallel. In fact, it is a massively parallel distributed processor that stores experiential knowledge and makes it available for use when needed. In using neural networks for system identification, training data can be obtained by observing the input-output behaviour of a plant. If previous values of the input and output are present, the future value can be predicted as:
The network is trained for 500 second applying a 0.2 Hz square wave to the reference model. The load was 10gm-cm during training. The architecture of the proposed ANN controller in MATLAB Simulink is shown in Fig. 4.
ISSN: 2231-5381
http://www.internationaljournalssrg.org
Page 138
D. Implementation in Arduino Uno Fig.5 shows the block diagram of Design and Implementation of Arduino Uno Based Speed Control of DC Motor. The input for the set speed is given through GUI built in MATLAB. The data processing unit contains Arduino Microcontroller Atmega 168 unit. The DC motor driver circuit is a mosfet which is configured as a switch and it is driven from the microcontroller PWM 0 output. The DC motor module consists of speed sensing unit and DC motor. Speed sensing unit consists of an opto coupler MOC7811 and an optical encoder, which will give train of pulses with some frequency depending upon the speed of the motor. The DC motor used is less weight, low power consumption and high speed etc. The lifetime of the motor may vary from a few hundred hours to more than 10, 000 hours. The specifications of DC motor used in the present study are shown in Table 1.
TABLE I
SPECIFICATIONS OF DC MOTOR
The output unit consists of 162 liquid crystal display to display the measured DC motor speed in RPM with the help of microcontroller. The measured speed also plotted in GUI with the help of serial communication through serial port COM3 and Arduino Uno. II. SIMULATION RESULTS The dc motor model is simulated with the PID controller and ANN controller which is obtained after offline training. The dc motor with ANN controller is also simulated with different waveforms of reference signal. The controller parameters are tuned in MATLAB using Ziegler Nichols method (kp=0.1617, ki=0.7177 and kd=0.0) and the results of the best tuned PID controller are presented. To obtain the neural controller, first the training was completed with mean squared error of 0.003 then off line performance of the controller was tested for different waveforms of reference signal and different load conditions.
Fig. 7 shows the regulation of speed at different levels for both conventional PID control method and ANN control. Maximum overshoot is more in case of PID control which is 16.7% compared to 5.8% in case of ANN control. Motor takes a longer settling time of 1.3 sec for PID control whereas the motor takes only 0.2 sec with ANN control. To implement the neural controller in Arduino, 278 training samples were obtained out of which 10% each was used for validation and testing and rest 80% for training. After the implementation of ANN and PID in Arduino, the speed response of the motor is with both the controllers is shown in Fig. 8.
ISSN: 2231-5381
http://www.internationaljournalssrg.org
Page 139
methods. ANN control can be used for control mechanism of machines with complicated load patterns. ACKNOWLEDGMENT The authors thank Prof.D.Suryanarayana for technical assistance and guidance. .
[1]
REFERENCES
Choi Y. K., Lee S. K., Kay Y.C., Design and Implementation of an Adaptive Neural Network Compensator for Control Systems, IEEE Transactions on Industrial Electronics, vol 48, April 2001. S. Hykin, Neural Networks , Macmillan, NY, 1994. Psaltis D., Sideris A., Yamamura A.A., Multilayer Neural Network Controller. IEEE Control System Magazine , pg 17-21, 1988. Adepoju G. A, Aborisade, D.O Eluwole O. T., Speed Forecast of DC Motor Using Artificial Neural Network, International Journal of Applied Science and Technology, Vol. 1 No. 6,November 2011. Phan Quoc Dzung, Le Minh Phuong, Control system DC motor with speed estimator by neural networks, IEEE PEDS 2005. N. Madhusudhana Reddy, K. Nagabhushan Raju,C. Chandra Mouli and D.Chandrasekhar Reddy, Design and Implementation of Arm Cortex based Speed Control of DC Motor, International Journal of Industrial Electronics and Control, 2012,Volume 4, pp. 53-60. Mr. M.V.Sudarsan Dr. G.R.K. Murthy Mr. G.R.S. Naga Kumar, Desinging Of Ann Based Speed Controller For Phase Controlled Dc Motor , IJEST 2011, 7 July, Vol. 3 Carmadi Machbub, Ary Setijadi Prihatmanto, Yoseph Dwi Cahaya, Design and Implementation of Adaptive Neural Networks Algorithm for DC Motor SpeedControl System using Simple Microcontroller , Indonesia, IEEE PEDS,2001 Akhilendra Yadav, Gurleen Kaur, Akanksha Sharma, Microcontroller Based Open-Loop Speed Control System For Dc Motor, IJREAS Volume 2, Issue 6 (June 2012).
[5] Fig8. DC Motor speed response with ANN and PID. (Set speed=200rpm) [6]
III. CONCLUSION A closed loop speed control of DC Motor was developed using Atmega 168 Arduino microcontroller. PID and ANN control was successfully implemented in Arduino microcontroller and was tested on a DC Motor speed control system. The system outputs also agreed with the theoritical results indicating better accuracy of the system. Using ANN, there is no need to calculate the motor parameters of the motor when designing the control system. ANN based control has reduced the settling time to 0.2 sec. Hence the overall study indicates an appreciable advantage of artificial neural network control over the conventional control
[7]
[8]
[9]
ISSN: 2231-5381
http://www.internationaljournalssrg.org
Page 140