Page 278 - Robot Builder's Bonanza
P. 278

CONTROLLING THE SPEED OF A DC MOTOR    247


                   available to you depends on the module, but it’s not uncommon to have at least 64 speed
                     steps— all the way from a slow crawl to full  pedal- to- the- metal bore.
                     Many of these intelligent bridge modules are available in single-  or  dual- motor versions,
                   with current capacities of 50, 75, even 100  amps— ideal if you’re building a very large or
                   combat robot.

                   Also available are ESC motor speed controllers, originally intended for use with  high- speed
           G       R/C racing vehicles. Find these at any R/C hobby store. Though ESC motor speed controllers
                   are designed for use with R/C receivers, you can use an ordinary microcontroller to simulate
                   the signals that it expects to see. Just treat it like a servo motor.


                   Controlling the Speed of a DC Motor


                   There will be plenty of times when you’ll want the motors in your robot to go a little slower or
                   perhaps track at a predefined speed. Speed control with continuous DC motors is a science
                   in its own right, but the fundamentals are quite straightforward.


                   NOT THE WAY TO DO IT
                   Before exploring the right way to control the speed of motors, let’s examine how not to do
                   it. Many robot experimenters first attempt to vary the speed of a motor by using a potentiom-
                   eter. While this scheme can work, it wastes a lot of energy. Turning up the resistance of the
                   potentiometer (which is a variable resistor) decreases the speed of the motor, but it also causes
                   excess current to flow through the pot. That current creates heat and draws off precious bat-
                   tery power.


                   BASIC SPEED CONTROL
                   A better way is to feed the motor short on/off pulses of its usual voltage. The pulses are very
                   fast, so fast that the motor  doesn’t have time to respond to each on/off change. What hap-
                   pens is that the motor ends up averaging the ons with the offs, so, effectively, less voltage gets
                   to the motor.
                     This system of motor speed control is called pulse width modulation, or PWM. It is the basis
                   of just about all motor speed control circuits. The longer the duration of the pulses, the faster
                   the motor because it is getting full power for a longer period of time. The shorter the duration
                   of the pulses, the slower the motor.
                     Check out Figure 22- 13, which shows the on and off nature of PWM. The time between
                   each pulse is called the period, and it’s usually just a brief moment in  time— microseconds. In
                   the typical PWM system, there may be from 500 to over 20,000 of these periods each
                   second.
                     Notice that the power or voltage delivered to the motor does not  change— it’s always
                   5 volts (or 6 volts, or 12 volts, or whatever). The only thing that changes is the amount of time
                   the motor is provided with this voltage. The longer the on time in relation to the off time, the
                   more power the motors gets. Most motors function adequately at PWM ratios of 25 percent
                   or higher. Depending on the motor and other factors, at lower PWM rates the motor may not
                   receive enough power to turn its load.









 22-chapter-22.indd   247                                                                   4/21/11   11:50 AM
   273   274   275   276   277   278   279   280   281   282   283