100% found this document useful (1 vote)
81 views11 pages

Preface: Speed Control of DC Motor Using PWM By-Yash Doshi

The document discusses speed control of a DC motor using pulse width modulation (PWM). It begins by explaining that PWM varies the average voltage sent to the motor by rapidly switching the motor's power supply on and off. This causes the motor to see an average voltage that is lower than the battery voltage, resulting in slower speeds. It then provides details on implementing PWM control using a microcontroller and motor driver, including the circuit diagrams and software code.

Uploaded by

rochmat
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
81 views11 pages

Preface: Speed Control of DC Motor Using PWM By-Yash Doshi

The document discusses speed control of a DC motor using pulse width modulation (PWM). It begins by explaining that PWM varies the average voltage sent to the motor by rapidly switching the motor's power supply on and off. This causes the motor to see an average voltage that is lower than the battery voltage, resulting in slower speeds. It then provides details on implementing PWM control using a microcontroller and motor driver, including the circuit diagrams and software code.

Uploaded by

rochmat
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

SPEED CONTROL OF DC MOTOR USING PWM By- yash Doshi

Preface
The purpose of a motor speed controller is to take a signal representing the demanded speed, and to drive a motor at that speed. The controller may or may not actually measure the speed of the motor. If it does, it is called a Feedback Speed Controller or Closed Loop Speed Controller, if not it is called an Open Loop Speed Controller. Feedback speed control is better, but more complicated, and may not be required for a simple robot design. Motors come in a variety of forms, and the speed controller's motor drive output will be different dependent on these forms. The speed controller presented here is designed to drive a simple cheap starter motor from a car, which can be purchased from any scrap yard. These motors are generally series wound, which means to reverse them, they must be altered slightly, The speed of a DC motor is directly proportional to the supply voltage, so if we reduce the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be achieved when the battery is fixed at 12 Volts? The speed controller works by varying the average voltage sent to the motor. It could do this by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A better way is to switch the motor's supply on and off very quickly. If the switching is fast enough, the motor doesn't notice it, it only notices the average effect. When you watch a film in the cinema, or the television, what you are actually seeing is a series of fixed pictures, which change rapidly enough that your eyes just see the average effect movement. Your brain fills in the gaps to give an average effect. Now imagine a light bulb with a switch. When you close the switch, the bulb goes on and is at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts). Now if you close the switch for a fraction of a second, then open it for the same amount of time, the filament won't have time to cool down and heat up, and you will just get an average glow of 50 Watts. This is how lamp dimmers work, and the same principle is used by speed controllers to drive a motor. When the switch is closed, the motor sees 12 Volts, and when it is open it sees 0 Volts. If the switch is open for the same amount of time as it is closed, the motor will see an average of 6 Volts, and will run more slowly accordingly.As the amount of time that the voltage is on increases compared with the amount of time that it is off, the average speed of the motor increases.

The time that it takes a motor to speed up and slow down under switching conditions is dependant on the inertia of the rotor (basically how heavy it is), and how much friction and load torque there is. The graph below shows the speed of a motor that is being turned on and off fairly slowly:

You can see that the average speed is around 150, although it varies quite a bit. If the supply voltage is switched fast enough, it wont have time to change speed much, and the speed will be quite steady. This is the principle of switch mode speed control. Thus the speed is set by PWM Pulse Width Modulation.

PULSE WIDTH MODULATION (PWM)


The frequency of the resulting PWM signal is dependant on the frequency of the ramp waveform. What frequency do we want? This is not a simple question. Some pros and cons are:

Frequencies between 20Hz and 18kHz may produce audible screaming from the speed controller and motors - this may be an added attraction for your robot! RF interference emitted by the circuit will be worse the higher the switching frequency is. Each switching on and off of the speed controller MOSFETs results in a little power loss. Therefore the greater the time spent switching compared with the static on and off times, the greater will be the resulting 'switching loss' in the MOSFETs.

The higher the switching frequency, the more stable is the current waveform in the motors. This waveform will be a spiky switching waveform at low frequencies, but at high frequencies the inductance of the motor will smooth this out to an average DC current level proportional to the PWM demand. This spikyness will cause greater power loss in the resistances of the wires. This third point can be seen from the following two graphs. One shows the worst case on-off current waveform, the other the best case steady DC current waveform:

Both waveforms have the same average current. However, when we work out the power dissipation in the stray resistances in our motor and speed controller, for the DC case:

and for the switching case, the average power is

So in the switching waveform, twice as much power is lost in the stray resistances. In practice the current waveform will not be square wave like this, but it always remains true that there will be more power loss in a non-DC waveform. Choosing a frequency based on motor characteristics One way to choose a suitable frequency is to say, for example, that we want the current waveform to be stable to within p percent. Then we can work out mathematically the minimum frequency to attain this goal. This section is a bit mathematical so you may wish to miss it out and just use the final equation.The following shows the equivalent circuit of the motor, and the current waveform as the PWM signal switches on and off. This shows the worst case, at 50:50

PWM ratio, and the current rise is shown for a stationary or stalled motor, which is also worst case.

T is the switching period, which is the reciprocal of the switching frequency. Just taking the falling edge of the current waveform, this is given by the equation

is the time constant of the circuit, which is L / R.So the current at time t = T/2 (i1) must be no less than P% lower than at t = 0 (i0).

Circuit Diagram

MICROCONTROLLER BOARD SCHEMATIC

MOTOR DRIVER L293D BOARD SCHEMATIC

MICROCONTROLLER BOARD LAYOUT

MOTOR DRIVER L293D BOARD LAYOUT

Software
#include<p89v51rd2.h> #define start P1_0 #define stop P1_1 #define up P1_2 #define down P1_3 #define clk P1_4 #define anticlk P1_5 void DELAY(unsigned int dela) { unsigned int i,k; for(k=0;k<dela;k++) { for(i=0;i<125;i++) {} } }

code const unsigned char stdis[4]={0XFC,0XF3,0XCF,0X3F}; typedef enum { motor1=0, motor2=1, motor3=2, motor4=3 }motor_num; motor_num num[2]; typedef enum { ccw=0, cw=1 }direction; direction for_rev[2],motorrun[2]={1,1}; unsigned char speed[2],count[2]={0,0};

void RUNMOTOR(motor_num {

number,direction direction1,unsigned char speed1)

motorrun[number]=0; num[number]=number; for_rev[number]=direction1; speed[number]=speed1; TMOD=0x02; IEN0=0x82; TH0=0x00; TR0=1; } void isr(void) interrupt 1 { if(motorrun[0]==0) { if(count[0]==100) count[0]=0; if(count[0]<=speed[0]) { P2_0=for_rev[num[0]]; P2_1=!P2_0; } else { P2_0=0; P2_1=0; } count[0]++; } if(motorrun[1]==0) { if(count[1]==100) count[1]=0; if(count[1]<=speed[1]) { P2_2=for_rev[num[1]]; P2_3=!P2_2; } else { P2_2=0; P2_3=0; } count[1]++; } } void STOPMOTOR(motor_num no) {

TR0=0; motorrun[no]=1; P2=P2 & stdis[no]; TR0=1; }

void main(void) { int i,c; i=0; c=1; P1 = 0xFF; while(start == 1); while(1) { if(c ==1) { RUNMOTOR(motor1, cw, i); } if(c==0) { RUNMOTOR(motor1, ccw, i); } DELAY(1000); if(stop == 0) { DELAY(100); STOPMOTOR(motor1); while(start == 1); } if(up == 0) { DELAY(100); if(i == 100) { } else { i=i+10; } } if(down == 0) { DELAY(100); if(i == 0) { } else { i=i-10;

} } if(clk==0) { DELAY(100); c=1; } if(anticlk == 0) { DELAY(100); c=0; }

You might also like