The principles of DC
motors are covered in the beginner and intermediate sections of this
tutorial. This section will cover the electronics needed to interface
them to a Basic X microcontoller or other digital chip.
The easiest way of
controlling motors is using the Robocore. This board contains the
driver electronics to control up to 4 DC motors or 2 stepper motors,
and features direction LED's for easy debugging of circuits.
However, if you want to
build your own motor drivers to use in custom projects there are
various methods that you can use.
A circuit called an H
bridge circuit will give you direction control of your DC motor. Below
is the circuit diagram.

Here's how the circuit
works.
Transistors are
electronic switches, they allow you to turn on large voltages (the
motor power supply) using a very small current (like the output pin of
the Basic X). Each pair of transistors is connected to a pin on the
micro controller and control the polarity of the current supplied to
the motor. The actual components required would depend on the size of
the motors that you want to use.
The diodes in the
circuit are very important and are called fly back diodes. They are
there to prevent voltage spikes from the motors from destroying the
transistors. When a motor rotates and changes direction the coils of
wire inside it act as a generator and produce a current. This current
is called the back electro motive force, or back E.M.F. for short.
This current travels back through the circuit, in the form of powerful
voltage spikes, to the transistor. Now, because transistors only allow
current to flow in one direction the current hits a bottle neck as the
transistor tries to stop the reverse current. If this current is
particularly large, say when your reversing the direction of the
motor, it will simply blow the transistor, giving your new circuit a
pretty short life.
The diodes job is to
protect the transistor. It allows this back E.M.F. to bypass the
transistor and travel safely back to the battery.
The circuit can be
powered using whatever voltage is suitable for your motors. If you are
using two power supplies, one to power your Basic X and another to
power your motors, you must connect the ground of each supply together
or your circuit may not work properly.
If you're looking for
specific components to build the circuit the following will handle
most motors up to about 12 volts.
Transistors: TIP41 NPN
power transistor |
Diodes: IN4002 |
Resistors:
2.2Kohm, 0.25 watt |
|