Motor controllers

Understanding Motor Controllers ¶ 

By Matt Mets

Block Image

The popular L293DNE motor driver

Critical to any robot that moves, a motor controller is the part that turns the motors on and off, and controls what direction they move in. There are as many different kinds of controllers as there are types of motors (lots!), but they all basically do the same thing: switch power on/switch power off.

For many small bot projects, you're probably going to be using DC motors to power your drivetrain. DC motors are pretty easy to turn on — all you have to do is hook them up to a battery! If you only need a motor to spin in one direction, then your motor controller would consist of a single switch, or transistor. This would be the case for, say, a vibrator motor in your cellphone, which only needs to turn on or off. For a robot drive wheel, though, you probably want it to be able to go backwards as well as forwards. To do this, you need a way to flip the connections between the battery and the motor, so that the motor lead that was plugged into the positive side of the battery is now connected to the negative side, and vice versa. One way to do this is to use a series of four switches:

Block Image

Basic H-bridge switch configuration

In the above schematic, the lines represent wires, the circle on the left is the battery, and M is the motor. There are four switches, which are used to connect each motor lead to either the positive or negative side of the battery. To get the motor to turn in one direction, you close switches S1 and S4, which connects the left side of the motor to positive, and the right side to negative:

Block Image

Close switches S1 and S4 and the motor turns in one direction. Close S2, S3 and it turns in the opposite direction

To get it to turn in the other direction, open those first two switches, then connect S2 and S3 (see figure)

These switches would work great for controlling a motor by hand, but how can we hook it up to our microcontroller? Well, it turns out that there is a circuit designed to do just this. Called an H-bridge, it uses transistors as switches, so that control signals from a microcontroller can be used to turn them on and off. You could build the circuit yourself using individual transistors (it's a great way to really learn how they work!), but usually, it's better to use a pre-made chip, such as the L293DNE. Check out the DC Motor Control article on the ITP website for a good overview of how to use this chip with your microcontroller.

Block Image

A typical motor controller hook-up in a robotic control system

Comments Add Note Comments are onturn off

No comments.