Pulse Width Modulation H-Bridge and Servo Drivers
Pulse Width Modulation
H-Bridge and Servo Drivers
H-Bridge Motor Drivers
Transistor Switch
Enable/Direction Control
PWM for Speed Control
Pop Quiz
On the previous slide, calculate the average voltage for each waveform. Take the ON condition to be +5 Volts and the OFF condition to be 0 Volts. VAVG is defined as:
VT
V t dtAVG
T
= ∫1
0
( )
Don’t do any c_____! Just add up the areas of rectangles until you have the total area over a complete period and then divide by the period.
Pop Quiz #2
Now calculate the RMS voltage for each waveform. Take the ON condition to be +5 Volts and the OFF condition to be 0 Volts. VRMS is defined as:
VT
V t dtRMS
T
= ∫[ ( ) ]1 2
0
Don’t do any c_____! Just add up the areas of rectangles formed by V2 until you have the total area over a complete period, and then divide by the period. Then take the square root. Sketch VAVG and VRMS as functions of duty cycle.
The Servo Motor
SummaryH-Bridge Servo
• PWM sets duty cycle.• Power is proportional
to VRMS. VAVG is proportional to duty cycle. (close enough)
• Frequency is not important. Typically from 50 Hz to 1000 Hz.
• PWM sets pulse width.
• Pulse width gives the desired position of the servo motor.
• Repetition rate is not very important. Typically from 14 to 20 ms.
PWM Mini-Lab A typical pulse train for motor speed control has a frequency of 50 Hz and a 50% duty cycle. Let’s build our own version of this pulse train using sleep commands (actually use msleep(Long Integer) for minimal overhead) . . while (1) { fd(0); fd(3); msleep(10L); // first msleep ao(); msleep(10L); // second msleep } . . I Code your Handy Buggy to move ahead with a 50 Hz, 50% duty cycle pulse train. Time your Buggy over a short course (say 1 or 2 meters). Traverse the same course using: while (1) { motor (0,50); motor (3,50); } and compare the performances. II Complete the following table: frequency (Hz) duty cycle (%) first msleep (ms) second msleep (ms)
50 50 10 10 50 25 50 75 100 50 100 10 100 90 500 50
III. Test these “homemade” pulse trains, as time permits, and compare with “motor ()“ implementations. Do the “homemade” implementations appear jerkier? Does Buggy “drift right” or “drift left” to a greater degree?