If you want to build a vehicle or a mobile robot with wheels or mats, you will need a H bridge, a circuit which controls the two directions of a DC motor.
To make a H bridge, is necessary:
- 4 resistors with value between 560Ω and 1kΩ;
- 2 middle power NPN transistors (For example TIP 120, TIP 122 or TIP 142);
- 2 middle power PNP transistors (Like TIP 127 or TIP 147);
- Wires to connection;
- A DC motor;
- Some DC power source, can be batteries or a DC electronic source.
To know more how the NPN and PNP transistors work click in the button below.
This is the schematics.
The circuit in protoboard.
After the test, build this circuit in a printed circuit board. Clique in this button to learn how to make circuit in board.
You could put a resistor in the bases of Q1 and Q3 and another in the base of Q2 and Q4, it will work too, however the motor will lost power and will be slower. Therefore it is better use 4 resistors in each transistor’s base. You can use MOSFETs (field effect transistors) instead of BJT. In the place of NPN and PNP, you put type N and type P respectively.
How it works?
When Input1 is in high level and input2 in low level, Q1 and Q2 stay in cutoff while Q3 and Q4 stay in saturation and allow current passage. The arrows in red show the current direction.
When the Input1 stay on low level and Input2 on high. Q1 and Q2 stay in saturation while Q3 and Q4 is in cutoff. The current goes in another direction.
If both inputs stay in high or low level, won`t have current in the motor, because the transistors in the same line will stay in the same state.
Integrated circuits and H bridge shields
There are integrated circuit which already come with two H bridges like it is the case of L293NE.
You can find this chip`s datasheet in this site, just write the chip`s name in the search bar. Exist also the shields, which are circuits ready with H bridges to link to the Arduino. This is a shield with integrated circuit L298 which can control 2 DC motors.
This is the Adafruit shield, can control 4 DC motors or 2 stepper motors and 2 servomotors, I will let more details and working to other post.