This article shows how you can implement PWM in your own robotics projects. By
building these two simple devices — a general-purpose, low voltage light dimmer
and a fan motor speed controller — you will clearly see the principles in action.
Controlling Motors and
Lights With Pulse Width
FIGURE 1. General-purpose
By Jürgen G. Schmidt
There are switches everywhere! Most of them turn
things either on or off, but sometimes we want something
turned only partly on. Our cars are an example of this. We
use an accelerator to control the engine speed. A simple
on/off switch for the engine might be exhilarating but
ultimately not very useful. The same is true for some of our
lights, fans, and robots. We need to control how much they
are turned on.
I had just finished replacing my halogen workbench
light with an LED light strip I made from three watt LEDs.
Now, I needed a dimmer for it. The LEDs work best at a
constant voltage, so a PWM–based control seemed like the
way to go. PWM (Pulse Width Modulation) consists of
turning a device on and off very rapidly. The proportion of
the time that the device is switched on is determined by the
width of the pulses; therefore the term pulse width
modulation. You will find PWM used in many projects,
particularly with robot motors.
A simple alternative to PWM is to use a variable resistor
in series with the device you want to control. This wastes a
lot of power as heat, and as the voltage drops the device
you are controlling may stop working too soon.
The 555 timer chip is frequently used to generate PWM
signals. This chip — along with a few resistors and a
capacitor, some calculations, and experimenting — will yield
an inexpensive and effective result. You can see the basic
astable circuit description and calculations in the 555
datasheet (see References). However, I wanted a design
with pushbutton controls for increasing and decreasing the
speed or brightness, and I needed the flexibility to easily
experiment with the various parameters of a PWM signal. I
prefer to do this in software rather than hardware.
54 SERVO 06.2010