By Chris Savage
40 SERVO 10.2016
Opening Doors with DC
DC motors are pretty common in a lot of motor drive
units, such as those used in robotics, linear actuators, belt-drive systems, etc. Unlike a servo, a DC motor can’t be
connected directly to the I/O pins of a microcontroller. The
servo has its own internal drivers and logic to control the
servo based on signals from the microcontroller (or RC
receiver). However, with a DC motor, you still need a driver
circuit. This driver circuit could be as simple as a transistor
to turn the motor on/off. If you need directional control of
the motor, then you would use a circuit called an H-bridge.
I’m not going to get into the details of how an H-bridge works. There are many tutorials on the Internet that
can be found with a simple search. Suffice it to say that an
H-bridge allows us to not only turn the motor on and off,
but to reverse the polarity, changing its direction. While the
servo was able to change direction with a single I/O pin
based on the pulse width, the H-bridge has two inputs.
Figure 1 shows a highly simplified H-bridge diagram.
The M1 and M2 inputs control the polarity on either side of
the motor. Of course, there is a little bit more to it than
this, but I’m going to use an L293D IC, which is a quad half
H-bridge. By wiring everything up properly, this IC can be
project, I am only going to use one half of the IC since I
am only controlling one motor.
When you connect a DC motor to a power supply, it
spins in one direction. To change directions, you must
reverse the connections to the power supply. The H-bridge does this for us using the two inputs to set the
polarity for each terminal. So, if you make one terminal
high and the other low, the motor spins in one direction.
Reverse those signals and the motor spins in the other
direction. Make them both low and the motors stop
since both terminals are effectively at ground level.
Figure 2 shows the wiring of the L293D on the
breadboard area of the Board of Education (BOE; from
Parallax). Refer to the schematic for more details.
This time, we’ll be
door control. For each
part of this three-part
series, we’ll cover a
specific motor type as
well as a specific limit
switch type. In the
previous installment, I
focused on using
servos for motion and
optical limit switches.
In this article, I will
discuss DC motors
using mechanical limit
switches; Part 3 will
cover stepper motors
switches and Hall-effect sensors. You
can mix and match
motor types with limit
switch types as your
Figure 1. H-bridge