28
A project presentation on CONTROLLING DC MOTOR USING PWM PREPARED BY DISHA MODI (100280111066) HARDIK JOSHI (100280111125) HARSHAL PATIL (100280111124)

Speed Control of DC motor using AT89C52 IC

Embed Size (px)

Citation preview

Page 1: Speed Control of DC motor using AT89C52 IC

A project presentation onCONTROLLING DC MOTOR

USING PWM

PREPARED BY

DISHA MODI (100280111066) HARDIK JOSHI (100280111125)

HARSHAL PATIL (100280111124)

Page 2: Speed Control of DC motor using AT89C52 IC

Introdution Purpose Aim

Analysis User interface Hardware interface Software interface Programming used Working procedure

Conclusion Cost of components used Bibliography

 

Table of Contents

Page 3: Speed Control of DC motor using AT89C52 IC

Purpose:

DC-Motor is a SISO(single input single output) device. Which converts electrical energy to mechanical energy, means here it gives variable speed according the change in supply voltage given to it and this input voltage varies accordingly width of the pulses which is generated by controller IC.

DC motors have a long tradition of being used as adjustable speed machines and a wide range of options have evolved for this purpose.

For exa; Cooling blowers and inlet air flanges provide cooling air for a wide speed range at constant torque , also in household appliences like fan, mixer etc.

Aim: To control the speed of DC-Motor by generating pulses of variable duty cycles using the AT89C52 controller IC.

Page 4: Speed Control of DC motor using AT89C52 IC

What is PWM(Pulse Width Modulation) ?

Pulse Width Modulation – Using digital pulses to create some analog value other than just ‘high’ and ‘low’ signal levels.

Many digital systems are powered by a 5-Volt power supply, so if you filter a signal that has a 50% duty cycle you get an average voltage of 2.5 Volts. Other duty cycles produce any voltage in the range of 0 to 100% of the ‘high’ voltage, depending upon the PWM resolution.

The duty cycle is defined as the percentage of digital ‘high’ to digital ‘low’ signals present during a PWM period.

Uses for PWM: 1) To digitally create an analog output voltage level for control functions and power supply.2) To digitally create analog signals for arbitrary waveforms, sounds, music and speech

Page 5: Speed Control of DC motor using AT89C52 IC

List of components used:

Controller IC AT89C52 Motor driver IC L293D DC motor 150 rpm Voltage controller IC 7805 Crystal oscillator (12Mhz) Bridge rectifier Pull up resistor Box, ceramic and electrolytic capacitor 2 pin push button switches Connector pins and connecting wires Variable voltage adapter

Page 6: Speed Control of DC motor using AT89C52 IC

Features • Compatible with MCS-51™ Products • 8K Bytes of In-System Reprogrammable Flash Memory • Endurance: 1,000 Write/Erase Cycles • Fully Static Operation: 0 Hz to 24 MHz • Three-level Program Memory Lock • 256 x 8-bit Internal RAM • 32 Programmable I/O Lines • Three 16-bit Timer/Counters • Eight Interrupt Sources • Programmable Serial Channel • Low-power Idle and Power-down Modes

AT89C52 CONTROLLER IC

Page 7: Speed Control of DC motor using AT89C52 IC

Description

The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 and 80C52 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control.

Page 8: Speed Control of DC motor using AT89C52 IC

L293D Dual H-Bridge Motor Driver

L293D is a dual H-Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all the four I/Os to connect up to four DC motors.

L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF output diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor driver.

As you can see in the circuit, three pins are needed for interfacing a DC motor (A, B, Enable). If you want the o/p to be enabled completely then you can connect Enable to VCC and only 2 pins needed from controller to make the motor work.

As per the truth mentioned in the image above its fairly simple to program the microcontroller. Its also clear from the truth table of BJT circuit and L293D the programming will be same for both of them, just keeping in mind the allowed combinations of A and B.

Page 9: Speed Control of DC motor using AT89C52 IC

A simple schematic for interfacing a DC motor using L293D is shown below.

Page 10: Speed Control of DC motor using AT89C52 IC

►Introduction

Whenever a robotics hobbyist talk about making a robot, the first thing comes to his mind is making the robot move on the ground. And there are always two options in front of the designer whether to use a DC motor or a stepper motor. When it comes to speed, weight, size, cost... DC motors are always preferred over stepper motors.

There are many things which you can do with your DC motor when interfaced with a microcontroller. For example, you can control the speed of motor, you can control the direction of rotation, you can also do encoding of the rotation made by DC motor i.e. keeping track of how many turns are made by your motors etc. So you can see DC motors are no less than a stepper motor.

Page 11: Speed Control of DC motor using AT89C52 IC
Page 12: Speed Control of DC motor using AT89C52 IC

Voltage controller IC 7805 The LM7805 of three-terminal positive voltage

regulators employ built-in current limiting, thermal shutdown, and safe-operating area protection which makes them virtually immune to damage from output overloads.

Page 13: Speed Control of DC motor using AT89C52 IC

Crystal Oscillator:

A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency.

most common type of piezoelectric resonator used is the quartz crystal, but other piezoelectric materials including polycrystalline ceramics are used in similar circuit.

Here, we are using the 12MHz Crystal oscillator.

Bridge Rectifier:

A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. The process is known as rectification.

Page 14: Speed Control of DC motor using AT89C52 IC

Pull up resistors:

Pull-up resistors are used in electronic logic circuits to ensure that inputs to logic systems settle at expected logic levels if external devices are disconnected or high-impedance.

They may also be used at the interface between two different types of logic devices, possibly operating at different power supply voltages.

When the switch is open the voltage of the gate input is pulled up to the level of inWhen the switch is closed, the input voltage at the gate goes to ground.

A pull-up resistor weakly "pulls" the voltage of the wire it is connected to towards its voltage source level when the other components on the line are inactive.

When all other connections on the line are inactive, they are high-impedance and act like they are disconnected. Since the other components act as though they are disconnected, the circuit acts as though it is disconnected, and the pull-up resistor brings the wire up to the high logic level.

When another component on the line goes active, it will override the high logic level set by the pull-up resistor. The pull-up resistor assures that the wire is at a defined logic level even if no active devices are connected to it.

 

Page 15: Speed Control of DC motor using AT89C52 IC

General mini box cap: use for ( by passing, filtering frequency discrimination, timing oscillation, pulse coupling etc...) this kind of capacitor will not pass high AC current, it dominates micro AC signal.

Box capacitor:

Ceramic capacitor:

A ceramic capacitor is a fixed capacitor with the ceramic material acting as the dielectric. It is constructed of two or more alternating layers of ceramic and a metal layer acting as the electrodes.

Page 16: Speed Control of DC motor using AT89C52 IC

An electrolytic capacitor is a type of capacitor that uses an electrolyte (an ionic conducting liquid) as one of its plates to achieve a larger capacitance per unit volume than other types, but with performance disadvantages.

All capacitors conduct alternating current (AC) and block direct current (DC) and can be used, amongst other applications, to couple circuit blocks allowing AC signals to be transferred while blocking DC power, to store energy, and to filter signals according to their frequency.

Electrolytic capacitor

Page 17: Speed Control of DC motor using AT89C52 IC

2 pin Push button switches:

Miniature 2-PIN Single Pull Single Throw switches. These are high quality momentary on switches. Perfect as a tactile reset switch. Mounts perfectly into standard breadboards. Rated up to 50mA.

Power on/off switch

This is a simple SPDT slide switch - great for use as an ON/OFF button, or just as a general control switch. The pins are spaced by 0.1", so it's breadboard friendly. The switch is rated for 0.3A at 50VDC.

 

Page 18: Speed Control of DC motor using AT89C52 IC

Connector pins and connecting wires:

This is a simple wire cable. Great for jumping from one point to another point in circuit to make connection between that two points.

Adaptor is just a power supply, it plugs into the wall and converts AC current to a single DC voltage in most cases. There are also adapters that output a different AC voltage. Here, we are using the 5-12V DC variable voltage adapter.

Variable voltage adapter:

Page 19: Speed Control of DC motor using AT89C52 IC
Page 20: Speed Control of DC motor using AT89C52 IC

Programming used:

Code to control dc motor using pwm

#include <reg52.h>sbit mybit=P2^0; //Positive of motorsbit L293D_B=P2^1; //Negative of motorsbit L293D_E=P2^2; //Enable of L293Dsbit sw1=P1^1; // switch for high speedsbit sw2=P1^0; // switch for low speedvoid delay(void);void main(){

sw1=1; // make switches as inputsw2=1;while(1){

if (sw2==0)

Page 21: Speed Control of DC motor using AT89C52 IC

Programming used:Code to control dc motor using pwm#include <reg52.h>sbit mybit=P2^0; //Positive of motorsbit L293D_B=P2^1; //Negative of motorsbit L293D_E=P2^2; //Enable of L293Dsbit sw1=P1^1;

// switch for high speedsbit sw2=P1^0;

// siwtch for low speedvoid delay(void);void main(){

sw1=1;sw2=1;while(1){

{mybit=1;delay();delay();delay();mybit=0;delay();

}if(sw1==0) //switch 1 is pressed{

mybit=1;delay();mybit=0;delay();delay();delay();

}elsemybit=1;

}}

Page 22: Speed Control of DC motor using AT89C52 IC

void delay (void) // function to generate time delay using timer{

unsigned char x,y;TMOD=0x02; //timer 0 in mode 2for(x=0;x<=20;x++)

for(y=0;y<=36;y++){

TH0=-23;TR0=1;while(TF0==0);

TR0=0;TF0=0;

}

}

Page 23: Speed Control of DC motor using AT89C52 IC

Waveform Generated for this program:

1.Output waveform for high speed-

Page 24: Speed Control of DC motor using AT89C52 IC

2. Output waveforms for low speed-

Page 25: Speed Control of DC motor using AT89C52 IC

Steps for operating user interface- Switch on the variable voltage adapter. Set the power supply of adapter to 12 volts. Slide the power on/off switch to on condition. Press reset button . Press switch 1 to getting high speed of motor. Press switch 2 to getting low speed of motor.

Working Procedure

Page 26: Speed Control of DC motor using AT89C52 IC

We can control DC-Motor by generating pulses of variable duty

cycles through controller IC AT89C52 efficiently. By increasing or decreasing pulse width, the controller regulates

energy flow to the motor shaft. The motor’s own inductance acts like a filter, storing energy during the “on” cycle while releasing it at a rate corresponding to the input or reference signal.

By generating pwm we can reduces the damage done to the motor due to excessive amount of current.

Conclusion:

Page 27: Speed Control of DC motor using AT89C52 IC

Cost of components used:

Sr.No. Name of components quantity Price per piece Total

1. Controller IC AT89C52 1 80 80

2. Trainer board 1 135 135

3. Motor driver L293D IC 1 80 80

4. DC motor 150 rpm 1 250 250

5. Bridge rectifier ic 1 30 30

6. 7805 IC 1 10 10

7. Box, ceramic, electrolytic capacitor 10 5 50

8. Pull up resistor 3 15 45

9. adapter 1 120 120

10. Crystal oscillator 1 20 20

11. switches 4 5 20

12. Connecting pins & wires - 40 40

Page 28: Speed Control of DC motor using AT89C52 IC

1. The 8051 Microcontroller and Embedded Systems Using Assembly

and C,2/e by Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin McKinlay ( Second Edition , Pearson Education ).

2. The 8051 Microcontroller & Embedded Systems using Assembly and C By K. J. Ayala, D. V. Gadre (Cengage Learning , India Edition).

3. 8051 Microcontrollers: MCS51 family and its variants by Satish Shah, Oxford University Press.

Bibliography: