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 is simple, cheap to make, and is 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)
  • breadboard
  • 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!

    DIY H-bridge for Motor Control
    DIY H-bridge for Motor Control

    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.

    //H-bridge code!

    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

    void setup()

    {

    pinMode(H1, OUTPUT);

    pinMode(H2, OUTPUT);

    pinMode(H3, OUTPUT);

    pinMode(H4, OUTPUT);

    //Set pins as outputs for transistors

    }

    void loop()

    {

    digitalWrite(H1, HIGH);

    digitalWrite(H4, HIGH);

    delay(1000);

    digitalWrite(H1, LOW);

    digitalWrite(H4, LOW);

    delay(500);

    digitalWrite(H2, HIGH);

    digitalWrite(H3, HIGH);

    delay(1000);

    digitalWrite(H2, LOW);

    digitalWrite(H3, LOW);

    delay(500);

    //Turns one way for a second, then switches directions

    }

  •  
     

    Tag cloud

    make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel