Simple H-Bridge Motor Driver Circuit using MOSFET

Published  May 6, 2019   1
Simple H-Bridge Motor Driver Circuit using MOSFET

At the outset driving a motor might seems like an easy task – just hook the motor up to the appropriate voltage rail and it will start rotating. But this is not the perfect way to drive a motor especially when there are other components involved in the circuit. Here we will discuss one of the most commonly used and efficient way to drive DC motors - H-Bridge circuit.

 

Motor Driving

The most common type of motor you might come across in hobbyist circles for low power applications is the 3V DC motor shown below. This kind of motor is optimized for low voltage operation from two 1.5V cells.

 

Generic 3v DC Motor for H-Bridge Motor Driver Circuit

And running it is as simple as connecting it to two cells – the motor fires up instantly and runs as long as the batteries are connected. While this kind of setup is good for ‘static’ applications like a miniature windmill or fan, when it comes to a ‘dynamic’ application like robots, more precision is needed – in the form of variable speed and torque control.

It’s obvious that decreasing the voltage across the motor decreases the speed and a dead battery results in a slow motor but if the motor is powered from a rail common to more than one device, a proper driving circuit is needed.

This can even be in the form of a variable linear regulator like the LM317 – the voltage across the motor can be varied to increase or decrease speed. If more current is needed, this circuit can be built discreetly with a few bipolar transistors. The biggest drawback with this kind of setup is the efficiency – just like with any other load, the transistor dissipates all the unwanted power.

 

The solution to this problem is a method called PWM or pulse width modulation. Here, the motor is driven by a square wave with an adjustable duty cycle (the ratio of on time to the period of the signal). The total power delivered is proportional to the duty cycle. In other words, the motor is powered for a small fraction of the time period – so over time the average power to the motor is low. With a 0% duty cycle, the motor is off (no current flowing); with a duty cycle of 50% the motor runs at half power (half the current draw) and 100% represents full power at maximum current draw.

This is implemented by connecting the motor high side and driving it with an N-channel MOSFET, which is driven again by a PWM signal.

N-Channel PWM Motor Driver

 

This has some interesting implications – a 3V motor can be driven using a 12V supply using a low duty cycle since the motor sees only the average voltage. With careful design, this eliminates the need for a separate motor power supply.

What if we need to reverse the direction of the motor? This is usually done by switching the motor terminals, but this can be done electrically.

One option could be to use another FET and a negative supply to switch directions. This requires one terminal of the motor to be permanently grounded and the other connected to either the positive or negative supply. Here, the MOSFETs act like an SPDT switch.

However, a more elegant solution exists.

 

The H-Bridge Motor Driver Circuit

H-Bridge Motor Driver Circuit

 

This circuit is called H-bridge because the MOSFETs form the two vertical strokes and the motor forms the horizontal stroke of the alphabet ‘H’. It is the simple and elegant solution to all motor driving problems. The direction can be changed easily and the speed can be controlled.

In an H-bridge configuration, only the diagonally opposite pairs of MOSFETs are activated to control the direction, like shown in the below figure:

Forward and Backward with an H-Bridge

 

When activating one pair of (diagonally opposite) MOSFETs, the motor sees current flow in one direction and when the other pair is activated, the current through the motor reverses direction.

The MOSFETs can be left on for full power or PWM-ed for power regulation or turned off to let the motor stop. Activating both bottom and top MOSFETs (but never together) brakes the motor.

Another way to implement H-Bridge is using 555 timers, which we discussed in previous tutorial.

 

Components Required

For the H-Bridge
  • DC motor
  • 2x IRF3205 N-channel MOSFETs or equivalent
  • 2x IRF5210 P-channel MOSFETs or equivalent
  • 2x 10K resistors (pulldown)
  • 2x 100uF electrolytic capacitors (decoupling)
  • 2x 100nF ceramic capacitors (decoupling)

 

For the Control Circuit

  • 1x 555 timer (any variant, preferably CMOS)
  • 1x TC4427 or any appropriate gate driver
  • 2x 1N4148 or any other signal/ultrafast diode
  • 1x 10K potentiometer (timing)
  • 1x 1K resistor (timing)
  • 4.7nF capacitor (timing)
  • 4.7uF capacitor (decoupling)
  • 100nF ceramic capacitor (decoupling)
  • 10uF electrolytic capacitor (decoupling)
  • SPDT switch

 

Schematics for Simple H-Bridge Circuit

Now that we’ve got the theory out of the way, it’s time to get our hands dirty and build an H-bridge motor driver. This circuit has enough power to drive medium sized motors up to 20A and 40V with proper construction and heatsinking. Some features have been simplified, like the usage of a SPDT switch to control the direction.

Also, the high side MOSFETs are P-channel for simplicity. With the appropriate driving circuit (with bootstrapping), N-channel MOSFETs could also be used.

The complete circuit diagram for this H-Bridge using MOSFETs is given below:

Simple H-Bridge Motor Driver Circuit Diagram

 

Working Explanation

1. The 555 Timer

The timer is a simple 555 circuit that generates a duty cycle from around 10% to 90%. The frequency is set by R1, R2 and C2. High frequencies are preferred to reduce audible whining, but this also means that a more powerful gate driver is needed. The duty cycle is controlled by potentiometer R2. Learn more about using 555 timer in astable mode here.

This circuit can be replaced by any other PWM source like an Arduino.

 

2. Gate Driver

The gate driver is a standard two-channel TC4427, with 1.5A sink/source per channel. Here, both the channels have been paralleled for more driving current. Again, if the frequency is higher the gate driver needs to be more powerful.

The SPDT switch is used to select the leg of the H-bridge which controls the direction.

 

3. H-Bridge

This is the working part of the circuit that controls the motor. The MOSFET gates are normally pulled low by the pulldown resistor. This results in both the P- channel MOSFETs turning on, but this is not a problem since no current can flow. When the PWM signal is applied to the gates of one leg, the N and P-channel MOSFETs are turned on and off alternately, controlling the power.

Testing H-Bridge Motor Driver Circuit using MOSFETs

 

H-Bridge Circuit Construction Tips

The biggest advantage of this circuit is that it can be scaled to drive motors of all sizes, and not only motors – anything else that needs a bidirectional current signal, like sine wave inverters.

When using this circuit even at low powers, proper localized decoupling is a must unless you want your circuit to be glitchy.

Also, if constructing this circuit on a more permanent platform like a PCB, a large ground plane is recommended, keeping the low current parts away from the high current paths.

So this simple H-Bridge circuit is the solution for many motor driving problems like bidirectionally, power management and efficiency.

Video

Have any question realated to this Article?

Ask Our Community Members

Comments

Nice idea for learning H-bridge circuits, your logic is right on; some major things you may have missed.

Shoot thru  occurs when both the upper and lower MOSFETs turn on at the same time.  With your circuit as shown this will happen at the transition where one is turning on the is turning off.  Note: the higher the VCC the worse it will get, causing excess heating of the MOSFETs and eventually failure to occur.

Examine the Vgs of both upper and lower devices over the full gate voltage swing.  You will fine you have them both in the partially enhancement mode where both are trying to conduct.  The slower the rise and fall time of the gate the worse this will be.  This will create some huge current spikes.  

What is shown on the breadboard will work because of the limiting impedance of the interconnections. If this is built for say 20A 40V you will be blowing MOSFETs.  The primary failure will be either shoot through or VGS over voltage.

The Vgs of both devices is +- 20V which is way short of the max 40V suggested.  At approximately 3V Vgs both devices are turning on. There is also the Miller Capacitor effect which will also slow down the switching time however the TC4427 (4.5 - 18V) is a good choice to solve this problem.

Do continue with this, you have made a great start.

Gil