Pages: [1] 2   Go Down
Author Topic: H-Bridge mosfets keep exploding  (Read 1977 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

I am using one of the schematics from the book arduino robotics (schematic below). I have assembled the circuit on a breadboard and while testing I was using a 12 volt 1 amp wall wart for the power supply. using a parallax joystick for motor speed and direction control everything worked good for the first few minutes but then the motor would slow to a stop even with the joystick pushed all the way forward. After testing the mosfets I found the P-Channel in position Q1 to be burned out. I replaced the mosfet (thinking it may have been bad from the start) and got the same result. I looked over the circuit and my sketch for a couple of days then I sent pictures (also below) and my sketch to JD that wrote arduino robotics. He said the circuit looked good and he went over my code and fixed some things that could have caused potential issues. He also told me not to use a battery instead of a wall wart and to make sure to test ALL mosfets. So after testing all mosfets, uploading the new code and using a deep cycle battery from my boat for power supply, I pushed the joystick forward and got a little smoke at full power. Then instead of being smart and stopping I went ahead and pulled it into reverse which caused the Q2 position P channel mosfet to explode. I tried again with the same result( partly because it was cool) and another mosfet bit the dust. Now I did try putting a rectifier diode between the drain pin of both P-channel mosfets and the motor terminal in place of the wires and the H-bridge worked perfectly up until I drew over the 1amp that the diode was rated for and it popped but I expected this. Also if I disconnect from the bread board Q1 and Q4 forward will work and unplugging the opposite lets reverse or vice versa work perfectly. I am tempted to just put higher current rated diodes in place and just continue with my project but I do not want to apply the "duct tape" repair to this. I am new to arduino and I am learning as I go but I want to learn the correct way to do things and I also want to learn the "why" behind what I am doing. If I just skip over this problem with a quick fix whatever I am doing wrong weather it is my fundamentals or my execution will continue to come back and cause problems in future projects until I figure out what I am doing wrong. Any help would be greatly appreciated. Oh by the way the motor being controlled is a small gear motor out of a kids power wheels and I am pretty sure it is not drawing anywhere near the 27amp  current limit of these mosfets. The p and n channel mosfets are from sparkfun  http://www.sparkfun.com/products/10213 and  http://www.sparkfun.com/products/10213 

Here is the sketch


int potpin = 0;         // joystick
int gearspeed = 0;
int rvgearlight = 12;    // led reverse gear indicator
int fwgearlight = 11;    // led forward gear indicator
int neutrallight = 13;   // led neutral indicator

int deadband = 25;

int AHI = 2; // these names are more descriptive - A side High input (AHI) - you can open one switch on the A side and one on the B side at a time with no problems.
int BHI = 3; // B side High input
int ALI = 5; // A side Low input
int BLI = 6; // B side Low input

void setup()
{
  Serial. begin(9600);
  pinMode(potpin, INPUT);
  pinMode(fwgearlight, OUTPUT);
  pinMode(rvgearlight, OUTPUT);
  pinMode(neutrallight, OUTPUT);
  pinMode(AHI, OUTPUT);
  pinMode(ALI, OUTPUT);
  pinMode(BHI, OUTPUT);
  pinMode(BLI, OUTPUT);
  neutral();
}

void loop(){
  read_signal();  // read the potentiometer, adjust the value to a fwd/rev, then make sure it doesn't go over the
  Serial.println(potpin);
  if (gearspeed > deadband){        //joystick pushed forward
    forward();
  }
  else if (gearspeed < -deadband){  //joystick pulled back
    reverse();
  }
  else {                            //joystick sitting in center 
    neutral();
  }
}

void read_signal(){
  potpin = analogRead(0);
  gearspeed = map(potpin, 0, 1023, -255, 255);

  if (gearspeed > 255){
    gearspeed = 255;
  }
  else if (gearspeed < -255){
    gearspeed = -255;
  }
}

void forward(){
  digitalWrite(neutrallight, LOW);
  digitalWrite(rvgearlight, LOW);
  digitalWrite(fwgearlight, HIGH);
  // write motor values
  digitalWrite(AHI, LOW);
  digitalWrite(BLI, LOW);
 
  digitalWrite(BHI, HIGH);
  analogWrite(ALI, gearspeed);
}

void reverse(){
  digitalWrite(neutrallight, LOW);
  digitalWrite(fwgearlight, LOW);
  digitalWrite(rvgearlight, HIGH);
  // write motor values
  digitalWrite(BHI, LOW);
  digitalWrite(ALI, LOW);
 
  digitalWrite(AHI, HIGH);
  analogWrite(BLI, -gearspeed); // since the gearspeed value is negative, we want to make it positive but use the same speed value.
}

void neutral(){
  // everything is turned off except the neutral indicator light
  digitalWrite(neutrallight, HIGH);
  digitalWrite(fwgearlight, LOW);
  digitalWrite(rvgearlight, LOW);                     // turns off forward and reverse indicator leds
  digitalWrite(BHI, LOW);
  digitalWrite(AHI, LOW);
  digitalWrite(ALI, LOW);
  digitalWrite(BLI, LOW);
}


* Schematic.jpg (89.61 KB, 1434x711 - viewed 52 times.)

* Top view.JPG (1487.97 KB, 1936x2592 - viewed 20 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here are two more pics of the breadboard I forgot to attach.


* Right side view.JPG (1423.55 KB, 2592x1936 - viewed 19 times.)

* Left side view.JPG (1450.31 KB, 2592x1936 - viewed 21 times.)
Logged

Canada
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Sometimes teaching, always learning,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wonder if the lack of flyback diodes is causing you grief. I know they are "built in" in a mosfet, but depending on your motor, the EMF may be exceeding the mosfet's rating.
Also, I see no decoupling capacitors.
I don't see in your code where it might energize both As or Bs at the same time, so I don't think that's a problem. 
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought back EMF was just a problem when the electro-magnetic field collapses in other words when the motor is turned off. The mosfets seem to explode as the motor speed is going up. I may be wrong, I guess that was more of a question.  Also do I still need decoupling capacitors powering the motor from a battery and powering the arduino from a pc (both grounded together) there is no voltage regulator in place so I didn't think I needed them.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8907
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd guess that 8 out of 10 DIY h-bridges probably smoke (at least the simple ones). Probably one set of MOSFETs are not getting either fully turned on causing them to overheat, or not getting fully turned off causing a short condition.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 29
Posts: 2239
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This schematic is odd. The two additional mosfets (not labeled Q1 to Q4) do not switch the gates of both Q1/Q4 or Q2/Q3. In other words, usually when you're using six mosfets you're controlling the bridge with just two pins, but you're still controlling it with four pins.

Why the extra mosfets?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the two extra mosfets are simply there to invert the signal required to close the mosfet gate. Instead of having to bring Q1 and Q2 low to close the gate and q3 and q4 high to close their gates all 4 switches of the h-bridge are closed with a high signal. I have tried it both ways (with and without the N-channel controlling the p-channels) and have had the same problem.
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

jeremydial1981:

Have you measured the current draw of the motor? Is it from a 6 or a 12 volt PowerWheels? I know on my PowerWheels, the battery fuse is a 25 amp fuse; at startup, even with no load, the motor can briefly pull quite a bit of amps (still, maybe not 25 amps - but more than you'd think).

BTW, flyback diodes don't just protect against spikes during "shutdown"; they also protect against spikes on reversal, as well as spikes during running (which do occur). You may want some external ones, for reasons already stated.

Do you have any caps across the motor terminals (and from terminal to motor case)? If not, you should (this will also reduce the high-voltage spiking from running motors).

Have you noticed if the mosfets are heating up at all (before they burn out)? This could be an indication of not fully switching on, among other things; it could also be you need a heatsink...

You should know the specs of your motor: ie, what its running and stall current ratings are in order to size the bridge properly. Let's say it runs at 2 amps with no load and stalls at 25 amps. Then you'd probably want your mosfets to be rated 2-4 times larger than the stall current. Note that stall current happens at startup as well for a brief period, not just under full load.

Generally the way bridges do this is by paralleling multiple smaller mosfets together (you can do this with mosfets - but NOT with bipolar transistors); if you do this, you'd probably only need to do the four "main" mosfets that drive the bridge, and not the others.

These kind of issues is why I always encourage people to leave high-power h-bridge design to "experts" and instead purchase such a bridge if needed, unless one is willing to put in the money and time to learn this stuff (and if that is your goal - and you don't mind spending the money to do so). Depending on your source, those mosfets don't come cheap, and you could easily spend more money on building your bridge than if you had just bought one in the first place.

I don't know what your goals are, though, jeremydial1981; if your goal is to become an h-bridge expert, then good luck with your experiments and I hope it doesn't send you to poor house; you'll definitely get an education (and if learning h-bridge design is your goal, then a good quality o-scope may be something to plan on getting sooner rather than later).
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey crOsh,
Thanks for the information. No I have not measured the current draw, the motor is from a 12 volt power wheels. Also I do not have any caps in place so I will get that taken care of. As far as mosfets heating up, while using the wall wart for power I did notice the Q1 mosfet getting hot before it went out. After switching to the deep cycle battery it happens so fast i cannot tell. The smoke and then the explosion of the mosfet into two pieces happens pretty quick. Also let me ask you this, My understanding is that if current draw is too much the mosfet it will just overheat and melt but if it is actually exploding it is caused by a short?

As far as the money, you aint kidding. at a buck a pop I have already went through a bag of about 15 mosfets. My goal is to just to learn so if a spend a few bucks it will be ok but I will tell you if I could go back and start over I would have definitely just purchased one. But I am a little OCD so now that I have started I have to continue and find out what is wrong and make it work lol.

Again I really appreciate all the input from you guys.
Logged

Offline Offline
Edison Member
*
Karma: 56
Posts: 2183
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I thought back EMF was just a problem when the electro-magnetic field collapses in other words when the motor is turned off.

Just wanted to interject that with PWM the motor is turning off (its coil is de-energised), even if only for some brief period, though you haven't effected a complete off/stop.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't even think about that.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you got the ground from your wall wart (or battery) connected to the Arduino ground too? I can't really tell from your picture, but it looks like you may not. You might want to try putting a fuse (just a single strand of standard wire works well) between the wall wart/battery supply and the FETs, at least then the fuse will blow if the current draw is too high, not your FETs.

Try disconnecting the motor, and just leaving the FETs attached to your power supply by themselves, if they still get hot you know it's nothing motor/noise related.

As it seems to be the P channel ones letting out the magic smoke, it's probably because they aren't being pulled fully high to supply voltage (which turns them off completely). Anything less than Vcc on the gate, and they'll be letting through some amount of current making them hot. The 10k pull-up resistors you have on the P-FET gates might be too large, try a smaller value like 2k.

To check if the P channel FETs are definitely turned off, disconnect the N FETs and check the P channel FET's source leg voltage is zero when pin 2 and 3 are off. If the voltage is zero, then the N channel FETs probably aren't turning off properly, causing a short. You can check the resistance between drain and source on the N FETs with a multimeter, the resistance one way should be say ~4kohms (due to the diode) and the other way should be near enough infinity.

Another thing, is I wouldn't use the Arduino Mega for high voltage/current experimentation, if something blows, you could get 12v through your Mega, which will more than likely kill it. Use an Arduino that's got a socketed chip like the Duemilanove or DIP Uno. Cheaper to replace just the ATmega than the whole board!

Hope that makes some sense and helps a tad smiley
« Last Edit: February 24, 2012, 02:38:41 pm by Elijahg » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes all the grounds are connected.

Question about the p-channel test procedure. You said to test the voltage at the p-channel Source pin...? shouldn't SOURCE leg voltage be at 12 volts regardless since it is connected directly to supply? Did you mean to test drain pin voltage?  Source is going to vcc and drain is going to motor lead.
« Last Edit: February 24, 2012, 03:02:15 pm by jeremydial1981 » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Apologies, you're right. I was looking at my all N FET schematic which differs slightly to the P/N FET one. Test the drain pin instead smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok sounds good thinks for the info. Much appreciated and from the sound of it I am starting to think it has something to do with the p-fets not being fully off. So with the n channels disconnected the drain pin of the p channels should be 0volts. right? If there is any voltage then they are not fully off. I am going to test and I will let you know what I find.
Logged

Pages: [1] 2   Go Up
Jump to: