Super Driver From 1 to 200 Amperes for DC Motor

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects. New tutorials on Tuesdays and Fridays.

Today we’re discussing an H bridge with MOSFET. We use a lot to control motors (especially DC ones). And this occurs for a very simple reason: it allows you to reverse the polarity. Essentially, you make the motor turn right and left, which allows for great flexibility in the control of these motors. Personally, I've always wanted to use the IRF1404 transistor, which I consider to be a monster (reaching 200 amps). It is widely used in automotive sound power modules. So today, we’ll discuss how to control a DC motor, specifically those with two wires, a positive and a negative. And we’ll do this using ESP32 LoRa.

I’ll show a control and polarization circuit of an H bridge using MOSFETs and apply the H bridge on a load to verify its operation.

Step 1: Demonstration

Step 2: Resources Used

• One ESP WiFi LoRa 32

• Four IRF1404s

• Three BC337s

• One CD4011

• Resistors

• Two 1uF electrolytic capacitors

• Two 1N4148 diodes

• USB cable for ESP

• 12V source for the load used

• Charging (we use an electric glass motor)

• Protoboard

• Wires

Step 3: Bridge H

• The H bridge is a circuit that allows the direction of the current applied to a load to be reversed.

• It’s commonly used to control the direction of DC motors by reversing the direction of current flowing through their windings.

• Since motors tend to involve high current loads, the H bridge uses power switching devices (transistors, relays) to control the direction of flow.

Step 4: IRF1404

• MOSFETs use of power in load switching has advantages, mainly related to high switching speed, low shutdown interval, DRAIN proportional to gate voltage (GATE), and low resistance in the on mode (allowing high currents).

• The IRF1404 is a MOSFET built with HEXFET® technology from International Retifier.

• It has very low resistance during activation

- RDS (on) = 0.004 ohms.

• It can withstand a continuous current of 202A (respecting the maximum junction temperature), but it is limited to 75A for the TO-220 package.

• Maximum drain voltage - 40V source

• Voltage limits VGS from 2 to 4V.

Step 5: Scheme

• This is the scheme used in this example, and we can see 3 blocks: the voltage folder, the control logic, and the H bridge itself.

Step 6: Scheme – H Bridge

• The H bridge will have four IRF1404s arranged. This is so that the activation of a pair will allow current flow in one direction, and the activation of the opposite pair will reverse the direction.

• It must be activated at the same time by the DIR A and DIR B inputs, indicating the change of direction of the motor.

• Another important detail is that the activation voltage of the transistors must be greater than the Vgs (th).

• For Q9 and Q10, values greater than 4V should already be enough to start functioning. But for Q8 and Q11, the Vgs (th) should be those 4V more than the voltages at points A and B, respectively.

• As for conducting Q11, the voltage at B should ideally be the source voltage. We can imagine that V must be at least 16V.

• To maintain the assembly using a single power supply, we will refer to a voltage folder.

Step 7: Diagram - the Voltage Folder

• This is a circuit based on diodes and capacitors that are well-known in electronics.

• It functions primarily as an electron "pump,” pushing electrons through the capacitors to create a higher voltage due to the accumulation of charges.

• At first, a voltage doubler must deliver twice the input voltage at its output.

• In practice, due to voltage drops, the value obtained was approximately 21.5V. But it was enough for the MOSFETs.

• A 1kHz oscillator, from ESP (3V3) activates Q2, which becomes the oscillator source of the loop circuit.

• At each cycle, the accumulated loads in C3 are transferred and summed in C4.

Step 8: Scheme - Activation - Hardware

• A very important detail on any H bridge is that the pairs must be activated so that the current path is always by the load (in the case of our motor).

• If both pairs are activated at the same time, a short circuit between the positive source and the GND will be established, which may damage the H bridge and / or the power supply.

• To prevent this, activation logic must be implemented, either via software or via hardware.

• Here is a suggestion using NAND gates and the truth table.


Step 9: Scheme - Activation - Software

• Another way to avoid this is to control software activation.

• In the code example, we use this approach.


• The logic is reversed by the transistors. Activations are low.

Step 10: Source Code

Constants and variables

//PWM usado como oscilador do dobrador de tensão
const int freq = 10000; //Frequencia do PWM const int canal = 0; // canal do PWM const int resolucao = 12; // Resolução (4096 estados) const int ciclo = 2048; //ciclo de trabalho de 50% const int pin_osc = 21; //GPIO utilizada para o oscilador //Pinos de atuação na ponte const int pin_A = 16; // Direção A const int pin_B = 17; // Direção B const int intervalo = 2000; //Intervalo para mudança de estados // Variável usada para alternar a direção boolean dir = false;


void setup()
{ //seta a direção dos GPIO pinMode(pin_osc, OUTPUT); pinMode(pin_A, OUTPUT); pinMode(pin_B, OUTPUT); // Ajusta o PWM com as constantes ledcSetup(canal, freq, resolucao); ledcAttachPin(pin_osc, canal); ledcWrite(canal, ciclo); }


void loop()
{ dir = !dir; //inverte o valor da direção //Desliga a ponte //note que a lógica é invertida pelos transistores Q15 e Q16 digitalWrite(pin_A, HIGH); // desativa o par A digitalWrite(pin_B, HIGH); // desativa o par B delay(intervalo); //aguarda um intervalo digitalWrite(pin_A, dir); //ESTE é o pino que controla o DIR A digitalWrite(pin_B, !dir);// o DIR B sempre deve ser a NEGAÇÃO de DIR A delay(intervalo); //aguarda um intervalo }

Step 11: Files

Download the files:





    • Build a Tool Contest

      Build a Tool Contest
    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest
    • Remix Contest

      Remix Contest