Photo courtesy of www.boingboing.net.
by John Toebes
Build a PWM CIRCUIT
to run a VEX MOTOR
As part of this year’s Science Olympiad
competition, the students were tasked with
building an electric car that would go a certain
distance and stop. While the Vex Robotics kit
from Innovation First is ideal for building such a
vehicle, the competition restriction on batteries
precluded the use of the 7.2V NiCad that the
Vex controller uses. Fortunately, this gave an
opportunity to experiment with other ways to
drive the Vex motor and control the car.
The first issue that you run into is that instead of just a
straight DC motor, the Vex motors are controlled with
a pulse width modulation (PWM) signal in addition to the
normal DC power. This is pretty common for servo and
stepper motors, but to control it correctly you need to
know both the frequency and the duty cycle that the motor
likes. In general, the longer the pulse, the faster the motor
goes, as illustrated in Figure 1.
So, the first task we had to deal with was
understanding exactly what type of signal to feed the
motor. We spent quite a bit of time searching the web for
Frequency
Shorter Duty Cycle
Motor Goes Slower (or Reverse)
Width
Frequency
Longer Duty Cycle
Motor Goes Faster
Width
46 SERVO 08.2008
details on the Vex motors, and after coming up with
conflicting answers (but with a general consensus), we
decided that it wanted a frequency between 50 and 100
Hz with a pulse width from 1-2 ms. We wanted to be
sure, so we went straight to the source — literally by
hooking up the real controller to a scope and measuring
the output as we varied the motor speed with the
remote control.
What we found was that the controller generally runs
at 50 Hz ( 20 ms) to 55 Hz ( 18 ms) with a pulse width of
around 2 ms to go full forward and around 1 ms to go full
backward. At around 1.5 ms, the motor
FIGURE 1 stands still and anything outside of that
range produces nicely erratic results.
Building the Controller
With the data in hand, we needed to
carefully choose from parts which were
readily available in our area — hence, we
went through the local RadioShack parts
inventory to luckily find that they still carried
the LM555 timer and all the capacitors and
resistors we needed.
With a 555, normally you get a nice
square wave with the proper resistors and
capacitors, but for this project we needed
to have a lopsided wave. To accomplish this,
all you need to do is put a diode into the
circuit shown in Figure 2 so that it discharges
faster in one direction. In the circuit we used,