Control The Speed Of The DC Motor Engineering Essay
Disclaimer: This work has been submitted by a student. This is not an example of the work written by our professional academic writers. You can view samples of our professional work here.
Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.
Published: Mon, 5 Dec 2016
Direct current (DC) motor is applied in a wide range of applications particularly in automation technology due to minimal voltage consumption. In the proposal DC motor plays an effective role in Hardware implementation. The main principle behind the project is to use the cascade control to run the DC motor; it’s one of best feedback controllers. For estimating the velocity and the armature current of the DC motor with 24 volts and a dsPIC Microcontroller is programmed .The above all operation is done in a closed control loop function.
Table of Contents
2. Specific Aims of the project
Brushed DC Motor
DC motor model
Digital control of dc motor
Advantages of dc with respect to speed control
Analogue control of dc motor
2.1 ds PIC
2.2 MPLAB IDE
3. Design and Research
Speed loop dynamics
3.1 Components for controlling 24v brushed Dc motor
3.1. Flexible inverted board
3.2.1 Generating PWM wave forms
3.1.2 H-Bridge converter
3.2 Software techniques used in DC motor
Programming microcontroller in Flexible inverted board
4. Results and Discussion
List of Figures
FIGURE 1: Operation of BRUSHED DC Motor
FIGURE2: General block diagram of speed loop and current loop of DC Motor
FIGURE3: H-bridge converter with different voltage VÎ± & VÎ²
The main function of the project is to control the speed of the DC Motor using a dsPIC30f3010 microcontroller. For that implement a separate hardware to satisfy the main function of the project.
1.2 Specific Aim of the project
In order to achieve the main core of the project, construct Hardware for controlling the speed control of DC motor. The main hardware requirements are
ds PIC microcontroller
ICD interface & connector for system interface
DC power supply
The above components are required to construct a hardware called Flexible Inverted Board .
1.3 OUTLINE OF PROJECT
In this paper a flexible inverted board is constructed with the series of hardware components
Then communicate the Flexible inverted board with system using MPLAB IDE software with ICD-3 interface .the language used in the MPLAB software is C-language.
The speed loop and the current loop are the two important functions for controlling the speed of the Dc motor. In our project the key point is to control both the loops by C-programming language using MPLAB ICD-3.
The speed loop of the microcontroller is called speed controller and the current loop of the microcontroller is called current controller.
THEORITICAL TECHNIQUES AND THEIR REVIEWS
2.1 Brushed DC Motor
In automotive industries DC motor is used widely in “fuel pump control, electronic steering control, engine control and electric vehicle control” for its cost effective and it is used in many applications like “pulp and paper industries, fan pumps, press, winder motors” ,”home appliances, washers, dryers and compressors” are some of the best examples. DC motor is one of the important hardware employed in this paper, it consists of a rotor and stator, and the parts are placed in a permanent magnetic field. Commutator and brush are placed in between the rotor and stator. Positioning the brush at a particular direction in the rotor is classified into some categories and they are “radial, trailling or leading”  positions. When the rotor rotates the commutator and carbon brush interface at a point, which produces an enormous amount of magnetic field from the brush of the motor and it produces current to the armature winding of the Dc motor.
FIGURE 1: Operation of BRUSHED DC Motor[a]
2.2 DC Motor model 
Each motor will have different specification and requirements. According to motor requirements and details the model can be designed. The aim of motor model, deals with controlling the applied voltage of both speed and current. The basic model for a Dc Motor is shown below
FIGURE2: DC Motor model
The above diagram is a simple RL circuit. RL circuit is called resistance inductance circuit
and a 24v DC Motor. All these components combine to form RL circuit.
Now the derivation part of the RL circuit is explained below
T (t) = J
w is the Angular velocity
J is the moment of inertia
B is the friction
T is the armature Torque
T (t) = (t)
is the Torque constant
is Armature current
According to Kirchhoff’s law
(t) – (t) = (t) +
and are the inductance and resistance for the armature current (ia)
The electromotive of the motor can be determined by multiplying the back emf with speed
The relationship for the electromotive force is shown below
The state model for any DC motor using ia and w (speed) is mentioned below.
2.3 ds PIC -microchip
ds PIC stands for Programmable Interface Controller or programmable intelligent computer, which act as an important controlling unit for entire system. The main objective of this project is to make the ds PIC to generate 6PWM waveform. In an ideal condition the waveform from the pulse width modulation can control the H-bridge converter. It not only serves as an interface controllers but also plays a role of a programmable logic controller (PLC). [16,20]
ds pic has a memory of 16bit microcontroller that has two major functions. Firstly it can act as a software part serving software functions and the other is a hardware part serving hardware functions.
The input signals that are attain from the feedback serve system are received by the software part which in turn utilizes the codes that are written on the chip on C – language to analyze the input and operate the hardware. Finally the software makes sure the hardware runs based on the software functions to gain the required output. [18, 20]
Our project concentrated on working experiments that were run at lab conditions. Since a couple of systems have certain differences from the stimulation that have been run in real conditions compared to ideal conditions. This in turn is the working of the microcontroller.
dsPIC30F 3010, 2010 4011 and 3012 are the series of chips that have been available in the Lab. The letter ‘F’ in ds PIC30F and such chip states that the chip contains flash memory. The reason for considering this flash memory product is because 30F has an ex-ordinary performance when compared to EPROM (Erasable Programmable Read-Only Memory) and one time programmable chips (OTP). This has been a major requirement for the running of this project to get the required output.
16-bit modified Harvard architecture has been added to the CPU containing ds PIC30F for utilizing the data and upgrading the set of guide lines for running digital signal processing (DSP) . There is a lengthy flexible opcode field which has been installed in the CPU that has a 24 bit wide user programmer memory area and the total addressing speed can go up to 4MÃ-24 bit. This programming model has sixteen 16bit working registers in ds PIC30F chip. There are two classes of introduction controlling unit that have been integrated and used for execution they are integrated and used for execution .
2.3.1 dsPIC30F 3010
This section is about the pin configuration and the components available in dsPIC30F3010 microcontroller. Normally the memory allocation in dsPIC30F 3010 can classified in to three categories they are
SRAM in Bytes
EEPROM in Bytes
Programmable memory in Bytes/instruction
SRAM stands for static RAM (Random Access Memory). According to the tabulation shown below the data limit for static RAM should not exceed 1024 bytes. The memory in the function can classified in two types they are
X – Data RAM
Y – Data RAM
The static RAM uses X -RAM and Y_RAM for storing datas.
The memory allocation for EEPROM is same as static RAM. In read only memory one of the important types of ROM used to store memory is EEPROM. The main function of this ROM is based on two parameters they are endurance and retention . Endurance is to retain the data even after the ROM fails. Therefore the data can’t be deleted at any instant. Time period is required to store data that is taken care by retention .
In a particular program ds PIC30f microcontroller has a separate memory allocation for storing both the address and data. The memory limit for the program memory is 24K.
program address space anda data address space
TABLE 1: Tabulation for memory allocation in ds PIC30f3010
The pin configuration of dsPIC30f3010 is described below
FIGURE 3: Pin configuration of dsPIC30F 3010
(PWM1L and PWM1H), (PWM2L and PWM2H) & (PWM3L and PWM3H)  these are six different types PWM channels used in the pin configuration. In which each PWM pair generates three duty cycles with one high output (H) and one low output (L).
INT0, INT1&INT2 are the interrupt buffers used in the PIC. VSS and VDD  are the supply voltage and ground in the PIC controller.
U1RX & U1TX, U1ARX & U1ATX  are the series of pins used for communicating PIC microcontroller with PC, in other system interface operation can be done by UART function. In that RX stands for receiver and TX stands for transmitter. The above pin function plays an important in our project.
3.1 Components for controlling 24v brushed Dc motor
Since the project is fully based on hard ware so many components are available and how they work in that operation.
3.1.1Cascade control operation in Dc Motor:
The below operation is done by using Double cascaded layout, it consists of two loops they are current controller with current reference and speed controller with speed reference  as shown in .
FIGURE4: General block diagram of speed loop and current loop of DC Motor [b]
The current loop is covered by the speed loop, in the block diagram it has the two circles inner circle is called inner loop and the outer circle is called outer loop since the inner circle operation is always quicker than the outer circle. In other words inner circle performance is multiple of ten times quicker than the remaining one. The cascade control principle is mainly used in our project to maintain the speed of the motor at a constant level and the current loop in the cascade control is the armature current and it is otherwise called as torque. Sometimes armature current may exceed the limit to avoid this situation in cascade control, it has limiter, and the main function of the limiter is to limit the values of the armature current. For example To limit the armature current to 64volt i.e. 1 ampere. So that the armature won’t exceed those limits since the limiter is available in cascade control. The speed controller in the cascade control used to produce demand current ia*. The motor runs to overcome the demand current values. The demand current value will always higher than the normal current values. So that the speed motor gradually increases.
PI controller(proportional Integral controller)
The above all components construct a cascade controller and the function each component is described below
126.96.36.199PI controller (proportional and integral controller)
In cascade controller function various controllers are used for detecting the speed and control of the motor, but PI controller is recommended as high efficient controller because it consist to constant gain Kip and Kid. By manually tuning the gain of both Kii and Kpi will reduce the steady state error and the stability of the system will be increased. In recent survey more than 70% cascade controller used PI controller for controlling the speed control DC Motor. In order to reduce the steady state error in the closed loop system, gradually increase the proportional gain constant Kp. As the gain of the Kp increases the steady state error in the system decreases. But the stability of the system will not be stable. To make the system stable, integral term Ki is introduced in the system. When both the proportional and integral term sum each other to reduce the steady state error and make the system stable .the above two functions can be done simultaneously in the PI controller. The mathematical expression for PI controller is explained below.
FIGURE 5: PI controller of a closed loop function 
Y- Output of the PI controller
Err-Error in the PI controller
At the beginning error (Err) will pass through both Kp and Ki.
For proportional gain the output is Kp Err
y1= Kp Err eqn1 
y2 = eqn 2 
y = y1 + y2 eqn 3 
eqn 4 
The key point in this PI controller is the error Err in intergral gain Ki will be integrated. so that the steady error will be reduced and the system will be stable.
The current controller in the closed loop functions of the cascade control. The current loop is also called as current controller. It is used to protect cascade circuit from damage. The main function of the cascade function is to control the speed. Before controlling the speed the current of the controller should be controlled. The current obtained from the closed loop function is from armature circuit of the DC Motor .the input in the current controller is the back emf (ia*).
Power converter is mainly used to improve the control in the system. It has high switching frequency, since the power converter in the current loop is very quick. The output of the converter is armature voltage (Va).
(-E) is the disturbance occurred in the current loop, in order avoid the disturbance
FIGURE 6: Functional block diagram of Current controller
The disturbance is added along with RL circuit, and the equation is shown below
Va = (S La + Ra) ia + E
The function of the RL circuit is reduce complexity
Va is Armature voltage.
ia is armature current (trying to control)
Ra is Armature resistance
E is Disturbance
RL = 1/(S La + Ra)
Current loop is carried out by transmitting the from ia(armature current) to ia*(demand armature current). As quick as possible without making the over shoot getting so high. If the over shoot is high it creates problem to the converter. Similarly when the gain values (Kp and Ki) increases in PI controller the over shoot value reduces, but the same time there is more amount of oscillation which may affect the system. Care should be taken in choosing both Kp and Ki values.
FIGURE 7: graph for armature current vs settling time
ia – Armature current
ia* – Demand armature current
ts – Settling time
3.1.2 Flexible inverted board
The major hardware has been designed and implemented as Flexible inverted board.
It consists of many components they are dsPIC30F3010 microcontroller, H-bridge converter and dc motor. The functions of these hardware components are explained earlier. The above all operation is implemented in a single hard ware called flexible inverted board.
FIGURE 8: Functional block diagram of Flexible inverted board
188.8.131.52 IR2130 gate drive circuit:
There are three input signal generator blocks which are capable of providing two outputs each gives the inputs to the six output drivers. L1, L2 and L3 are signal generators which drive precisely the three low-side output drivers although H1, H2 and H3 signal generators must be level shifted before it is fed to the high-side output drivers.
The floating points of the driver, gate charge requirements of the power switch and the maximum power switch “ON” times receives power from three bootstrap capacitors C1, C2 and C3. Bootstrap capacitors also feed supply to the internal floating driver current. Once these energy requirements are met there must be considerable amount of charge still on the 8.3V nominal to prevent stopping. D7, D8 and D9 should be super-fast.
VCC level seen by an under-voltage detector circuit gives an input to outlaw six outputs of the signal generator circuits. Current sensor R1 derives the ITRIP signal in the main power circuit of the motor when it is segregated with a 0.5 volt reference to outlaw the six signal generator outputs. ITRIP inputs sets up a fault logic circuit which in turn gives open drain TTL output for system gesture.
FIGURE 9: Circuit diagram for IR2130 gate drive circuit
184.108.40.206Trim port function with PWM
Trim port are small in size and they are very small in size .it is mainly used in many PCB construction board since it’s occupies less space.
The trim port act like a potentiometer and it is otherwise called as trimmer [ ]. By tuning the trim port, resistance value can be minimized or maximized. For example if a 50ohm resistance can be tuned by trim port from 0 – 50.
The two leg of H-bridge converter produce two pulse wave form one with low output (1L) and another one with high output (1H). The duty ratio of the PWM wave form can adjust using trim port.
220.127.116.11DC MOTOR ENCLOSED WITH A ENCODER
The best methods of calculating the speed of the DC motor is using optical encoder method. It consists of a disk, Light Emitting Diode (LED) and optical sensor . The disk is fitted with the rotor, as the rotor rotates the disk starts spinning along with the rotor and it is placed in between the LED source and the light sensor. Once the rotation starts the disk passes through the LED source and the optical sensor gets started, from which the speed of the motor can be calculated because the optical sensor acts like a tachometer. In other words the encoder in the DC motor is otherwise called as speed detecting sensors. 
18.104.22.168 H-Bridge converter
DC motor runs differential speed, but the applied voltage of the motor varies at every interval of time. Since the voltage is directly proportional speed, as the voltage increases the speed of the motor also increases. Speed can be calculated by tachometer which is in build in the DC motors, the applied voltage can be supplied and controlled by a converter called h-bridge converter.
GD – Gate Drive Circuit
FIGURE 10: H-bridge converter with different voltage VÎ± & VÎ²[c]
In this H-bridge circuit it produces two unipolar pulse width modulations because it has two leg inverter. Effective modulation takes place only in the first half of the inverter. As a result two variable voltages are generated on either side of the armature winding.
In H-bridge, modulation index is represented as (+mi) and the reciprocal of modulation index is represent as (-mi).the motor in our project actually experiencing two pulse width. Both the pulses are inversely proportional to each other producing a unipolar PWM.
The two legs in the converter are called the switching signals or switching frequency. Bigger converter relatively has lower frequency and smaller converter has higher frequency. If the frequency in the leg1 is high in contrast the frequency in the leg2 will be low.
In our project consider VÎ± and VÎ² are the switching channels of the H- bridge converter . they are inversely proportional to each other.
The carrier signal is called the input frequency . the carrier frequency used in our project is 10khz. According to the carrier frequency the time period of VÎ± and VÎ² differs.
In C coding VÎ± and VÎ² is mentioned as PDC1and PDC2 from the below graph
FIGURE 11 graphical representation of PWM signals in H- Bridge converter.
The output voltage of the h-bridge converter can be obtained both negative and positive voltage distribution . Pulse width modulation in the h-bridge converter helps to control the armature circuit of the DC motor . Maximum armature current (torque) can be obtained by comparing time constant of both field winding and the armature winding . Since the motor is connected directly to the field windings supply voltage in the field winding is more when compared with the armature winding. To maintain equal time constant in both field and armature winding , the applied voltage in the armature winding should be increased, as the armature current increases the torque output is maximized .
3.1.3 Generating PWM wave forms
As the torque output gets maximized, pulse width modulation is introduced in the H-bridge system to avoid the disturbance in the armature current.it can be done by increasing the frequency level of the H-bridge converter at a higher range.
As the torque output gets maximized, pulse width modulation is introduced in the H-bridge system to avoid the disturbance in the armature current.it can be done by increasing the frequency level of the H-bridge converter at a higher range.
FIGURE 12: Diagrammatic representation of the pulse width modulation is shown below 
The below specification is referred from 
Ton – Time is ON (applied voltage)
Toff – Time OFF (applied voltage)
T – Time period.
Duty cycle =.
The average voltage of the DC motor can be shown in an equation below
Average = Duty cycle Ã- Vin 
When the motor is running at a constant speed the back emf of the motor is also remain constant.
As the back emf remain the same the motor running at constant speed and the armature current (Ia) is zero. PWM is one main part that is required for the operation of cascade control.
4. Software used to drive the Motors
4.1 Programming microcontroller in Flexible inverted board using C-language
In the flexible inverter board PIC microcontroller plays a major position in directing the pulse width modulation. The Ton time in the pulse width modulation (PWM) signal can be modulated or controlled by the microcontroller, as the microcontroller varies the time, the velocity of the motor changes with respect to time. The Programing language used in microcontroller is embedded C. The programming codes are downloaded in the microcontroller chip, the downloading approach can be done by a software development tool called MPLAB, this software exists in monitoring the systems, this software should be first installed in the PC, the programmers will write the codes to modulate the PI controller to acquire Applicable source from the current loop of the cascade control function. Once the codes are accepted according to the current loop , the programs can be downloaded in the microcontroller through universal serial bus or in circuit Debugger (ICD); ICD is a bus which interfaces PC system and the flexible inverter Board. 
In order to program the microcontroller examine whether the hardware components are interfaced with the controller. The programming language used for programming the controller is C language. In c-language the data’s are classified in to input data and output data. The microcontroller send the information in analogue signal, where the C-language won’t accept analogue signals .To avoid the situation ADC converter and encoder interface are introduced in the system. ADC stands for analogue to digital converter; it converts the analogue signal in to digital signals. Then the digital signals get received by the C-program as input data. In turns c-program will send the output data to the PWM unit. UART communication system is a bidirectional so that microcontroller and PC can communicate simultaneously. UART stands for universal asynchronous receiver transmitter. The basic diagrammatic representation for system communication with C-language is shown below
FIGURE 13: System communication in C – Programming Language.
In C-language firstly initialise all the functions required for the speed control of motor.
4.1.1Current sensor input:
The current in the motor coils is one important parameter in the effective running of the motor. So it is essential to measure the value of this current. The measurement of the current is performed by using special sensors call Hall Effect Sensors. The range of the current is determined by the rating of the motor. Any over current in the motor can badly damage the motor. The Hall Effect sensors produce a voltage corresponding to the phase current. This is fed to the ADC inputs of the micro controller where it is converted into the digital signals. This is then fed into the microcontroller program. Hence the current needs to be limited within specific limits.CL1, CL2 and CL3 are the three current sensors variables used in this coding. The bit ratio of the ADC input is 10 so the input data ranges from 0 to 1023. The maximum data limit for the current sensor is 1023.so the current sensor value in the C- code is initiated as
CL1 = 511; CL2 = 511; CL3 = 0;
4.1.2 Encoder input:
For any speed controller, the actual speed of the rotor forms the basis for the control signals. The speed control signal can be changed only if there is an error between the actual speed of the rotor and the desired speed of the rotor. If the measured speed is less than the desired speed then the PWM pulses are varying accordingly to increase the speed. To perform this action a shaft encoder is used. The shaft encoder uses an opto-mechanical system to generate pulses.
These pulses then are used to derive the speed of the rotor. A reference pulse is used as an indicator to count the pulse. This information is fed to the microcontroller, which then uses a special timing circuit that processes these encoder pulses. The motor speed to be accessed by the microcontroller needs to be stored in a variable within the micro controller code. The variable used in this program is a variable called rpm. This variable is accessed to calculate all functions related to the motor speed.
4.1.3 Pulse Width Modulation:
The MOSFET’s in the circuit is used as switches. These MOSFET’s are switched according to a PWM. To drive these MOSFETs’ a gate driver circuit is required. The gate drive signal generates the voltage required for the operation of these MOSFET’s. The PWM is generated by the microcontroller according to the program and is supplied to the gate drive circuit. The PWM signals are separate for each if the 3 legs of the MOSFET inverter. Each of the PWM requires a modulation index to generate the signal. These modulation indexes are stored in a register. The registers are named as PDC1, PDC2, and PDC3. These variables are very crucial in generating the PWM signals for the MOSFET drivers. Since data limit is 1023.
4.1.4 Initializing the code in C – language
Before performing any function in C-language, it requires an initialisation. It is important to initializing the variable of a function. Some the functions are initialized below.
Init PORT ()
This function initialize the digital input and output port or analogue input and analogue output of the microcontroller.
Init UART ()
It is one of pin in the microcontroller .The main function of the UART is used for bidirectional communication with PC. Since UART can able to detect the transmission speed in data transfer between the microcontroller and PC. The maximum transmission speed is around 19200.the data transfer won’t exceed the limit.
Init PWM ( )
The input frequency of our PWM signal is 10kHz.the time limit for the modulation index is around 0-1474.in the h-bridge converter has two legs so each leg produces a PWM signal with a maximum time limit of 0-737. Hence the Ton time of PWM signal will be in 1:1 duty ratio.
Init ADC ( )
It is used to convert the analogue signals in to digital signals. In the microcontroller there are five pins reserved for the ADC inputs. During the data transmission ADC functions plays a important role in interrupting the signal. An initialisation is required for the interrupt to perform any function in C- language.
Init CAPTURE ( )
The capture function is mainly used to measure the frequency and time period of the PWM wave form generated from the two legs J30 and J31 pins of the H-bridge converter
InitTimer3 ( ) and InitTimer1 ( )
To set initial time in the microcontroller for the capture function and timer 1 set the starting time for the interrupt function happened in the UART communication system.
Interrupts are occurred only during the data transfer, when the transmission speed that is the baud rate is known means the interrupts can be added to the system easily.in our project the baud rate is 19200.the main function of the interrupt is used synchronize time period of PWM with the speed loop and the current loop of the motor. In our project four different type of interrupt service routine are used.
They are ISR_ADCInterput ( )
This interrupt is triggered when the ADC finishes its conversion and hence its get synchronized to the microcontroller PWM time base. From this all the application control code to be implemented in this interrupts service routine.
ISR_T1Interput ( )
The various information to the PC is transferred by using the UART communication link in this interrupts service routine. All the variables that are needed to be mentioned in this routine using standard C function sprint ( ).
Various information is transferred from the PC in to the C program. This routine concedes us to regulate the aspects of the program when it is running.
It measures the speed value from timing data that are attained in the input capture module.
FIGURE 14 The connection diagram for the speed control of Dc motor is shown above
5 Results and discussion
As discussed earlier the various functions of hardware components in this project, this section discusses the details regarding how the project deals with comparing and evaluating the results. Project has a series of steps; each step is assigned with different operation techniques to execute the final results.
5.1 Initial connection test between MPLAB IDE and Flexible inverted Board
Initially the system needs to be interfaced using the flexible inverter board. This operation is performed by conne
Cite This Work
To export a reference to this article please select a referencing stye below: