Hi,
So, I’m trying to implement a simple H-Bridge to control a DC motor. I’m using 4 MOSFET’s, 2 NMOS and 2 PMOS. The bridge is controlled by two PWM signal. One signal for a pair of a NMOS and a PMOS. The two PWM signals should be in antiphase(not sure if this is the right word). I managed to get the signals to make the motor run in one direction. However, I can’t find a way to reverse the signals so that the motor would run in the opposite direction. My question is what would be the best way to generate two PWM signals in antiphase, and how could I make change which signal is the one inverted?
We need to see a schematic of your H-Bridge and how it is connected to your controller.
What model Arduino are you using?
Can you please post a copy of your circuit a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
The H-Bridge is part of a larger project, this being just a small part I had to include. Right now for testing just the H-Bridge I'm using an Arduino Uno, but eventually for the whole project I'm going to use an Arduino Mega. I attached a schematic for the H-Bridge, but it's not a very good one .
Can this work?
imagine you have control 0 and 1 at low level. U6 and U8 would be conducting current in both directions, considering their flyback diode. If your motor is spinning then U6 and U8 would act as a brake.
This circuit may be fine for turning the motor on and of now and then, but for speed control with PWM, I assume you need to drive the 4 mosfets individually.
Try Altering the connection (if you can) to make the bottom left and top right mosfets coupled, and bottom right and top left coupled. that way you can only send pwm to one of the pins and make it work (direction dependin on which pin is active)
but if its not possible try this:
control 0 -> direction control
control 1 -> speed control
so: pin0 high or low means cw or ccw
pin 1 pwm signal controls speed of the motor.
your connection isn't ideal as to whenever you're turning the pwm off you're essentially applying coil breaking to your motor using the eddy currents. This will result in heat and a non-linear response curve (assuming your motor is ideal and has a linear curve at the start) so first method is advised
Doesn't seem like he's using a high voltage or much current (5vdc on the sch.) and he asked for a simple solution. if he gives the proper off timing and uses a FULL BRIDGE RECTIFIER (ElectroBOOM Sytle) on the motor to control back emf. It shouldn't be a big problem on the mosfets.
Ok, this H-Bridge is just a small part of a larger project. It's meant to control a small DC motor, 5V and the current is less than an amp. The schematic is more of a concept idea, the MOSFET's I actually use are IRFZ44N for NMOS, and SQP100P06 for PMOS. I understand the concept of using 4 signals/pins to control the motor, however after talking with certain people I was led to understand that it is possible to control the H-Bridge with just two PWM signals, for both speed and direction. I tested this circuit on a breadboard and the motor does run without large problems, even for a longer period. Also when testing the motor the two signals are opposite, when one is HIGH the other is LOW. What I really want is to know if this approach with two PWM signals is possible and how exactly should I generate these two signals.
If the 2 signals are opposite, that you offer to control0 and control1, what you are doing is running the motor in opposite directions at every PWM cycle.
If your PWM dutycycle is less than 50% one turningdirection will win the armwrestling contest and if it is over 50% the other direction will win.
The further away from the 50% duty cycle the faster it will spin.
Not sure if that is what those "certain people" had in mind, but ignoring the disadvantages of running and braking a motor at the (almost) same time and the shoot-through issue (when both fets are partly on, giving some short circuit during switchover), I would say it is possible.
Well, commonly used motor driver ic's like LM298D uses 2 pin interfaces and work just fine with simple motor control. Limited gpio usage is mostly a positive thing.
Futhermore, I think there has been a misunderstanding on how the circuit will function. Instead of the "more powerful wins" sceneraio, my design incorporates cw and ccw drive pins and whichever gets power, in the condition that other doesn't get any, the mosfets at top right and bottom left will enable, either by pwm or full power, making the motor have a current flowig from right to left, and the opposite for the other control wire. this will make all the mosfets same channel type make it easier to understand (arguably) along with saving 2 pins to be used at a later stage of the circuitry