H Bridge PWM DC Motor Driver

20,526

43

20

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

    • Anything Goes Contest

      Anything Goes Contest

    20 Comments

    0
    reeseisboss
    reeseisboss

    3 days ago

    I've built this -- but I'm really confused on a few things -- I'm only getting 12.6V on the outputs for the motors(btw im using a 36VCC) -- and secondly one,a major flaw I've found is if the controller doesn't have a load -- there isn't a major bleed resistor for it, hence it will hold the charge for a really long time.

    0
    MihailO1
    MihailO1

    3 months ago

    Hello, can I have a reference for C6 and C7 capacitors? Thanks

    0
    sam_moshiri
    sam_moshiri

    Answer 8 months ago

    Hi Man,
    This board is a driver, to run your load, you need to connect a PWM generator to the board. the Level of the PWM signal should be 5V. You can generate such signal with a variety of methods and circuits. Probably in the future I will include a PWM generator also, however I was thinking it should be easy to just attach one. Because A driver is general, however if I include a PWM generator to this, the user is bounded to use just this generatyor, not his own

    0
    JuniorV44
    JuniorV44

    11 months ago

    I looked all over for a version of this build that's much smaller and lightweight that could manage a small(or pair of) 8mm or 10mm coreless brushed motors for a micro RC plane. I am far from a engineer and have limited knowledge as I'm learning as I experiment and enjoy making things happen with components that were mysterious to me only a couple years ago.. I did learn much by reading this instructable and appreciate the time you invested. Could you or maybe a knowledgeable reader help me scale this build down for what I'm trying to accomplish without the use of a microcontroller such a arudino? I'd prefer, if possible to not involve any code.

    Again, I'm interested in a motor driver such as the one in this instructable to control 1 or two 8mm brushed DC motors (pwm or via a single servo signal wire) using parts salvaged or capable of being purchased in small quantities.

    0
    sam_moshiri
    sam_moshiri

    Reply 9 months ago

    Hi, I just saw your comment right now, I don't receive any notification
    when people comment on the projects, however you can always comment on
    YouTube as well.

    Yes, that's possible why not. You can even generate PWM pulses using a 555 timer IC without any MCU or Arduino. This can be even designed more compact if the current consumption of your Motors are low

    1
    PilscoLa
    PilscoLa

    Question 11 months ago on Step 1

    Hi Hesam,
    My compliments for this great instructable - I'd like to build
    it myself! Would you have any idea of the maximum PWM frequency you can
    achieve with this setup? (Or rather: the smallest pulse that makes it through to the motor?)
    thanks you,
    Wilco

    0
    sam_moshiri
    sam_moshiri

    Answer 9 months ago

    Hi, I just saw your comment right now, I don't receive any notification when people comment on the projects, however you can always comment on YouTube as well.

    The only limitation factor might be the IR2104, so check the datasheet and its frequency. the PWM frequency of mine was a few KHz.

    1
    Quang2000
    Quang2000

    1 year 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 1 year ago

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

    1
    YvesDS
    YvesDS

    Question 1 year 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 1 year ago

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

    1
    RajkiranS
    RajkiranS

    1 year 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 1 year ago

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

    0
    RajkiranS
    RajkiranS

    1 year 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 1 year ago

    MOSFETs datasheet handles you the peak (short) current info

    0
    sam_moshiri
    sam_moshiri

    Reply 1 year ago

    How is the results?

    0
    arnold.velzel
    arnold.velzel

    Question 2 years ago on Step 6

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

    0
    sam_moshiri
    sam_moshiri

    Answer 2 years 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.