How to Make a SIMPLE BiPolar Transistor H-Bridge
by crazychewy in Circuits > Arduino
10 Views, 0 Favorites, 0 Comments
How to Make a SIMPLE BiPolar Transistor H-Bridge

Are you curious about building a circuit that can control the direction and speed of a DC motor using simple components and Arduino? Following this guide, you'll learn how to construct a bipolar transistor H-bridge motor circuit—a versatile and widely-used design in robotics and electronics. Controlled by an Arduino, this H-bridge allows you to command your motor to move forward, reverse, brake, or coast with ease, all by manipulating the flow of current. This circuit works well with power sources from 2.2V to 9.6V, so it's a good fit for smaller projects.
By following this guide, you'll discover:
- How an H-bridge circuit operates using NPN and PNP transistors.
- How to wire the circuit on a breadboard.
- Techniques to control motor direction and speed by switching transistor pairs using an Arduino.
Whether you're working on a robotics project, experimenting with motor control, or just starting out with basic electronics, this project will provide you with a solid foundation to get started!
Supplies
What you need:
- 1x Breadboard
- 1x DC Motor
- 2x 2N2222A Transistors
- 2x 2N3906 Transistors
- 4x 1N4005 Diodes (Help absorb the motor’s reverse current and suppress Back EMF)
- 4x 1k Ω Resistors
- Battery (9V) or Power Supply
- Insulated Jumper Wire
- Wire Cutter + Stripper
- Computer with Arduino IDE
- Arduino UNO/Nano
Wiring

Important Notes:
When wiring your H-Bridge circuit, ensure your diodes are oriented correctly. As shown in the image above, top transistors Q4 & Q2 are flat side down whereas bottom transistors Q3 & Q1 are flat side up.
To connect the battery to your circuit, attach the positive end of your battery to the top row of your breadboard (labeled +VDC), and the negative end of your battery to the bottom row of your breadboard (labeled GND). (This sets up the power and ground rails)
Testing

To try it out the H-Bridge, connect a wire from GND to the right-side of R2. Then, connect a wire from +VDC to the left-side of R3. The motor should spin forward.
Controlling the Motor With Arduino


Now that you've built your H-Bridge, it's time to hook it up to your Arduino to control the motor's movement.
You’ll need 4 available digital output pins on your Arduino to control the H-Bridge, each connected to the base of a transistor through a resistor.
Use the table above to check your wiring:
*Each Arduino pin connects to the non-transistor side of the resistor (R1-R4)*
Also connect:
- Arduino GND ➝ Breadboard GND rail (bottom black wire rail).
- Arduino 5V or Vin ➝ Breadboard +VDC rail (top red wire rail). Be cautious: if your motor needs more than 5V, use an external power source and only tie the grounds together (don’t connect the Arduino’s 5V pin to the power rail on the breadboard).
IMPORTANT OPERATION RULES:
Only turn on one diagonal pair at a time:
- Q1 + Q4 ➝ Motor spins one direction.
- Q2 + Q3 ➝ Motor spins opposite direction.
Never turn on Q1 + Q2 or Q3 + Q4 at the same time (short circuit).
Code
Now for the final step, open the Arduino application on your computer and insert this code:
// Define H-Bridge control pins
int in1 = 8; // Q1
int in2 = 9; // Q2
int in3 = 10; // Q3
int in4 = 11; // Q4
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
}
void loop() {
// Forward: Q1 + Q4
digitalWrite(in1, HIGH);
digitalWrite(in4, HIGH);
delay(2000); // run motor for 2 seconds
digitalWrite(in1, LOW);
digitalWrite(in4, LOW);
delay(1000);
// Reverse: Q2 + Q3
digitalWrite(in2, HIGH);
digitalWrite(in3, HIGH);
delay(2000);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
delay(1000);
// Brake (both sides LOW)
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
delay(2000);
// Coast (no connection to motor) — same as brake in basic H-bridge
delay(2000);
}
Troubleshooting Tips
Here are some fixes to problems that may arise while building your H-bridge.
Motor not spinning?
- Double-check your transistor orientation. Make sure the PNP transistors (Q2, Q4) are on top (flat side down) and NPN transistors (Q1, Q3) are on the bottom (flat side up).
- Verify that your diodes are facing the correct direction — they must point from motor terminals toward the power rails (cathode to V+, anode to motor for PNP; reverse for NPN side).
- Ensure the battery or power supply is connected correctly: +VDC to the top rail, GND to the bottom.
Arduino connected, but nothing happens?
- Check that each Arduino digital output pin is correctly wired to the proper resistor/transistor base (see the wiring table in step 3).
- Make sure you’ve uploaded the code successfully and selected the right COM port in the Arduino IDE.
- Confirm the Arduino is receiving power — the onboard LED (usually near pin 13) should be on when plugged in via USB.
Getting hot components or weird smells?
- Immediately unplug power. This could be a sign of a short circuit — usually from turning on both transistors on one side (Q1 + Q3 or Q2 + Q4).
- Re-check your control logic and make sure only one diagonal pair is activated at a time.
Motor only spins in one direction?
- One of your transistor pairs might not be receiving the correct signal — use a multimeter or LED to check if voltage is reaching the base of each transistor when it should.
- Try swapping the motor leads temporarily to confirm the H-bridge is working both ways.
Conclusion
Congrats! You’ve successfully built a functional H-bridge motor driver using simple components, and now you know how to control the direction and speed of a motor with an Arduino. This project is a solid starting point for robotics, remote-controlled systems, or any other project that involves motor control. I hope this guide has helped you learn the fundamentals and inspire your next project!