Upload
mafazahmed
View
78
Download
2
Embed Size (px)
Citation preview
International Islamic University
Islamabad
CONTROL SYSTEM LAB PROJECT
SPEED CONTROL OF DC MOTOR
Group Members:
Mafaz Ahmed 1882-F12D
Rafi Uzman 1891-F12D
Submitted To:
Sir Muhammad Asad
SPEED CONTROL OF DC MOTOR Page 1
TABLE OF CONTENTS Page
1. Introduction …………………………………………………….(3)
2. Schematic …………………………………………………….(3)
3. DC MOTOR …………………………………………………….(3)
Types
4. Arduino …………………………………………………….(4)
Featured
5. PCB design …………………………………………………….(5)
6. H-Bridge …………………………………………………….(6)
7. Optocoupler ……………….…………………………………….(7)
8. Rotary Encoder ………………………….………………………….(8)
9. Code …………………………………………………….(8)
10.Conclusion …………………………………………..……….(10)
11.References …………………………………………………….(10)
SPEED CONTROL OF DC MOTOR Page 2
INTRODUCTION:
In this project we will be controlling the speed of Dc motor using Arduino controller. Dc motor is drive by using PWM technique and then using encoder to sense the rpm of DC motor. Encoder produces pulses in the output, which is feed into Arduino and Arduino controls the speed of DC motor. So we have implemented the feedback system which controls the speed of DC motor.
Schematic:
DC motor:
DC motor is a type of electric machines which converts direct current into mechanical power. The very basic construction of a dc motor contains a current carrying armature which is connected to the supply end through commutator segments and brushes and placed within the north south poles of a permanent or an electro-magnet.
SPEED CONTROL OF DC MOTOR Page 3
ARDUINO
DC motor
ENCODER and SENSOR
H-Bridge
TYPES:
There are three types of DC motor,1. Shunt DC motor2. Series DC motor3. Compound DC motor
Arduino:
Arduino is an open source computer hardware. An Arduino board consists of an Atmel 8-, 16- or 32-bit AVR microcontroller with complementary components that facilitate programming and incorporation into other circuits. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with AC-to-DC adapter or battery.
SPEED CONTROL OF DC MOTOR Page 4
FEATURES:
Microcontroller ATmega8Operating Voltage 5VInput Voltage (recommended) 7-12VInput Voltage (limits) 6-20VDigital I/O Pins 14 (of which 6 provide PWM output)Analog Input Pins 6DC Current per I/O Pin 40 mADC Current for 3.3V Pin 50 mAEEPROM 1 KBClock Speed 16 MHz
PCB design:
SPEED CONTROL OF DC MOTOR Page 5
H-Bridge (L293D):
An H bridge is an electronic circuit that enables a voltage to be applied across a load in either direction. These circuits are often used in robotics and other applications to allow DC motors to run forwards and backwards.
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors. L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively. Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.
SPEED CONTROL OF DC MOTOR Page 6
Optocoupler:
An optical coupler, also called opto-isolator, optocoupler, optocoupler, photocoupler or optical isolator, is a passive optical component that can combine or split transmission data (optical power) from optical fibers. It is an electronic device which is designed to transfer electrical signals by using light waves in order to provide coupling with electrical isolation between its input and output. The main purpose of an optocoupler is to prevent rapidly changing voltages or high voltages on one side of a circuit from distorting transmissions or damaging components on the other side of the circuit.
SPEED CONTROL OF DC MOTOR Page 7
Rotary Encoder:
A rotary encoder is an electro-mechanical device that converts the angular position or motion of a shaft or axle to an analog or digital code. Our encoder is self-made which is attach to the motor.
CODE:
float rev=0;
int rpm;
int prpm=1100;
int dcyl=155;
int oldtime=0;
int time;
void isr() //interrupt service routine
{rev++;
}
void setup()
{attachInterrupt(0,isr,FALLING); //attaching the interrupt
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
}void loop()
{
delay(2000);
detachInterrupt(0); //detaches the interrupt
time=millis()-oldtime; //finds the time
SPEED CONTROL OF DC MOTOR Page 8
rpm=(rev/(2*time))*60000; //calculates rpm
oldtime=millis(); //saves the current time
rev=0;
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
if(rpm>(prpm-10 ) && rpm<(prpm+10))
{dcyl=dcyl;}
else if(rpm>prpm)
{ if (dcyl>154)
dcyl-=5;}
else if(rpm<prpm)
{ if (dcyl<251)
dcyl+=5;}
else
dcyl=dcyl;
analogWrite(9, dcyl);
//sets the desired speed
//finds the duty cycle %
attachInterrupt(0,isr,FALLING);
delay(200);
}
SPEED CONTROL OF DC MOTOR Page 9
Conclusion:
We have implemented a feedback control of DC motor. When
Speed changes, sensor (auto coupler) output changes (pulses). From the pulses Arduino detects change of speed, and tries to minimize it by increasing the duty cycle.
REFERENCES:
http://en.wikipedia.org/wiki/Arduino
http://www.electrical4u.com/working-or-operating-principle-of-dc-motor/
http://www.arduino.cc/en/Main/ArduinoBoardUno
https://www.futureelectronics.com/en/optoelectronics/optocouplers.aspx
SPEED CONTROL OF DC MOTOR Page 10