Sunday, 2 September 2012

H Bridge

The insect robot was interesting and simple to build but my plans are for a more sophisticated wheeled robot. The next step is to develop a motor controller that can run the motors forwards and backwards. To achieve this a circuit called an H bridge is required. This can be built using discrete transistors but its easier to use an IC. Ardunio suppliers Oomlut sell such a controller, the L293D (see here) which can control 2 motors. They also provide a circuit diagram and a sample sketch. I decided to start off simple and try the IC out with just one motor to start with. I found the circuit diagram supplied by Oomlut a bit difficult to follow so I made a version in Fritzling:
Basically the L293D has 3 digital inputs per motor:
The Enable pin is used to control the speed of the motor
Input pin 1 and 2 is used to control the direction of the motor. Set pin 1 high and pin 2 low to run the motor one way, pin 1 low and pin 2 high to run it the other way. Set both pins low to stop the motor.
The pin outs for the IC are as follows:
I found the sketch that Oomlut provided a bit complex so I wrote my own one:
This sketch uses the serial communication with the Arduino and allows the user to type an 'f' to run the motor forward, 'r' to reverse it and 's' to stop it.
The completed H bridge set up looks like this:
Next I need to add the second motor.




No comments:

Post a Comment