Go Down

Topic: MOSFET won't turn off (Read 3997 times) previous topic - next topic

RGK

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.

RuggedCircuits

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

RGK

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.


RuggedCircuits

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

Grumpy_Mike

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.

Boffin1

#5
Nov 18, 2010, 01:41 pm Last Edit: Nov 18, 2010, 02:51 pm by John_Smith Reason: 1
Have you set the Pin9 to output ?

otherwise the pullup resistor will switch on the Mosfet

RGK

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.  :)

You guys are helping IMMENSELY btw!


Boffin1

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.

RGK

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


CrossRoads

Closer - the 12V- needs to connect to the Arduiono GND.
The 220K resistor needs to from MOSFET Gate to ground.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

#10
Nov 21, 2010, 11:59 pm Last Edit: Nov 22, 2010, 12:03 am by retrolefty Reason: 1
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

RGK

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?  


PaulS

Quote
Or does it matter?  

Flip the board over and have a look. The ground pins are all connected together.

RGK

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.

RGK

Well, the adhesive on it needs to dry.

Go Up