H Bridge PWM DC Motor Driver

9,383

31

12

Introduction: H Bridge PWM DC Motor Driver

By Hesam Moshiri, hesam.moshiri@gmail.com

An H-Bridge (Full-Bridge) driver is quite popular in driving loads such as brushed DC motors and it is widely used in robotics and industry. The main advantages of using an H-Bridge driver are: high efficiency, rotation direction change, and braking the motor. In this article/video, I have introduced a complete H-Bridge DC motor driver using four IR3205 power MOSFETs and two IR2104 MOSFET drivers. Theoretically, the above-mentioned MOSFET can handle currents up to 80A, however, in practice we can expect to get currents up to 40A if the MOSFET temp[erature is kept as low as possible, using a big heatsink or even a fan.

[A] Circuit Analysis

Figure 1 shows the schematic diagram of the H-Bridge DC motor driver. As it is clear, the heart of the circuit is two IR2104 MOSFET driver chips.

Supplies

Step 1: Figure 1 Schematic Diagram of the H-Bridge DC Motor Driver

I’ve selected 4 IR3205 [1] to do the switching. This MOSFET offers nice characteristics that are essential for this application, very low RDSon resistance, and high current handling capability. According to the IRF3205 datasheet: ”Advanced HEXFET? Power MOSFETs from International Rectifier utilize advanced processing techniques to achieve extremely low on-resistance per silicon area. This benefit, combined with the fast switching speed and ruggedized device design that HEXFET power MOSFETs are well known for, provides the designer with an extremely efficient and reliable device for use in a wide variety of applications. The TO-220 package is universally preferred for all commercial-industrial applications at power dissipation levels to approximately 50 watts. The low thermal resistance and low package cost of the TO-220 contribute to its wide acceptance throughout the industry.”


I’ve selected two IR2104 [2] to drive the MOSFETs. According to the IR2104 datasheet: “The IR2104(S) are high voltage, high-speed power MOSFET and IGBT drivers with dependent high and low side referenced output channels. Proprietary HVIC and latch immune CMOS technologies enable ruggedized monolithic construction. The logic input is compatible with standard CMOS or LSTTL output, down to 3.3V logic. The output drivers feature a high pulse current buffer stage designed for minimum driver cross-conduction. The floating channel can be used to drive an N-channel power MOSFET or IGBT in the high side configuration which operates from 10 to 600 volts.”.

The good news about the IR2104 is that this chip is compatible with both 3.3V and 5V logic levels. Figure 2 shows the basic wiring diagram of the chip. As it is clear, the supply of the chip and load (motor) does not need to be identical, however, both supplies share a common ground.

Step 2: Figure 2 Wiring Diagram of the IR2104 MOSFET Driver Chip

C1, C3, C4, C5, C6, C7, and C9 have been used to reduce the noise. R1 and D2, R2 and D3, R3 and D8, R4 and D9 have been used to damp down the ringing and parasitics that might be introduced by the inductors and capacitors at the ON/OFF times of the MOSFETs. Don’t forget that a MOSFET introduces a capacitance on their gate pin. The 1N4148 diode discharges the gate’s capacitor.


D4, D5, D6, and D7 [3] are used to suppress the DC motor’s reverse current spikes. Internal reverse Shotkey diodes have been embedded in the MOSFETs, however, using these external Shotkey diodes reduce the stress on the internal diodes as well. C2, C8, D1, and D10 are selected according to the datasheet and the application requirements.

P1 is a 5 pins XH connector that is used to apply the chips’ supply and control signals to the board. K1 is a KF45 power connector that is used to connect the motor and motor’s supply wires to the board.

[B] PCB Layout
Figure 3 shows the PCB layout of the H-Bridge DC motor driver. It is a 2 layers PCB board and all component packages are through-hole.

Step 3: Figure 3 PCB Layout of the H-Bridge DC Motor Driver

Figure 4 shows the 3D views of the PCB board from the top and bottom.

Step 4: Figure 4 3D Views From the Top and Bottom of the Board

I did not have the schematic symbols and PCB footprints of the IR2104 [4] and IRF3205 [5] (component libraries). So I used the SamacSys component libraries and installed the missing libraries using the SamacSys Altium Designer plugin (Figure 5). SamacSys has provided plugins for almost all famous electronic designing software (Figure 6). Interestingly all services are free and libraries do-follow IPC standards. Just you need to download and use your favorite CAD plugin [6]. Another option is to download the libraries from the componentsearchengine.com and import them.

Step 5: Figure 5 Selected Components in the SamacSys Altium Plugin

Step 6: Figure 6 Supported Electronic Designing CAD Software by the SamacSys Plugins

High current carrying tracks are not completely covered by the solder mask. This allows you to strengthen the tracks by soldering or using some thick copper wires. Figure 7 shows these partially exposed tracks.

Step 7: Figure 7 Partially Exposed High Current Carrying PCB Tracks

C] Assembly and Test

Figure 8 shows the assembled unit and figure 9 shows the testing environment. I have programmed the Arduino Uno to control the motor driver board. Also, I have built a simple keypad on a prototyping board to be able to change the speed (using PWM) and rotation direction of the motor.

Step 8: Figure 8 the Assembled H-Bridge DC Motor Driver

All push-buttons are active-low and use internal pull-up resistors of the Arduino. You can consider the Arduino code below:

Step 9: Figure 9 the DC Motor Driver Board, Arduino Uno, and the Test Bench!

#include <JC_Button.h>

int PWM_Value;
byte Enable_Pin = 13;
byte PWM1_Pin = 11;
byte PWM2_Pin = 10;
byte PWM_Pin = 11;
Button UP(9, 25, true, true);
Button Down(8, 25, true, true);
Button Left(7, 25, true, true);
Button Right(6, 25, true, true);
void setup() {
pinMode(Enable_Pin, OUTPUT);
pinMode(PWM1_Pin, OUTPUT);
pinMode(PWM2_Pin, OUTPUT);
UP.begin();
Down.begin();
Left.begin();
Right.begin();
digitalWrite(Enable_Pin, LOW);
PWM_Value = 0;
analogWrite(PWM1_Pin, PWM_Value);
analogWrite(PWM2_Pin, PWM_Value);
}
void loop() 
{
digitalWrite(Enable_Pin, HIGH);
UP.read();
Down.read();
Left.read();
Right.read();
if (UP.wasReleased() && PWM_Value < 250)
{
 PWM_Value +=5;
}
if (Down.wasReleased() && PWM_Value > 5)
{
 PWM_Value -=5;  
}
if (Left.wasReleased())
{
 PWM_Pin = PWM1_Pin;
 analogWrite(PWM2_Pin, 0);
}
if (Right.wasReleased())
{
 PWM_Pin = PWM2_Pin;
 analogWrite(PWM1_Pin, 0);
}
analogWrite(PWM_Pin, PWM_Value);
}

Step 10: Bill of Materials

Be the First to Share

    Recommendations

    • Arduino Contest

      Arduino Contest
    • Make it Real Student Design Challenge #3

      Make it Real Student Design Challenge #3
    • Barbecue Speed Challenge

      Barbecue Speed Challenge

    12 Comments

    0
    Quang2000
    Quang2000

    15 days ago

    Hi...that's great instruction article... Thank you very much...Can you tell how to calculate C5,C6,C7...

    0
    sam_moshiri
    sam_moshiri

    Reply 7 days ago

    Thanks. Nothing special, that's typical rule of thumb capacitor values.

    0
    YvesDS
    YvesDS

    Question 2 months ago

    Hi, great instruction article,

    Can i operate a 180VDC / 7.5Amp treadmill motor (max. 4000rpm) with it, or do i have to make some adjustments to it for that?
    I would like to controll it all by a Teensy 4.1 (3.3V GPIO's)

    Thanks in Advance !

    0
    sam_moshiri
    sam_moshiri

    Reply 7 weeks ago

    Yes, you can. You need to change some component values. such as capacitors voltage rating (motor side capacitors)

    0
    RajkiranS
    RajkiranS

    2 months ago

    Which is the better idea to go with, for dc geared brushed motor. Is it better to use both N type MOSFET or both P type MOSFET or Combination of Both N type and P type.
    Kindly share the circuit diagram for H Bridge (Bidirection speed control,PWM)

    0
    sam_moshiri
    sam_moshiri

    Reply 7 weeks ago

    is it any problem with this design? it is an H bridge circuit

    0
    RajkiranS
    RajkiranS

    2 months ago

    What is the maximum continuous DC current it can handle and What is Maximum peak / surge current it can handle.

    0
    sam_moshiri
    sam_moshiri

    Reply 7 weeks ago

    MOSFETs datasheet handles you the peak (short) current info

    0
    sam_moshiri
    sam_moshiri

    Reply 5 months ago

    How is the results?

    0
    arnold.velzel
    arnold.velzel

    Question 8 months ago on Step 6

    Just out of curiosity, how much amps can this circuit handle?

    0
    sam_moshiri
    sam_moshiri

    Answer 8 months ago

    As you see some track are not completely covered by solder mask. They are high current carring tracks. if you strengthen those tracks by solder and copper wire, also if you use a big heatsink (or even a fan) for mosfets (Mosfet bodies must not shorted to the heat sink), then you can excpet up to 40A. because theoretically the used mosfets can handle up to 80A, let's assume half of this to be operational in a real use case.