Ali Akhter

download Ali Akhter

of 27

Transcript of Ali Akhter

  • 8/6/2019 Ali Akhter

    1/27

    The electric drive systems used in industrial applications are

    increasingly required to meet higher performance and reliabilityrequirements. The DC motor is an attractive piece of equipment in

    many industrial applications requiring variable speed and load

    characteristics due to its ease of controllability. Microcontrollers

    provide a suitable means of meeting these needs. Certainty, part of

    the recent activity on microcontrollers can be ascribed to theirnewness and challenge. In this paper, implementation of the

    MC68HC11E9 microcontroller for speed control of DC motor fed by

    a DC chopper has been investigated. The chopper is driven by a

    high frequency PWM signal. Controlling the PWM duty cycle is

    equivalent to controlling the motor terminal voltage, which in turn

    adjusts directly the motor speed. Experimental results have been

    obtained that show the employment of microcontroller for speed

    control and over current protection of a DC motor.

  • 8/6/2019 Ali Akhter

    2/27

    DC motor: has only a pair of + and leads.Connecting to a DC voltage source, DC motors move in one direction. Byreversing the voltage polarity, they will move in the opposite direction.

    DC MotorsDC Motors

    Figure 11.7 DC motor rotation

  • 8/6/2019 Ali Akhter

    3/27

    DC Motors -DC Motors - Bidirectional controlBidirectional control (1/2)(1/2)

    With the help of relays or some specially designed chips, the rotationaldirections (forward and backward) of DC motors can be control.

    The basic concept is the H-Bridge control of DC motors

    Figure 11.8 H-Bridge Motor Configuration Figure 11.9 H-Bridge Motor Clockwise Configuration

    P1.0 =0

    P1.3=0

    P1.1 =1

    P1.2 =1

    P1.x : 0=on, 1=off

  • 8/6/2019 Ali Akhter

    4/27

    Figure 11.10 H-Bridge MotorCounter-ClockwiseConfiguration

    Figure 11.11 H-Bridge in an Invalid Configuration

    H-Bridge control can be created using relays, transistors, or a single IC solution.

    When using relays and transistors, make sure that invalid configuration do not occur.

    DC Motors -DC Motors - Bidirectional controlBidirectional control (2/2)(2/2)

  • 8/6/2019 Ali Akhter

    5/27

    DC Motors -DC Motors - Speed controlSpeed control by PWMby PWM (1/2)(1/2)

    The speed of DC motor depends on three factors; (a) load, (b) voltage and (c) current

    For a fixed load, speed of DC motor can be changed bypulse width modulation (PWM)

    PWM is to change the width of the pulse applied to DC motor which lead to an increase or

    decrease the amount of power supplied to the motor.

    As a result, the motor speed increases or decreases respective to the power supplied.

    Although the amplitude of the pulse is fixed at a voltage level, but its duty is varied.

    The wider the pulse, the higher speed of motor.

    Figure 11.12 Pulse Width Modulation Comparison

    Moto

    rSpeed

  • 8/6/2019 Ali Akhter

    6/27

    DC Motors

    Only One Winding

    Two Connections: + and

    Reversing Polarity Reverses Motor Move Continuously

    Cannot Determine Position

  • 8/6/2019 Ali Akhter

    7/27

    Characteristics:

    RPM No Load: Maximum RPM With No Load on Shaft

    Given in Data Sheets

    Loaded: Actual Maximum When Loaded

    Not in Most Data Sheets

    Voltage Range Speed Increases With Voltage on a Given Motor

    Current Draw

    Data Sheet Rating Is With Nominal Voltage and No Load Increases With Load

    Speed Decreases With Load

  • 8/6/2019 Ali Akhter

    8/27

    DC Motor Rotation

    (Permanent MagnetField)

  • 8/6/2019 Ali Akhter

    9/27

    Bi-Directional Control

    Can Change Polarity With a Little Work

    H-Bridge Is Simplest Method

    Uses Switches (Relays Will do)

  • 8/6/2019 Ali Akhter

    10/27

    Controlling Speed

    Speed Depends On Load

    Voltage

    Current

    Can Control Power By Changing (Modulating)Width of Pulse to Motor

    Wider Pulse Faster Speed

    Narrower Pulse Slower Speed

    Note: Doesnt Work With AC Motors AC Motor Speed Depends on AC Frequency (CPS)

  • 8/6/2019 Ali Akhter

    11/27

  • 8/6/2019 Ali Akhter

    12/27

  • 8/6/2019 Ali Akhter

    13/27

    #include

    sbit inr=P32; //speed increment switch

    sbit dcr=P33; //speed decrement switch

    main()

    {unsigned char i=080; //i has initial speed value=half speed = 80H

    P3=0ff; //configure P3 to accept switches

    while(1)

    {if (!inr) //if increment is pressed{while (!inr); //wait till key is released

    if (i>10) //if speed is more than minimum

    i=i-10; //increase the DC motor speed, by decreasing the count

    } //end of if

    if (!dcr) //if decrement is pressed

    {while (!dcr); //wait till key is released

    if (i

  • 8/6/2019 Ali Akhter

    14/27

    Hex keypad

    Placement of keys on port linesPlacement of keys on port lines Connection of Hex keypad to 8051Connection of Hex keypad to 8051

  • 8/6/2019 Ali Akhter

    15/27

    #include

    #include

    #include"lcd.h"

    unsigned char rows,columns,result;unsigned char temp = 0;

    void delay() //delay subroutine

    {unsigned int i;

    for(i=0;i0x09)

    {result += 0x37; //if value is greater than 9, add 37H

    WriteChar(result);}else

    {result += 0x30; //if value is between 0 to 9, add 30H

    WriteChar(result);}

    } //end of display subroutine

  • 8/6/2019 Ali Akhter

    16/27

    void KeyScan() //Keypad subroutine

    {again:columns = 0x0e; //make P1.0 low

    rows = 0x04; //4 rows to check

    result = 0x0; //Key value starts at 0next: P1 = columns; //output columns

    CY = 1; //make CY = 1 for next rotation

    columns = 1;

    if(!CY)

    {ClrLcd(); //key foundreturn;}

    else

    {result += 1; //next column; key value is incremented

    goto rot;}}

  • 8/6/2019 Ali Akhter

    17/27

    else

    {result += 0x04; //for next row; 4 is added to key value

    rows - -; //decrement number of rows

    if(rows = = 0)

    goto again; //start from beginningelse

    {goto next; }

    }}

    void main(){P0 = 0xff; //make as input port

    P1 = 0x00;

    InitLcd(); //initialize LCD

    WriteString("KEY PRESSED=")

    while(1)

    {KeyScan(); //call keypad subroutine

    WriteString("KEY PRESSED=")

    Display(); //display the value

    } }

  • 8/6/2019 Ali Akhter

    18/27

    ELEVATOR INTERFACE TO 8051ELEVATOR INTERFACE TO 8051

  • 8/6/2019 Ali Akhter

    19/27

    #i l d 1 d2

  • 8/6/2019 Ali Akhter

    20/27

    #include

    void delay(unsigned int);

    main()

    {unsigned char Flr[9] = {0xff,0x00,0x03,0xff,0x06,0xff,0xff,0xff,0x09}

    unsigned char ReqFlr,CurFlr = 0x01,i,j;P0 = 0x00;

    P0 = 0xf0;

    while(1)

    {P1 = 0x0f;ReqFlr = P1|0xf0;

    while(ReqFlr == 0xff)

    ReqFlr = P1|0xf0; //Read Request Floor from P1

    ReqFlr = ~ ReqFlr;

    if(CurFlr == ReqFlr) //If request floor is equal to current floor

    {P0 = Flr[CurFlr]; //Clear Floor Indicator

    P0 = P0|0xf0; //Enable again

    continue; //Go up to read again

    }

  • 8/6/2019 Ali Akhter

    21/27

    else if (CurFlr > ReqFlr) //If current floor is > request floor

    {

    i = Flr[CurFlr] - Flr[ReqFlr]; //Get the no of floors to travel

    j = Flr[CurFlr];for(; i>0; i- -) //Move the indicator down

    {P0 = 0x0f0 | j;

    j- -;

    delay(25000);

    }}

    else //If Current floor is < request floor

    {i = Flr[ReqFlr] - Flr[CurFlr]; //Get the no of floors to travel

    j = Flr[CurFlr];

    for(; i>0; i- -) //Move the indicator Up{P0=0f0 | j;

    j++;

    delay(25000);

    }}

  • 8/6/2019 Ali Akhter

    22/27

    CurFlr = ReqFlr; //Update current floor

    P0 = Flr[CurFlr]; //Clear the request indicator

    P0 = P0|0xf0;

    } //end of while} //end of main

    void delay(unsigned int x)

    {for(; x>0; x- -);}

  • 8/6/2019 Ali Akhter

    23/27

    What is PWM

    Pulse-width modulation (PWM), orpulse-duration modulation

    (PDM), is a commonly used technique forcontrolling power to inertial electricaldevices, made practical by modern

    electronic power switches. The average value of voltage (and current)

    fed to the load is controlled by turning theswitch between supply and load on and off

    at a fast pace. The longer the switch is oncompared to the off periods, the higher thepower supplied to the load is.

  • 8/6/2019 Ali Akhter

    24/27

    What is PWM

    The PWM switching frequency has to bemuch faster than what would affect theload, which is to say the device that usesthe power. Typically switchings have to bedone several times a minute in an electricstove, 120 Hz in a lamp dimmer, from fewkilohertz (kHz) to tens of kHz for a motordrive and well into the tens or hundreds ofkHz in audio amplifiers and computerpower supplies.

    http://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Hertz
  • 8/6/2019 Ali Akhter

    25/27

    What is PWM

    The main advantage of PWM is that powerloss in the switching devices is very low. Whena switch is off there is practically no current,and when it is on, there is almost no voltagedrop across the switch. Power loss, being theproduct of voltage and current, is thus in bothcases close to zero. PWM also works well with

    digital controls, which, because of their on/offnature, can easily set the needed duty cycle.

  • 8/6/2019 Ali Akhter

    26/27

    Controlling Motor DirectionControlling Motor Direction

    To change the direction of rotation:

    Simply switch the polarity of the battery leads

    going to the motor (that is, switch the + and

    battery leads)

    +

    -

    -

    +

    CW CCW

    Direction of

    Rotation

  • 8/6/2019 Ali Akhter

    27/27

    Inside a Toy MotorInside a Toy Motor

    (Similar to TekBot Motor)(Similar to TekBot Motor)