Transcript Servos

DC Motor Control
The material presented is taken from a variety of
sources including:
http://www.compworks.faithweb.com/electronics/com
ponents/inductor001.html#howworks, and Building
Robot Drive Trains by Clark and Owings
Voltage



A motor requires a power source within its
operating voltage, i.e., the recommended
voltage range for best efficiency of the motor.
Lower voltages will usually turn the motor (but
provide less power).
Higher voltages, in some cases, can increase
the power output but almost always at the
expense of the operating life of the motor.
Current




When constant voltage is applied, a DC motor
draws current in the amount proportional to the
work it is doing.
For example, if a robot is pushing against an
obstacle, it is drawing more current than when it
is moving freely in open space.
The reason is the resistance to the motor
motion introduced by the obstacle.
If the resistance is very high the motor draws a
maximum amount of power, and stalls. This is
defined as the stall current of the motor: the
most current it can draw at its specified voltage.
Control



A microprocessor cannot drive the motor
directly (Not enough current supply)
The motor power must come from
another source; only control signals
come from the microprocessor
Control Topics:



Basic H-Bridges
Isolation
Pulse-width modulation
H-bridge

The basic circuit for driving DC
motors in both directions is an Hbridge. This circuit enables the
motor to spin in either direction
from a single power supply.
Noise



A DC motor can create a tremendous
amount of power supply noise. Why?
Current demand: When a motor starts
or changes direction, it draws a great deal
of current almost behaving as a short
circuit.
Commutator brush noise: As the
brushes make and break contact with the
communtator, power to the coils is
switched on and off. As a result of
inductance, the coils generate a brief high
voltage spike as the current is switched
off.
Inductance





An inductor resists change in current flow.
You learned that when current flows through a
conductor, a magnetic field surrounds the
conductive wire. The more current traveling
through the wire the greater the amount of flux.
What you didn't learn is that these lines of flux can
generate voltage on surrounding conductors.
Induced voltage results from change in current
flow. At steady state, the induced EMF collapses.
The voltage that appears in the inductor (i.e., the
motor) is of opposite polarity to the original
voltage and is called Counter Electro Motive Force
(CEMF).
The faster the current changes, the larger the
CEMF voltage. Spike of 20 times the original
voltage can appear.
A Better H-bridge
Pulse Width Modulation



Pulse width modulation is a technique for
reducing the amount of power delivered to a DC
motor.
Instead of reducing the voltage operating the
motor (which would reduce its power), the
motor's power supply is rapidly switched on and
off.
The percentage of time that the power is on
determines the percentage of full operating
power that is accomplished.
PWM
75
50
25
Which PWM frequency is best



A wide range of frequencies could be
used for the pulse width modulation
signal.
Frequencies above 1K Hz are
recommended.
Lower frequencies may resonate and
cause your motor to vibrate.
Lynxmotion DC Motor Controller
Control Truth Table
BS2 Code
' -----[ I/O Definitions ]----------------------------------Aenable
PIN
0
Aminus
PIN
2
Aplus
PIN
3
Benable
PIN
1
Bminus
PIN
4
Bplus
PIN
5
' -----[ Variables ]----------------------------------------loopCnt VAR Byte
'------[ turn both motors CCW: B fast and A slow ]----------' set motor B to turn fast CCW
HIGH Benable
' set B enable
HIGH Bminus
' set BLOW Bplus
' set B+
' set motor A to turn slow CCW
HIGH Aminus
' set ALOW Aplus
' set A+
' loop used to pluse Aenable
FOR loopcnt = 0 TO 1000
PULSOUT Aenable,1000
PAUSE 80 ' the duration of the pause determines the motor speed
NEXT