Doc speed control of a dc motor using micro controller 8051

21
SPEED CONTROL OF A DC MOTOR USING MICROCONTROLLER 8051 A PROJECT REPORT Submitted by S. Kamal Viswanath (07241A0206) M. Gowtham (07241A0203) P. Ashok Kumar (06241A0205) K. Rohit Naik (07241A0247) in partial fulfillment for the award of the degree of Bachelor of Technology IN ELECTRICAL AND ELECTRONICS ENGINEERING GOKARAJU RANGARAJU INSTITUTES OF ENGINEERING AND TECHNOLOGY JNTU HYDERABAD : 500085 January 2011

description

Speed Control using PWM

Transcript of Doc speed control of a dc motor using micro controller 8051

Page 1: Doc speed control of a dc motor using micro controller 8051

SPEED CONTROL OF A DC MOTOR USING

MICROCONTROLLER 8051

A PROJECT REPORT

Submitted by

S. Kamal Viswanath (07241A0206)

M. Gowtham (07241A0203)

P. Ashok Kumar (06241A0205)

K. Rohit Naik (07241A0247)

in partial fulfillment for the award of the degree

of

Bachelor of Technology

IN

ELECTRICAL AND ELECTRONICS ENGINEERING

GOKARAJU RANGARAJU INSTITUTES OF ENGINEERING AND

TECHNOLOGY

JNTU HYDERABAD : 500085

January 2011

Page 2: Doc speed control of a dc motor using micro controller 8051

GOKARAJU RANGARAJU INSTITUTES OF

ENGINEERING AND TECHNOLOGY

BONAFIED CERTIFICATE

This is to certify that this project report “Speed Control of DC Motor using

microcontroller 8051” is the bonafied work of “Kamal Viswanath,

Gowtham, Ashok Kumar, Rohith Naik” who carried out the project under

my supervision.

SIGNATURE SIGNATURE

P.M. Sharma M. Chakravarthy

HEAD OF THE DEPARTMENT PROJECT GUIDE

ASSOCIATE PROFESSOR

ELECTRICAL AND ELECTRONICS ELECTRICAL AND ELECTRONICS

GRIET, GRIET,

BACHUPALLY, KUKATPALLY, BACHUPALLY, KUKATPALLY,

HYDERABAD-500 090. HYDERABAD-500 090.

Page 3: Doc speed control of a dc motor using micro controller 8051

ABSTARCT

The aim of developing this project is to

control the speed of DC motor. The main advantage in using a DC motor is that

the Speed-Torque relationship can be varied to almost any useful form. To

achieve the speed control an electronic technique called Pulse Width

Modulation is used which generates High and Low pulses. These pulses vary

the speed in the motor. For the generation of these pulses a microcontroller

(AT89c51) is used. As a microcontroller is used setting the speed ranges as per

the requirement is easy which is done by changing the duty cycles time period

in the program. This project is practical and highly feasible in economic point of

view, and has an advantage of running motors of higher ratings. This project

gives a reliable, durable, accurate and efficient way of speed control of a DC

motor.

Page 4: Doc speed control of a dc motor using micro controller 8051

CONTENTS

CHAPTER No. TITLE PAGE No.

ABSTRACT iii

1. INTRODUCTION 1

1.1 DC Motor 1

1.2 Pulse Width Modulation 3

1.3 Microcontroller 6

2. FLOW CHART 8

3. BLOCK DIAGRAM 9

4. CIRCUIT DIAGRAM 10

5. HARDWARE DESCRIPTION 11

6. SOFTWARE DESCRIPTION 12

7. DATA ACQUAINTED 14

8. DATA SHEETS 16

9. COMPONENTS LISTING 24

10. REFERENCES 24

Page 5: Doc speed control of a dc motor using micro controller 8051

INTRODUCTION

DC MOTOR

The device that converts electrical energy

into mechanical energy is called as a motor. The motor that utilizes a DC supply

to produce mechanical output is DC Motor. The advantages of using these types

of motors over conventionally used AC motors are stated below.

• DC motors have higher controller efficiency.

• DC motors have typical 98% efficiency.

• DC motors have better overload and peak voltage characteristics.

• The main advantage of using these DC motors ids that the speed-

torque characteristics can be varied to almost any useful form.

As a result of all these advantages these

motors have a wide range of applications in places where constant speed is to be

maintained at varying loads. Conveyor belts, elevators, cranes, ski lifts,

extruders, mixers, sewing machines are few such applications where DC motors

are used. So controlling the speed of a DC motor is a purposeful and required

place to work on. The various types of DC motors are

Page 6: Doc speed control of a dc motor using micro controller 8051

• Series field wound type

• Shunt field wound type

• Compound field wound type

For all these types of DC motor common methods of speed controls.

Speed control methods in a DC motor:

The motor speed can be controlled by

controlling armature voltage and armature current. It is obvious that speed

control is possible by varying

• Flux per pole ,Φ (Flux control)

• resistance Ra of armature circuit (Rheostatic Control)

• applied voltage V (Voltage Control)

The above methods have some demerits like a large amount of power is wasted

in the controller resistance. Hence, efficiency is decreased. It needs expensive

arrangement for dissipation of heat produced in the controller resistance. It

gives speeds below the normal speed. By these data that are acquainted we can

draw a conclusion that these electric and electromechanical methods are less

adaptive so electronic techniques are used for speed control. These methods

provide higher efficiency, greater reliability, quick response, higher efficiency.

One such technique is Pulse Width Modulation. We apply this technique in our

project so as to control the speed of the DC motor.

Page 7: Doc speed control of a dc motor using micro controller 8051

PWM

Pulse width modulation (PWM) is a method for binary signals generation,

which has 2 signal periods (high and low). The width (W) of each pulse varies

between 0 and the period (T). The main principle is control of power by

varying the duty cycle. Here the conduction time to the load is controlled. Let

for a time t1, the input voltage appears across the load i.e. ON state and for t2

time the voltage across the load is zero.

• The average voltage at output is given by

Va = 1/T ∫ vodt = t1/T Vs = ft1 Vs = kVs

• the average load current Ia = Va/R = kVs/R where,

T is the total time period =t1+t2,

k = t1/T is the duty cycle.

• The rms value of output voltage is V0 = ( i/T ∫ V02 dt ) ½ = k Vs

• The output power and is given by

Pi = 1/T ∫v0idt = 1/T ∫ v02/R dt = kVs

2/R

Page 8: Doc speed control of a dc motor using micro controller 8051

• The duty cycle can be varied from 0 to 1 by varying t1, T or f. Therefore,

the output voltage V0 can be varied from 0 to Vs by controlling k, and the

power flow can be controlled.

• As the time t1 changes the width of pulse is varied and this type of

control is called pulse width modulation (PWM) control.

For better understanding of PWM these diagrammatic representations can be

used. These figures represent the waveforms obtained as output at different

voltage requirements.

High Speed Signal (90%): The green part of the signal represents the ON

time and the white part of it represents time when it is not receiving any voltage.

Signal with half voltage (50%):

Page 9: Doc speed control of a dc motor using micro controller 8051

Signal with low voltage (10%):

Advantages of PWM :

The main advantage of PWM is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. Power loss, being the product of voltage and current, is thus in both cases close to zero. PWM works also well with digital controls, which, because of their on/off nature, can easily set the needed duty cycle. Using pulse width modulation has several advantages over analog control. Using PWM to dim a lamp would produce less heat than an analog control that converts some of the current to heat. Also, if you use PWM, the entire control circuit can be digital, eliminating the need for digital-to-analog converters. Using digital control lines will reduce the susceptibility of your circuit to interference. Finally, motors may be able to operate at lower speeds if you control them with PWM. When you use an analog current to control a motor, it will not produce significant torque at low speeds. The magnetic field created by the small current will be too weak to turn the rotor. On the other hand, a PWM current can create short pulses of magnetic flux at full strength, which can turn the rotor at extremely slow speeds.

The technology has become more pervasive as low cost microcontrollers incorporate PWM control. Microcontrollers offer simple

Page 10: Doc speed control of a dc motor using micro controller 8051

commands to vary the duty cycle and frequencies of the PWM control signal. PWM is also used in communications to take advantage of the higher immunity to noise provided by digital signals. So by getting these pulses generated by a microcontroller we can increase the efficiency, accuracy and thus the reliability of the system. The most commonly used microcontroller is 8051 that has been used in this project for production of pulses.

MICROCONTROLLER

A microcontroller (abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. This programmes memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM.

Advantages of Microcontroller Microcontrollers are widely used in today’s control systems for the following reasons:

• Design and Simulation – Because you are programming with software, detailed simulations may be performed in advance to assure correctness of code and system performance.

• Flexibility – Ability to reprogram using Flash, EEPROM or EPROM allows straightforward changes in the control law used.

• High Integration – Most microcontrollers are essentially single chip computers with on-chip processing, memory, and I/O. Some contain peripherals for serial communication and reading analog signals (with an

Page 11: Doc speed control of a dc motor using micro controller 8051

analog-to-digital converter or ADC). This differentiates a microcontroller from a microprocessor. Microprocessors require that this functionality be provided by added components.

• Cost – Cost savings come from several locations. Development costs are greatly decreased because of the design/flexibility advantages mentioned previously. Because so many components are included on one IC, board area and component savings are often evident as well.

• Easy to Use – Just program and go! While in the past, programming has often involved tedious assembly code, today C compilers are available for most microcontrollers. Microcontrollers often only require a single 5V supply as well which makes them easier to power and use.

8051 is also one such microcontroller with certain features like

• An 8-bit ALU. • Harvard memory architecture – the external program memory and data

memory have separate address spaces from 0x0000 and separate controlsignal(s).

• 8-bit internal data bus width and 16-bit internal address bus – Harvard memory architecture

• CISC (Complex Instruction Set Computer) • Special function registers (SFRs) –PSW(processor status word), A

(accumulator),B register, SP (stack pointer) and registers for serial IOs, timers, ports and interrupt handler.

• on-chip RAM of 128 bytes. • 32 bytes of RAM also used as four banks of registers. Each register-set

thus eight registers. • External data/stack memory can be added upto 64 kB in most of the

version. In certain 8051 enhancements, this limit enhanced to 16 MB. After acquiring the data about microcontroller, DC motor and PWM technique we can get into designing a circuit that uses these units in controlling the speed of a DC motor

Page 12: Doc speed control of a dc motor using micro controller 8051

FLOW CHART

Start

Check if both switches are open

NoYes

Decrease speed

Speed Required 80%

No

Speed Required 50%

No

Close S1&S2

Yes Yes

Page 13: Doc speed control of a dc motor using micro controller 8051

Stop

BLOCK DIAGRAM

Page 14: Doc speed control of a dc motor using micro controller 8051

CIRCUIT DIAGRAM

Page 15: Doc speed control of a dc motor using micro controller 8051

HARDWARE DESCRIPTION

Page 16: Doc speed control of a dc motor using micro controller 8051

The components are connect on a

Printed Circuit Board as per the given connection details in the circuit diagram.

The functioning of the circuit can be explained with respect to the action format

that occurs in the circuit. As the supply is switched ON and both the switches

are open the switching supplies ideally 5V is given to the microcontroller.

Suppose if the any of the switch is closed the supply gets directly shorted with

the ground. This indicates the microcontroller about the switch positions and

thus generates the signal as per the given program for the respective switches

position. The transistor used allows current to conduct through it when ever a

positive pulse is given at its base that is given by the microcontroller

inaccordance with the program. As the transistor is forward biased the supply

that is used to run the motor gets connected with the motor terminals and motor

starts running. As soon as the 0 voltage is encountered the NPN transistor used

goes into reverse bias and stops its conduction so the motor’s armature supply

gets disconnected till the base current is 0 volts. By this we can deduce that the

speed of the motor is directly dependent on the supply given by microcontroller

to the base which indeed depends on the program written. So the speeds of

working of the circuit depends on the number of switches used, for instance in

the above circuit two switches are used so the number of speed levels are 22 = 4.

So the number of speed levels for X switches will be 2X. So the speed of the

motor can be varied in steps.

SOFTWARE DESCRIPTION

#include<reg51.h> These are the ports from where the microcontroller gets the information about the switch positions.

Page 17: Doc speed control of a dc motor using micro controller 8051

sbit SW_1 = P2^6; //connecting switch 1 to the port 2 ,pin 6.

sbit SW_2 = P2^7; // connecting switch 1 to the port 2 ,pin 7.

sbit MTR = P1^0; // from this pin we get the signal that is to be fed to the base

void main()

int x;

while(1)

if(SW_1==0 & SW_2==0)

This condition is stated when both the switches are closed in this position the supply from the switches is shorted into the ground terminal so microcontroller doesn’t get any voltage so the switches are considered as 0’s. At this condition the program is written so that the output signal given by the microcontroller should have 150 machine cycles of ON state and 600 machine cycles of OFF state.

MTR=1;

for(x=0;x<150;x++);

MTR=0;

for(x=0;x<600;x++);

if(SW_1==0 & SW_2==1)

This condition is stated when the switch1 is closed and switch 2 is open in this position the supply from the switch1 is shorted into the ground terminal so microcontroller doesn’t get any voltage so the switch is considered as 0. Similarly switch 2 is open and supply is sent to microcontroller so it is considered 1.At this condition the program is written so that the output signal given by the microcontroller should have 300 machine cycles of ON state and 300 machine cycles of OFF state.

MTR=1;

for(x=0;x<300;x++);

MTR=0;

for(x=0;x<300;x++);

if(SW_1==1 & SW_2==0)

This condition is stated when the switch2 is closed and switch 1 is open in this position the supply from the switch2 is shorted into the ground terminal so microcontroller doesn’t get any voltage so the switch is considered as 0. Similarly switch 1 is open and supply is sent to microcontroller so it is considered 1.At this condition the program is written so that the output signal given by the microcontroller should have 600 machine cycles of ON state and 150 machine cycles of OFF state

MTR=1;

Page 18: Doc speed control of a dc motor using micro controller 8051

for(x=0;x<600;x++);

MTR=0;

for(x=0;x<150;x++);

if(SW_1==1 & SW_2==1) In this condition both the switches are open so they are stated as 1’s and in this condition the motor runs at full speed.

MTR=1;

DATA AQUAINTED

Condition 1 when both the switches are open:

Page 19: Doc speed control of a dc motor using micro controller 8051

Voltage Speed 4.3V 860 rpm

Condition 2 when switch SW1 is

closed:

Voltage Speed Average speed 4.3V 860rpm 3.6V 720rpm

790 rpm

Condition 3 when switch SW2 is closed:

Page 20: Doc speed control of a dc motor using micro controller 8051

Voltage Speed Average speed

4.3V 860rpm 3.9V 780rpm

820 rpm

Condition 4 when both the switches are

closed:

Voltage Speed Average speed 4.3V 860rpm 3.3V 660rpm

760 rpm

Page 21: Doc speed control of a dc motor using micro controller 8051

COMPONENT LIST

Name of the Component

Make Value Number

AT89C51 Micro Controller

ATMEL 1

Resistors R1,R2 10KΩ 2 Capacitors C1,C2 1nF 2 Capacitor C3 1mF 1

Diode D1 IN4004 1 Transistor T1 TIP122 1 Switches SW1,SW2 2

DC Motor AMETECK 12Volts 1 DC Adapter Q1(C) 12 Volts 1 DC Adapter Q2(C) 5 Volts 1

Crystal Oscillator X1 12MHz 1

REFERENCES

• Books on DC motors: Driving DC Motors by G. MAIOCCHI, DC Motors and drives by BL. THERAJA.

• Books on PWM technique: Pulse Width Modulated Power supplies by VALTER QUERCIOLI.

• Books on Microcontroller: The 8051 microcontroller and embedded systems by JANICE GILLISPIE MAZIDI.