Fuzzy LogicMixed-Signal Embedded Microcontroller for Controlling DC Motor

DOI : 10.17577/IJERTCONV3IS12033

Download Full-Text PDF Cite this Publication

Text Only Version

Fuzzy LogicMixed-Signal Embedded Microcontroller for Controlling DC Motor

Chithras. T

PG Scholar

Power Electronics and Drives Arigner Anna Institute Of Science and Technology Chennai, India

Jagadeesan. K. J Assistant Professor Dept of Electrical And Electronics Engineering

Arigner Anna Institute of Science and

Technology Chennai, India

Abstract A scheme that addresses on building up such a system as described above is presented in here. As the system is based on the speed controlling of a DC motor, so the desired goal is to achieve a system with constant speed at any load condition. That means motor will run at fixed speed at any load condition. It will not vary with the amount of load. The software is made in such a way that even an unskilled operator can operate it. This system describes the design and implementation of the microcontroller based closed loop DC motor speed controller that controls the speed of a DC motor by using Fuzzy logic controller.

Keywords Pulse width modulation, Fuzzification, Defuzzify I .INTRODUCTION

The speed control of a small permanent magnet DC motor is an essential component of the course 143.335 Instrumentation, Electronics and Control Engineering at Massey University, New Zealand. The laboratory work contributes 30% to the overall assessment for the course. It uses a mixed-signal microcontroller, as the core hardware and programming platform, which the students are taught in another course. With the prior knowledge of the microcontroller, the students could straight away start implementing the project, without having to spend time on learning the platform. Many authors have augmented the conventional textbook presentations by introducing laboratory works in the form of problem based learning to teach the students [1 4]. In problem based learning a specific problem situation is used to focus the learning activities to achieve the target. Applications have been designed to assist students to teach modern embedded computing subjects with the help of computer vision [5]. Computer based simulations and implementations have been developed to illustrate the important practical applications of PID control [6] and measurement procedures for viscous and coulomb friction [7]. These works show how the theory can be used to solve practical problems. In addition some authors [8] have used fuzzy logic algorithms to teach speed control of DC motors with some success. The use of virtual laboratory through REAL (Remotely Accessible Laboratory) for conducting mobile robot experiments

have been reported [9]. Very effective project based learning, in hi-tech education, has been through the use of robot soccer system to implement a multi-agent collaborative system [10].


    Block diagram has following important parts.

    • Permanent magnet dc motor (PMDC motor)

    • Microcontroller atmega-32

    • Motor driver circuit

    • Personal computer

    • Zig Bee module

    • Battery

    Fig. 1 Block Diagram of the Proposed System

    Programming is done using this microcontroller to control the speed and position of dc motor. Following ports of Atmega 32 microcontroller are used for the project work.


    The AVR Microcontroller can control speed of the DC motor accurately with minimum hardware at low cost. The MCU has inbuilt timer and counter register. The algorithm shown in the fig.5.1 describes the speed control program which first

    initializes the timers and I/O ports then reads the commands from the keyboard. Each key is designated with a specific count which is equivalent to different duty cycles. On the basis of the count Microcontroller generates a PWM signal and the motor can be stopped by keying a specific character anytime.

    In this project all of three timers are used:

    ·Timer 0 in Normal Mode was used to count pulses from motor speed encoder.

    ·Timer 1, which has two independent PWM channels, was used to generate PWM waveform to control of the motor speed, one channel for one motor. Timer1 is set on Phase Correct PWM mode.

    Figure. 2. Algorithm for Speed control

    Timer 2 in CTC Mode was used to generate constant time periods. Programming tools used for the proposed work are embedded C to generate PWM for the H-bridge switches using microcontroller and MATLAB software package where graphical programming is done to provide Graphical User Interface.

    Fast PWM Mode Duty Cycle

    Duty cycle can be calculated by using equation 1. The duty cycle can be determined using the OCR0 register, bigger OCR0 value results in a bigger duty cycle. When OCR0 is 255, the OC0 is 256 clocks out of 256 clocks, which means duty cycle is 100percent.


    DC motor converts electrical energy into mechanical energy. DC motor is used in applications where wide speed

    ranges are required. DC shunt motor exhibits a drooping speed- torque characteristic. The speed of the DC motor is given by

    z P

    z P

    N V Ia Ra . A k. V Ia Ra

    Hence, the speed can be controlled by varying,

    1. Flux/pole (). Field Control Method

    2. Voltage of armature circuit, by varying Ra, Armature Control Method.


    In most of the adaptive fuzzy controllers, attempt is made to change the Rule Base to make the system adaptive. In the scheme proposed, such a result is achieved by adjusting the defuzzifier as a function of the system response. Also it is possible to regulate the parameters of the time domain response. The block diagram of the system with the proposed FLC is shown in Fig 5. A new functional block called the Error Interpreter is added to the basic system of Fig 2.The function of the block is to sense the error, identify its ranges. And determine the location of the singletons.

    In this method, the error and error rate are used to change the supporters in the motor voltage singletons. The defuzzified output of controller is given by



    Where PL, PS, NS. And NL is the inference membership values and PLVC, PSVC, NSVC, and NLVC are the corresponding supports of change in the motor voltage singletons. In the new method, the error signal is fed to an interface that changes the value of the supports.

    The magnitude of output error is divided into ranges covering (100 40 ),(40 – 20), (20 – 5), and (5 – 0) percent of the maximum output. For a lower range of error, the supports are multiplied by a coefficient less than unity (around set point) and for higher ranges, the supports are multiplied by a coefficient greater than unity. The following method is suggested for controlling the time response parameters:

    Range 1: (100 40). This range is used to effectively control the rise time and to obtain maximum overshoot. If the coefficient of supports is increased, the rise time is decreased and vice versa.

    Range 2: (40 – 20). The variation of the coefficient during this range will affect the maximum overshoot by about 80% and the variation in each of ranges 1 and 3 will affect by about 10%.

    Range 3 and 4: (20 5) (5 0). The coefficient of this range has the maximum effect on the steady state oscillations. If the coefficients are larger, the oscillations will persist for a longer time and thus the setting time will be more.

    Fig.3. Block diagram of system with proposed FLC

    <>The steps in designing the controller are:

    1. Identify the variables (inputs, states and outputs of the) of the plant.

    2. Partition the universe of discourse or the internal spanned by each variable into a number of fuzzy subsets, assigning each a linguistic label.

    3. Assign or determine a membership function for each fuzzy subset.

    4. Assign the fuzzy relationship between the inputs or states, fuzzy subsets on the one hand and the outputs fuzzy subsets on the other hand, thus forming the rule base.

    5. Choose appropriate sealing factors for the input and output variables in order to normalize the variables to the [0,1] or [-1,1] interval.

    6. Fuzzify the inputs to the controller.

    7. Use fuzzy approximate reasoning to infer the output contributed from each rule.

    8. Aggregate the fuzzy outputs recommended by each rule.

    9. Apply defuzzification to form a crisp output.

    Thus based upon these rules fuzzy logic controller is designed and can be suitable for any kind of control applications.


    The details of the above symbols are as follows: Va the applied armature voltage

    La the armature inductance Ra the armature resistance Eb the back e.m.f

    K the back e.m.f. or torque constant

    the angular speed of the motor Tm the developed motor torque

    J the moment of inertia of the motor including load B the viscous co-efficient

    Tl the applied load torque.

    Fig 4. Illustrates Membership for Fuzzy Variable speed in R.P.M

    Fuzzy control rules



    To develop a model of DC motor speed control using Matlab/Simulink the following equations are used for the modeling. The equations of armature circuit


      Fig.5. Transient speed response of the microcontroller generated PWM driven motor under open loop condition


      Fig.6. Pulse Width Modulation based DC motor controller


    Fig7 . Fuzzy logic based DC motor controller


In this paper Fuzzy controller has more design parameters, based on empirical software rules, more suitable to satisfy non- linear criterion in all operation range compared with PID controller (satisfy linear criterion), which is based on a hardware components. In conventional PID controller design, mathematical model of the system must be derived then a mathematical model of a controller could be developed. But, in fuzzy logic controller design, no need for mathematical representation of the system because it depends basically on human experience, hence, its easier, to design the controller to such system. In fuzzy logic controller design for speed control of D.C motors by controlling on firing angle value of the bridge converter, also the fuzzy logic controller takes the difference between the reference rotated speed and the actual motor speed and then gives appropriate firing angle to reduce the first error between the reference and the actual rotated speed. In PID controller the armature voltage of a separately excited D.C motor is varying between (230 – 265) V, while in fuzzy logic controller is varying between (145 – 265) V.


  1. M. Hedley and S. Barrie, An Undergraduate Microcontroller Systems Laboratory, IEEE Transactions on Education, Vol. 41, No. 4, pp 345 (1998).

  2. D.L.Maskell and P.J.Grabau, A Multidisciplinary Cooperative Problem-Based Learning Approach to Embedded Systems Design, IEEE Transactions on

    Education, Vol. 41, No. 2, pp 101 -103 (1998).

  3. J.W.Bruuce, J.C.Harden and R.B.Reese, Cooperative and Progressive Design Experience for Embeded Systems, IEEE Transactions on Education, Vol. 47, No. 1, pp 83 91 (2004).

  4. ] M.Mazo and J.Urena , Teaching Equipment for Training in the Control of DC, Brushless, and Stepper Servomotors, IEEE Transactions on Education, Vol. 41, No. 2, pp 146 158 (1998).

  5. A. Hoover, Computer Vision in Undergraduate Education: Modern Embedded Computing, IEEE Transactions on Education, Vol. 46, No. 2, pp 235 240 (2003).

  6. R.Kelly and J.Moreno, Learning PID Structures in an Introductory Course of Automatic Control, IEEE Transactions on Education, Vol. 44, No. 4, pp 373 376 (2001).

  7. R.Kelly, J.Llamas and R.Campa, A Measurement Procedure for Viscous and Coulomb Friction, IEEE Transactions on Instrumentation and Measurement,

    Vol. 49, No. 4, pp. 857 861 (2000).

  8. S.Saneifard, N.R.Prasad, H.A.Smolleck and J.J.Wakileh, Fuzzy- Logic-Based Speed Control of a shunt DC Motor, IEEE Transactions on Education, Vol. 41, No. 2, pp 159 164 (1998).

  9. E. Guimaraes, REAL: A Virtual Laboratory for Mobile Robot Experiments IEEE Transactions on Education, Vol. 46, No. 1, pp 37

    42 (2003).

  10. G. Sen Gupta, Lim Y. S., Messom C. H., S. Demidenko, S.C. Mukhopadhyay and D. N. Pinder , Robot Soccer: Integrated Framework for Multidisciplinary Hi-Tech Education Proc. of 6th International Conference on Computer Based Learning in Sciences, Cyprus, pp. 322- 333 (2003).

  11. M. T. Chew and G. Sen Gupta,Embedded Programming with Field- Programmable Mixed-Signal u-controllers, Silicon Laboratories, Austin, TX, US, 353p. (2005)

Leave a Reply