Pages: [1] 2   Go Down
Author Topic: MOSFET won't turn off  (Read 3268 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, first off, I am a total noob to using MOSFETs, so bear with me on this one.

I have some large electromagnets I need to control with my Arduino.  These monsters run at 12v/4a, so yeah not gonna be running them off the board.  
The solutions seems simple.  A MOSFET and some PWM.  That way I can turn up the power or drop it as I need to.  

I hit up Sparkfun, and got a RFP30N06LE (sorry, it won't let me link to it yet)
Specs seem to make them a good fit.  

Here is where it is getting problematic.  I wired these up very simply.  literally a wire from pin 9 to gate, source and drain with a big old magnet in middle and a flyback diode to handle things when the magnet turns off.  

Here is where I am having trouble.

The magnet won't turn off.  It is always on.  Now usually when I screw up with electronics the exact OPPOSITE happens.  I even tried reversing the source and drain and it STILL just turns on at full power.  Which is VERY annoying because if it just broke I would at least know what not to do!  

I really can't figure this out.  I am assuming it isn't a code issue since it does this regardless if the Arduino is even on.  

Any ideas on what would cause this?  Again, I am more used to the smell of smoke and things not working when I do something wrong.
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here is where it is getting problematic.  I wired these up very simply.  literally a wire from pin 9 to gate, source and drain with a big old magnet in middle and a flyback diode to handle things when the magnet turns off.

It's not clear where things are hooked up from your description. First, I would put a resistor between pin 9 and the gate, else pin 9 will be driving into a very large capacitance that can damage the pin driver. Second, exactly what is going on with source and drain? I'm thinking you want the source connected to 0V and the drain connected to one end of your electromagnet, with the other end connected to 12V.

If the magnet is always on it means it's either miswired or the MOSFET has been destroyed and it is shorted. Any chance you can sketch up a quick schematic to see what you've got wired up?

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Crap, I thought I didn't need a resistor for the mosfet.  Easy fix though.

Here is the schematic.  A bit unconventional, but simple enough to follow.

Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If red is positive and black is negative then you do have drain and source swapped. Red (+12V) should go to the magnet. The other magnet wire should go to the drain. The source should be connected to 0V.

Also, don't forget to connect the ground of the +12V supply to the ground of the Arduino.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33375
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Also as drawn that diode is the wrong way round, the cathode should be to the positive side of the supply. In other words it is normally reversed biased.
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you set the Pin9 to output ?

otherwise the pullup resistor will switch on the Mosfet
« Last Edit: November 18, 2010, 08:51:23 am by John_Smith » Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, a few questions if you will indulge my massive ignorance.

One, a resistor was mentioned on the line going to gate from the arduino.  What kind?  

Secondly,
Quote
Also, don't forget to connect the ground of the +12V supply to the ground of the Arduino.

Ok, makes sense.  And by this do you mean the ground on the digital side?  I see two on the board.  One for each side.  I just want to confirm I'm not doing this backwards.

Thirdly,
Quote
Also as drawn that diode is the wrong way round, the cathode should be to the positive side of the supply. In other words it is normally reversed biased.

Gotcha.  I checked and realized that I drew it wrong.  I need to follow the "valve rule," right where the cathode hooks up to the positive so that it can shut off at positive.

And yes, pin9 is set to output, but I'm not so worried about that yet.  Need to get the wiring right.  Then I can get the software going.  smiley

You guys are helping IMMENSELY btw!

Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I usually feed the gate of a mosfet through a 10k resistor, but I always have a 220k resistor between the gate and ground,
This will take away any charge on the gate if there is an open circuit somewhere on the gate circuit.

If you measure a fet with a multi meter for example, and have charged the gate by measuring between gate and the source, then when you measure between the drain and source you will read a short circuit.  This is because the gate stays charged, having the 220k res fitted avoids this happening with open or intermittent circuits while fault finding.
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK   I update the schematic.
This seems to make more sense.
On the right track here?  Yes?  No?

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26473
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Closer - the 12V- needs to connect to the Arduiono GND.
The 220K resistor needs to from MOSFET Gate to ground.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just question the need for the series 10k resistor from the Arduino output pin to gate terminal. This would just slow down the switching time for the mosfet (RC time constant) leaving it in transition period longer and thus raising the power dissipation. I've seen low value resistors used for mosfet gates, say 330 ohms but never as high as 10K. What benefit does the 10k bring to the table?

Lefty
« Last Edit: November 21, 2010, 06:03:03 pm by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As dumb as this may sound, the ground thing is confusing for me.

I am using an Uno, and as the good Mr. crowley pointed out, there are three grounds on the board.

One on the PWM side, and two on the power/analog side.  One is paired with Vin and the other with the 3.3/5v supply.  Do I use the 3.3/5v ground or the ground on the digital side?  Or does it matter?  

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Or does it matter?  
Flip the board over and have a look. The ground pins are all connected together.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is what I thought, but I wanted to confirm it.

I have a heatsink on the MOSFET now too which should be dry by tomorrow so we'll see if this works.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, the adhesive on it needs to dry.
Logged

Pages: [1] 2   Go Up
Jump to: