Why We Made Our Own:

 

In some ways this is about motor controllers in general. As noted elsewhere we are all fans of products from HBridgeCompleteTopView Adafruit and Sparkfun. And both companies make motor controllers designed to work with the Arduino.

 

But this website is about learning how device works and how to write the programming code to make them do what is wanted. For this reason we like to build whatever we can. We also like to build with parts big and rugged enough to be handled by untrained students.

 

In this case, we wanted a very simple H-bridge learning kit that could be used to control a pair of DC motors or a single stepper motor. The motors we had in mind is the Hobby Gearmotor from Sparkfun, but this controller will run any DC motor whose current requirements do not exceed a continuous one amp.

 

The Problem to be Solved:

 

A DC motor can be connected to a pair of output pins of an Arduino. Assuming the current requirements of the motor are modest, if one output pin is set HIGH while the other LOW the motor will turn. Reversing the output pins also reverses the direction of the motor. Setting the first LOW and the second HIGH will also cause the motor to turn in the reverse direction. Simple.

 

Unfortunately, motors capable of moving a rolling robot want between 0.3 and 1.3 amps, depending on what the motor is trying to do. The Arduino, alas, has a current limit of about 0.1 amp. If the motor isn't attached to anything, no problem. It will turn. But it can't move a robot up a hill or push another out of a ring or play robot soccer. Power is the product of voltage and current. If the current is limited, so is the power.

 

One solution is to connect the motor directly to the power source via a switching transistor. This works well until it comes time to reverse the direction of the motor. Here, the electronics become more complicated.

 

An H-bridge is a special power switching circuit that not only turns power on and off, but can reverse polarity.

Pin 1 Pin 2 Motor Behavior
HIGH HIGH Stopped
HIGH LOW Turns one direction
LOW HIGH Turns other direction
LOW LOW Stopped

 

 

 

 

 

 

 

Our H-bridge Breakout Board

 

Rather than have students build a complete H-bridge from discrete parts we adopted the Texas Instruments L293 integrated circuit and added Lesson 13 to teach how it is used with the Arduino to control DC motors.

 

How To #7 provides instructions for constructing the H-bridge breakout board. The board includes a set of eight fast-recovery diodes. The reason for these diodes is that the differences between a DC motor and a DC generator is only whether some outside force is causing the motor to turn. If you are running your robot at full speed then suddenly tell it to stop, the forward momentum of the robot will force the motors to keep turning for a short while. During this slowdown time they are acting as generators and sending electrical current back into the H-bridge.

To prevent this current from damaging the H-bridge integrated circuit we use these diodes to short the currently harmlessly.

 

We've been very pleased with this little circuit board and hope you enjoy it too.