H Bridge Motor Driver


-Why not use 4 NPN transistors but use 2 NPN and PNP transistors?
-What is the use of the diode in this circuit?

Check out: Bipolar Transistor HBridge Motor Driver - Robot Room

PNPs are used for the high-side drivers to avoid the need for a separate power supply for the drivers (NPNs need base 0.7V above emitter and collector when saturated)

The diodes are free-wheel diodes, always needed for an inductive load (see any of the motor or relay driver circuit examples everywhere). They prevent damaging inductive voltage spikes when a driver turns off.

This circuit won't work for Arduino unless the power supply is 5V since the high-side drivers only turn off if their bases brought up to near the H-bridge supply.
You also have to ensure its driven correctly to prevent shoot-through (where both NPN and PNP drivers on one side are on simultaneously, shorting out the supply and leading to damaging high currents).

The main problem with this circuit is that you don't have enough voltage from the Arduino to guarantee the upper (PNP) transistors turn off. That requires about 0.6V below the supply (at least!) or 9.6 - 0.6 = 9V, worst case, and your poor old Arduino can manage only 5V.

If the upper transistors are not fully OFF, they (probably both) will still conduct. Now you turn-on a bottom transistor and the current simply flows down through perhaps even both upper transistors, through the lower one, which you have set to ON, and you let the magic smoke out of at least two transistors.

If you wanted more power to your motors, i.e. more voltage, the situation gets worse.

Geoff