H Bridge

As I mentioned in earlier posts, an H bridge is a type of circuit that allows a motor to be controlled by a micro controller.  Both the speed and direction of the motor are controlled by output pins on the microcontroller.

In the image below, the motor is in the center of the H bridge.  The H bridge circuit is made up of four NPN transistors.  Two act to provide voltage (Q1 and Q2)  and two act to drain the voltage to ground (Q3 and Q4).  The transistors are controlled by two PWM outputs.  PWM means that the output pin can be turned on and off at such a speed that it appears to have a varying voltage, as opposed to a normal output pin that can only output a single voltage, based on the type of micro controller.

Let’s take a look at what happens here.  Let’s say that D10 has no output and D11 produces a duty cycle of 50%.  In this example, Q1 and Q3 would receive 50% power at the base (the horizontal line coming out of the transistor).  The percentage of power going to the base equates to the amount of power that passes from the collector to the emitter (top pin and bottom pin of the transistor, respectively).  If the battery in this example is a 12 volt battery and the base is getting a 50% duty cycle, roughly 6 volts passes through Q1, into the motor, and out through Q3, completing the circuit.  If the duty cycle of pin 11 goes up from 50% to 100%, Q1 and Q3 will pass all 12 volts through the motor, causing the motor to increase in speed.

Let’s say that pin 11 goes low (no output).  With both pin 10 and 11 low, all four transistors receive no power at the base, meaning that no power can pass from the collector to the emitter.   If no power passes this way, the motor does not get any power and it comes to a stop.  If pin 10 goes to 100% now, Q2 and Q4 receive power at the base, allowing electricity to pass through that line.  Power comes from the battery, through Q2, through the motor, through Q4, and back to the battery.  Since this circuit passes a voltage through the motor in a different direction, the motor spins a different way.

H bridge schematic

H bridge schematic

Advertisements