Report

Embed Size (px)

DESCRIPTION

Gas Turbines

Citation preview

NATIONAL UNIVERSITY OF SCIENCES & TECHNOLOGY

CONTROL SYSTEMSPROJECT REPORT

DC MOTOR CONTROL (USING GENERIC MICRO-CONTROLLER BOARD)

Submitted To:Mr. Naqash AfzalSubmitted By:Arslan Ahmad10-NUST-BE-ME-23Maaz Hussain10-NUST-BE-ME-45Umer Farooq10-NUST-BE-ME-90Abdul Saboor10-NUST-BE-ME-03Section:ADate:10th Jan, 2014

Table of Contents

Objective -------------------------------------------------------------------------------------------------------------- 3Project Description ------------------------------------------------------------------------------------------------- 3Circuit ------------------------------------------------------------------------------------------------------------------ 3Program Code -------------------------------------------------------------------------------------------------------- 6Code Explained ------------------------------------------------------------------------------------------------------- 9Conclusion ----------------------------------------------------------------------------------------------------------- 12

OBJECTIVETo control the RPM of a DC Motor (ran by an H-Bridge) using a Generic Microcontroller Board.

PROJECT DESCRIPTIONThis project is used to control the speed of a DC Motor (ran by an H-Bridge). The Micro-controller generates a Square Wave of 200 Hz Frequency which is used to give the Motor its Duty Cycle. A feedback is implemented in the code which states that the motor should achieve the speed defined in the code as soon as the encoder is attached to the motor.

CIRCUITThis project consists of 2 circuits1. Generic Micro-controller Board2. H-Bridge

1.Generic Micro-controller BoardFunctionThe Generic Micro-controller Board acts like a computer's motherboard, and acts as ageneral purpose controller.ComponentsThe components used in this circuit are1. Atml 89C51 (8051 micro-controller)12. 74LS245 (Byte Addressable Registers)43. LED Bar Graph: To display output on Microcontroller Port pins44. Respack (9 pins): 10k-ohm, for Pulling-up P0 Port 15. Respack (9-pins): 330 ohm, with LED Bar Graph 46. Crimp Shell (8-pins): For interfacing with external inputs/outputs 87. Capacitors: 33 pF (2), 10 uF (1)8. Crystal (12 MHz): For Calculations19. Push Button: For activating Reset 110. Resistor (8.2k-ohm): For Reset circuitry111. Ziff: Bed for Micro-controller112. IC Beds: For easy removal of ICs from circuit16

2.H-BridgeFunctionThe H-Bridge is used to run a DC motor and control its direction. For the project, we run the motor in only one direction.ComponentsWe have used an H-bridge IC for this purpose commonly known by the name L293D.

L293D Circuit

PROGRAM CODEThe Code burned into the Micro-controller is:#include

int encoder_counts = 0, dutycycle = 50, cycle=0;float ppr=64;unsigned char repetition = 0;unsigned int reference_speed=50, speed;

sbit Enable0 = P2^7;sbit Enable1 = P2^6;sbit Enable2 = P2^5;sbit Enable3 = P2^4;sbit pulse = P0^0;

void Initialize();void SpeedDisplay();

void main (void){Initialize();while(1){ ;}}

void Initialize(){P1 = 0xFF; pulse = 1;P2=0x00;EA=1;EX0=1;ET0=1;ET1=1;TMOD=0x11; //Timer 0 and Timer 1 in mode 1 (16-bit mode)IT0=1; //edge triggeredTH0=0x3C; //t=50msTL0=0xB0;TR0=1;TH1 = 0xFF; //t=50us (t=T/100)TL1 = 0xCD;TR1 = 1; }

void SpeedDisplay(){ int i;

P2=speed%10; Enable0 = 1; for(i=0;i