Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave...
-
Upload
dominic-tacy -
Category
Documents
-
view
213 -
download
1
Transcript of Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave...
![Page 1: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/1.jpg)
Pulse Width Modulationand
Motor ControlMark Barnhill
Roy DongAndrew KleevesMicajah Worden
Dave SeatonFacilitator: Professor Strangas
![Page 2: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/2.jpg)
Agenda• Pulse Width Modulation• Brushed DC Motor• How to Code PWM• DACs and PWM Amplification• Back EMF• Ramp Control• PID Controller• Motor Characterization• PID Simulation
![Page 3: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/3.jpg)
• Speed Control• Duty Cycle• Advantages• Disadvantages
Pulse Width Modulation
![Page 4: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/4.jpg)
• Field Magnets• Stator• DC Power Supply• Armature or Rotor• Axle• Commutator• Brushes
Brushed DC Motor
![Page 5: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/5.jpg)
• Example here will cover MSP430– Concepts can be easily extended
How to Code PWM
![Page 6: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/6.jpg)
• One pin has multiple functions– Set PxSEL accordingly– P2DIR |= BIT2; // set P2.2 as output– P2SEL |= BIT2; // use pin as TA1.1
– Why |= operator?
Reading the Datasheet
![Page 7: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/7.jpg)
• Counter counts up each clock cycle• What do the different modes mean?
– CCR0 = 1000-1;
– Why minus 1?
Setting Timer Values
![Page 8: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/8.jpg)
• We are using Timer A• We must set TACTL
– TACTL = TASSEL_2 + MC_1; // SMCLK, up to CCR0
– Which clock do you want to use?
Looking into ‘MSP430G2231.h‘
![Page 9: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/9.jpg)
• We are using Timer A1.1• CCTL1 = OUTMOD_7; // reset at CCR1• ; // set at CCR0
• OUTMOD_1 sets at CCRx• OUTMOD_2 toggles at CCRx, resets at CCR0
PWM Output Modes
![Page 10: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/10.jpg)
• We are using Timer A1.1– Recall:– TACTL = TASSEL_2 + MC_1; // SMCLK, up to CCR0
– CCR0 = 1000-1;– CCTL1 = OUTMOD_7; // reset at CCR1– ; // set at CCR0
– Now:– CCR1 = 200-1; // 20% duty cycle
– What will this do?
Setting the Duty Cycle
![Page 11: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/11.jpg)
• DACs are used to convert a digital signal to analog– Why does a PWM signal become a steady DC
value?• Microprocessors can’t provide enough current
to drive a motor
DACs and PWM Amplification
![Page 12: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/12.jpg)
Back Electromotive Force (EMF)
• A motor converts electrical energy to mechanical energy
• This conversion can go both ways • If a motor is spinning it will generate electrical
energy– Called back emf
![Page 13: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/13.jpg)
Example of Back EMF
![Page 14: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/14.jpg)
Example of BEMF with a Load
![Page 15: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/15.jpg)
Functional Block Diagram ofPWM DC Motor Control
![Page 16: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/16.jpg)
• Is an integrator
• Adjusts the set point up to the desired value.
Ramp Control
![Page 17: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/17.jpg)
• e(t)= Setpoint - measured• Kp, Ki and Kd must be tuned according to
desired output characteristics
PID Control
![Page 18: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/18.jpg)
• Basic DC motor systems can be represented by this electromechanical schematic. (bottom-left)
• The motor speed () as a function of input voltage () is governed by an open loop transfer function. (bottom-right)
• It is helpful to characterize the motor to obtain simulations/projected results along with PID estimates for the system.
𝜃𝑉
=𝐾
( 𝐽 ∙ 𝑠+𝑏 ) (𝐿 ∙ 𝑠+𝑅 )+𝐾 2
DC Motor Model
![Page 19: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/19.jpg)
• In order to obtain the motor parameters, basic DC machine tests must be used.
• To get an estimate for Rwdg :– The rotor must be locked.– 5 different voltages are supplied to the windings.– The current is measured.– Ohm’s Law: to find average resistance
Rwdg = 1.2932 Ω
Voltage (Volts) Current (Amps) Resistance (Ohms)
0.30 V 0.23 A 1.304 Ω
0.50 V 0.39 A 1.282 Ω
0.70 V 0.56 A 1.250 Ω
1.00 V 0.79 A 1.266 Ω
1.20 V 0.88 A 1.364 Ω
Motor Characterization
![Page 20: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/20.jpg)
• Rotor speed and input voltage are directly related by the motor constant (K) in the equation:
• A no-load test supplying 12.0 Volts to the motor results in 830 mA drawn at a speed of ~14,200 rpm (1,487.0205 rad/s).
• Using the winding resistance from before, the Back EMF is subtracted from the supply which results in: K = 0.007348 V/rad
Motor Characterization Cont.
![Page 21: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/21.jpg)
J=0.002;b=0.00924;K=0.007348;R=1.2932;L=0.05;
step(K,[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)]);
RiseTime: 0.4871SettlingTime: 0.8853 SteadyState: 0.6120 Overshoot: 1.1044
Open Loop Simulation
![Page 22: Pulse Width Modulation and Motor Control Mark Barnhill Roy Dong Andrew Kleeves Micajah Worden Dave Seaton Facilitator: Professor Strangas.](https://reader038.fdocuments.us/reader038/viewer/2022110319/56649c765503460f9492aee2/html5/thumbnails/22.jpg)
J=0.002;b=0.00924;K=0.007348;R=1.2932;L=0.05;
Kp=20;Ki=30;Kd=29;
num_PID=[Kd, Kp, Ki];den_LOOP=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2)];
num_B=conv(K,num_PID);den_B=conv(den_LOOP,[1 0]);[num_SYS,den_SYS]=cloop(num_B,den_B);
step(num_SYS,den_SYS)
RiseTime: 0.1788SettlingTime: 0.2168 SteadyState: 1.0000 Overshoot: 0
Kp: 20 Ki: 30 Kd: 29
PID/Closed Loop Simulation