Introduction: DIY H-bridge for Motor Control
Ever wanted to make a robot, but don't have an H-bridge handy? Then make your own! It's easy, cheap to make, and simple in concept and design. It doesn't have Pulse Width Modulation to control speed, but that isn't totally necessary.
Step 1: Get It!
All you need is...
- 4 NPN transistors (salvage from old electronics)
- small DC motor (everyone should have one from an old RC car)
- Arduino Uno (optional, used to control the motor)
- 4 resistors (any value really)
Step 2: Build It!
Wire up the connections as shown in the picture. The resistors are for the inputs from a microcontroller to control the direction of the motor. Be sure to orient the transistor the right direction. here I added a sitch to turn on the opposite transistors to turn one direction or another.
Step 3: Use It!
Hook up the inputs to the resistors, the digital pins in an Arduino. You can use the code below to test it. Opposite transistors turn the motor. Be sure to connect a battery to the power and ground rails on the breadboard, and connect the ground from the Arduino to the ground rail on the breadboard.
const int H1=9;
const int H2=10;
const int H3=11;
const int H4=12;
//Pins for the transistors, starting at the top left, going around clockwise
//Set pins as outputs for transistors
//Turns one way for a second, then switches directions
We have a be nice policy.
Please be positive and constructive.