I need your help with an H-bridge

Hello everyone,

I would like to ask for your help with an H-bridge that I am developing for one of my projects. The purpose of this H-bridge is very simple: to ensure that the motor connected to it makes a precise number of rotations.

Unfortunately, I am encountering a problem. When I power my H-bridge for the first time, the motor runs below the desired number of rotations (92% of its target). If I reactivate it immediately after, the number of rotations is correct, but the longer I wait before reactivating it, the more the target rotations decrease until they fall back to 92% of the initial target.

To give you more technical details:

  • The H-bridge is connected to an Arduino Nano ESP32 (pin at 3.3V).
  • The H-bridge is powered at 24V and the motor is designed for a voltage of 24V.
  • The chosen transistors have a low internal resistance value to avoid impacting the voltage between the power supply and the motor.

The code to operate the H-bridge is as follows:

cpp

Copier le code

for (int i = 0; i < 10; i++) {  // Motor forward start
    delay(15); 
    digitalWrite(3, HIGH); 
    delay(15); 
    digitalWrite(3, LOW); 
}

digitalWrite(3, HIGH);  // Desired motor activation time
delay(motor_time); 
digitalWrite(3, LOW);

delay(250); // Delay to avoid short-circuiting the H-bridge
digitalWrite(2, HIGH); // Motor reverse
delay(100);
digitalWrite(2, LOW);

for (int i = 0; i < 10; i++) {  // Motor reverse slow braking
    delay(15); 
    digitalWrite(2, HIGH); 
    delay(15); 
    digitalWrite(2, LOW); 
}

I would appreciate your help to increase the precision of this system.

Thank you for your valuable help.

Motor speed depends on many factors. For precise control you need rotational feedback and a regulator (PID...).

Thank you for this response, Dr. Diettrich, but it does not come from the motor. This one is truly qualitative, and I manage to get the correct number of turns each time without the H-bridge, so the problem indeed comes from the H-bridge

I surprised that the MOSFETs have not burned out yet.
The Vgs for the IRF4905 is only 20V and you have 24V on it.
Neither MOSFET will work well if at all with a 3.3V gate signal.

Regardless; if the load on the motor changes, as the motor ages and as power supply voltages fluctuate, you'll see that the number of rotations will change. So even if you engineer this H-bridge so it works 'correctly', you'll still have to work out something so that you accurately control the rotations. A DC motor is not a servo!

Hello Jim-p, and thank you for your message. No, there is no overheating problem; I placed a 10k resistor between the power supply and the gate of the IRF4905 to protect it.
Doesn't that seem sufficient to you?

No, you will still have 24V between the gate and source. One of these days it will fail.
How much current does the motor use

Hello rsmls, and thank you for your message. I understand that my motor is not a servo, and I'm not asking it to be precise to the degree. I am aware of that. I'm asking for over 700ms to rotate within +/- 2% of the number of turns I want. it works perfectly without h bridge. The only issue is that the H-bridge doesn't deliver the correct amount of current on the first action, but it does on the second and so forth and Ido have my +/- 2% error.

Thank you for your message, Jim-p. Do you know a transistor that could meet my needs?

Is there any reason why you don't want to use a premade board like this?

Thanks for the documentation jim-p. The issue is that I'll be limited in the number of pins allocated to this module; I can only use 2, and they need to be integrated into my circuit board. An idea came to mind to relieve the gate pin of the IRF4905: I have a secondary power supply at 12V; I could change the 24V to 12V. However, this won't solve my H-bridge startup problem. Could it be that the resistor value is too low or high? Is there a need to add capacitors to the motor pin for a more consistent startup? Do you see any problem that I might have missed?

OK, well, if you feel that will be achievable under your operating conditions, feel free to go ahead and try. I predict you'll run into trouble with this sooner or later, but OK.

Out of curiosity - why are you building a H-bridge from the ground up instead of using a ready-to-go product? There are many solutions available that do the same as what you're designing presently.

I won't recommend using that circuit without extensive redesign.
In theory that type of H-bridge circuit will work, in practice you will probably have problems with shoot-through. Shoot-through occurs when both MOSFETs on the same side are on at the same time. There is nothing in your design that guarantees that one MOSFET will turn off before another turns on.

The 8876 only need two

To answer your question, I prefer to use and build my own modules. It helps me understand what I'm using and help me to add more knowledge. Regarding the 8876, I'll take the time to read the datasheet more thoroughly, but I think I might be limited in terms of amperage because my motor runs at 3.5A. Anyway, thank you for your help and remarks. If anyone else looks at this exchange and understands where I might have made a mistake, I'm open to comments, thank

OK, I sort of understand this, although the problem with reinventing the wheel is always that other people have made very well-functioning wheels, while if you try to DIY one, you end up with one that's crooked, offers a bumpy ride and tends to break easily.

Consider that commercial motor driver modules also generally use motor driver IC's that come with shoot-through prevention, thermal protection etc. There are preciously few H-bridge drivers out there for your kind of application that use discrete semiconductors, because it's a roundabout, labor-intensive (thus costly) way that results in an unnecessarily big module.

Given your aim to understand these things, consider the following:

  • Study H-bridges at a theoretical level, using e.g. Spice simulation to understand problems like shoot-through and how to deal with them.
  • For a practical application, use a ready-made IC that offers all the convenience and efficiency of a professional solution. In implementing it, you'll benefit greatly from the theoretical exercise.

This way you could have your cake and eat it: you'll learn, and your motor driver will actually work.

You can then spend the time you saved on figuring out a way to control the actual rotations of your motor using e.g. an encoder. You know, just in case the real world doesn't like to conform to your early experiments to the extent you currently hope.

Then forget the 8876 board.
You might want to study up on how to control a motor using an H-bridge and how MOSFETs work.
You should eventually realize that your simple circuit has many problems.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.