Go Down

Topic: MOSFET H-Bridge (Read 7419 times) previous topic - next topic

en28

Nov 20, 2014, 12:16 am Last Edit: Nov 23, 2014, 01:48 am by en28
Hello all,

I need a little bit of help designing an H-Bridge Circuit for a 4-6V motor that draws max 140 +/- 50 mA at 6 VDC when operating in no load conditions. I want to maximize power to the motor. The Arduino will be powering a lot of other things so instead of using the Arduino to directly power the motor, I was planning on using the Arduino to provide power to the MOSFET gates, and power the H-Bridge with a 6V battery.

I've found a couple of starting circuit designs that I want to start with, and make modifications to them as needed. One that I really like is from here, and here's another that I think is fairly simple. I'm leaning towards the first, though I'm not sure what the purpose of the two outside MOSFETs is.

I'm not planning on using a MOSFET driver, so I was thinking of replacing standard MOSFETs with logic-level FETs. However, I'm not sure how well this would work and am afraid of switching too quickly. Does anybody have any suggestions or warnings?

Here are some MOSFETs that I was thinking of using:

IRLZ24
IRF9510

Edit: I just saw another H-Bridge post and I think we may be from the same school

rmetzner49

#1
Nov 20, 2014, 12:40 am Last Edit: Nov 20, 2014, 12:47 am by rmetzner49
So this is a school assignment?  Otherwise you are far better to just go buy one.  A 6V bridge isn't all that complicated, so you'll be OK.  The two "outside" MOSFETs are level shifters since if you reason through how you would turn on the "top" pair of FETs, it can't be done without them.  The Arduino cannot source but 40mA max, so you *do* need drivers.

MarkT

Yes the 6V supply is an issue - you need to bring the gate of the p-channel MOSFETs to the
rail to turn them fully off.

Usually an NPN is used as a level shifter, but actually for just a volt or so a red or IR LED can
be used to drop this voltage.  Have say 2k2 gate-source resistor on p-channel FET, and
LED anode to the gate, LED cathode to Arduino pin (add perhaps a 150 ohm current
limiting resistor too).  Alternatively 2 ordinary diodes in series will drop 1.2V or so.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

en28

#3
Nov 20, 2014, 01:01 am Last Edit: Nov 23, 2014, 02:09 am by en28
rmetzner49:
Yep, school assignment, so some type of H-Bridge is required.

From what I've learned in this class, MOSFET gate current is assumed to be 0. What do you mean when you say that I do need drivers? The Arduino is only going to gates.

MarkT:
I haven't heard the term "to the rail" before, can you explain?
Edit: Some quick Googling - in order to completely turn off a high-side P-FET we'll have to drive it's gate as high as it's source. Thanks, Mark! Some more questions:

If the P-channel FETs were also logic-level, would I still need level shifters?

And is there any danger to switching the motor in the opposite direction?

Thanks for the quick replies, guys.

rmetzner49

#4
Nov 20, 2014, 01:42 am Last Edit: Nov 20, 2014, 01:45 am by rmetzner49
As Mark said:  Let's say you have your supply voltage at 6V, you generally have a pullup from the gate to 6V that holds the P-FET off.  Now your gate is at 6V which the Arduino won't tolerate since it' can't get past the 5V supply.  You need to "level shift" the Arduino's output to 6V.

Mark suggested just two diodes in series between the Arduino and the gate. That will work, but I prefer a good old 2N2222's collector tied to the gate which he also suggested, since it also does the necessary inversion for you.  It also makes it more stable since if someone decided to give you 8V instead of 6V, you'll be in trouble with the diodes.

Without the 2N2222 when your Arduino powers up, it's outputs default to GND which will turn the P-Channel FET on nicely.  In my opinion it's poor design practice to have a device that defaults to the "on" state.  Even if you are watching every penny, that 2N2222 isn't much more expensive than two diodes.  It makes all your logic "high true" then which is cleaner.

One other thing, I think the N-Channel you picked will work just fine.  The P-Channel if you look at the curves doesn't come ON very well with only 6V  VGS.

en28

rmetzner49:

Thank you for all your help! I think that answers all my questions and covers all my concerns. We're making robots for a competition so hopefully this will give us the upper hand. Thanks again

zoomkat

The below is a DIY h-bridge project. Might be worth a read.

http://forum.arduino.cc/index.php?topic=53425.0
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

raschemmel

Quote
Driving signals : Dead-gap

When driving the H-bridge it is important to note that because PMOS and NMOS transistors turn on and off at different speeds, it is possible to create transient short-circuits along the two vertical paths of the H-bridge which can destroy the transistors.

The solution to this, is to have a dead-gap - I.e. a period where there are no drive signals when transitioning between forward drive and reverse drive. This will ensure that all the transistors in the bridge are in an off-state before turning the next pair of transistors on.

Many MCU's (e.g. Atmel) have dead-gap circuits as part of their PWM signal generator hardware.
Although the term is not mentioned in the above quote, it is addressing the subject of "SHOOT-THROUGH
PREVENTION
". "SHOOT-THROUGH" is the term used to describe "transient short-circuits along the two vertical paths of the H-bridge which can destroy transistors.."
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

en28

#8
Nov 21, 2014, 06:18 am Last Edit: Nov 21, 2014, 06:19 am by en28
zoomkat:

It was. At least with regard to the choice of MOSFET, I've tried to choose those without too much resistance that will maximize power based on the motor's current.

raschemmel:

One of my main concerns is that I will be switching too fast for the FETs to fully discharge. Do you think leaving a delay before switching is a good solution to the problem? If so, how would I calculate the delay needed? I would think finding the time constant of the FETs would be sufficient (that was my plan, at least)

raschemmel

First consider the definition of "shoot through". For the sake of simplicity let's designate the mosfet in the
upper left of the schematic as "10:00", the one in the upper right as "2:00", the one in the lower left as
8:00 and the one in the lower right as 4:00. So for the motor to go one direction , 10 & 4 must be ON,
while 8 & 2 are OFF. To reverse direction , 8 & 2 are ON and 10 & 4 are OFF. Now consider that the ONLY
things BETWEEN the POSITIVE rail and the NEGATIVE rail are those four mosfets. If they turn as I just
described , everything's fine because there is a load (the motor) in between the two rails. BUT, WHAT IF,
10 & 8 were to turn ON , OR 2 & 4 ? That's right, DIRECT SHORT ACROSS THE PS RAILS. So what kind of
delay do you need between the two combinations described above ? I would say "turn on time + 30% " ,
so the delay is 1.3 x tturn-on. and then wouldn't you need to consider TURN OFF time ?
Should the delay be equal to (TURN ON TIME + TURN OFF TIME) ?
To be honest, I don't know. I have a feeling mestzner49 does though...
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Paul__B

#10
Nov 22, 2014, 11:55 am Last Edit: Nov 22, 2014, 11:59 am by Paul__B
Well now, the IRLZ24 N-channel logic FET sounds an excellent choice for the task, while the IRF9510 P-channel would be quite useless (isn't a "logic" FET).

And the "another" link in your original post isn't quite a proper H-bridge circuit, just a diagram of some FETs, while your "here" isn't a link at all, so we cannot tell anything from that.

If you found a logic level P-channel FET to match, you could drive the H-bridge skeleton from four Arduino pins, given that the 10k pull-up and pull-down resistors are in the wrong place; they should be connected to the input side of the 330 ohm gate resistors, not the gate side.  You would have to be very careful in your code not to enable both high- and low-side drivers simultaneously.  If you use separate instructions in the correct sequence, the discharge times with 330 ohm resistors will not be a problem.  On consideration, if you can devote four Arduino pins per motor and do your testing with a 12V 10W automotive or Halogen globe in series with the power in case of "accidents", this may be the most practical way.

It would probably be just as well to use "plain" PNP transistors for the high-side if you cannot readily get proper FETs.  They would need only a 330 ohm base resistor - no "pull-ups" as they are not high-impedance devices.  What you do not want to use in a H-bridge, are Darlington transistors.

Oh, and there is no reason to need Schottkys - ordinary power diodes are just fine.

en28

#11
Nov 23, 2014, 01:57 am Last Edit: Nov 23, 2014, 02:28 am by en28
raschemmel:

Just to be safe, the delay should probably be 2 or 3x that, but if the solution to the problem is as easy as adding a delay to the code then it should be fine! I was worried it'd be more complicated than that.

Paul__B:

Sorry, the correct links should be up now. I just tested the circuit today, in fact, and it didn't run as smoothly as I thought it would. The motor ran, but more slowly than I expected, and my best bet is it's related to the IRF9510 and it's 1.2ohm Rds(on), not to mention the fact that the 5V from the Arduino isn't turning it on fully. I do want to stick to MOSFETs for max power across the motor, though. I had PN2222As on hand today and I tried to use those for the outside level-shifters, but what ended up happening was the transistors got really hot and I don't think I want to do that again. I tested it with a 5VDC at 1A going into the H-bridge and 5VDC 1A into one level shifter. The other level shifter was at 0V. Does anybody have any insights on why that might happen?

This is what I tried today:

with bad results. The resistor and inductor in the middle is just a representation of the motor (I don't actually know the motor resistance or inductance). The 5V and 0V DC on the side represent pins from the Arduino, and I tested it with a Vcc of 5V @ 1A.

When I replaced the transistors with IRLZ24s, the circuit worked, albeit not as well as I'd hoped.

Paul__B

I just tested the circuit today, in fact, and it didn't run as smoothly as I thought it would. The motor ran, but more slowly than I expected, and my best bet is it's related to the IRF9510 and it's 1.2ohm Rds(on), not to mention the fact that the 5V from the Arduino isn't turning it on fully.
OK, I did explain, did I not, the IRF9510 P-channel in fact quite useless in this application?

I do want to stick to MOSFETs for max power across the motor, though.
However, I pointed out that "It would probably be just as well to use "plain" PNP transistors for the high-side if you cannot readily get proper FETs".

I had PN2222As on hand today and I tried to use those for the outside level-shifters, but what ended up happening was the transistors got really hot and I don't think I want to do that again. ... Does anybody have any insights on why that might happen?
Yes, they are bipolar transistors, not FETs.

It would be easy to say that it is because you have not provided bias resistors in series with the bases, but other people have been trying (perhaps confusingly) to explain that you need to be much more careful than that.  Which is why I suggested certain particular things.  I see no errors in what I wrote, so I have no reason to repeat it.
[/quote]

The resistor and inductor in the middle is just a representation of the motor (I don't actually know the motor resistance or inductance).
Irrelevant, really.

When I replaced the transistors with IRLZ24s, the circuit worked, albeit not as well as I'd hoped.
Using useless P-channel FETs would explain that.  Mind you, because they are in fact, useless, at least you could do little damage.   :smiley-grin:

raschemmel

@en28,
Yes, more or less correct , but please confirm you know where to put the delay.

P-CHANNEL
You might consider using these:
https://www.sparkfun.com/products/10349

N-CHANNEL
https://www.sparkfun.com/products/10213
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

en28

#14
Nov 23, 2014, 09:04 pm Last Edit: Nov 23, 2014, 09:05 pm by en28
Paul__B

I will try what you suggested.

raschemmel:

In the code? Correct me if I'm wrong, but it should be before any high/low pin changes going into the FET gates. Also, thanks for the suggestions! These are actually within the right price range.

Go Up