MOSFET Trouble

I am building a robotic arm for Science Olympiad at my high school and I really want to have an electromagnet on the end of the arm to pick up nails. I planned to program the Arduino to respond to the push of a momentary switch. This would tell the Arduino to send a HIGH signal to the gate of a MOSFET which would then allow the electromagnet to power itself from a different, stronger, power source, rather than the Arduino.

My problem is with the MOSFET transistor. It is NPN (I'm pretty sure...) and I have looked up the data sheet (IRF630A pdf, IRF630A Description, IRF630A Datasheet, IRF630A view ::: ALLDATASHEET :::) to be sure of the pinout. No matter what I try, I cannot get the supposed gate pin to effect the state of an LED (I am using this to make sure I have connected the MOSFET correctly). The LED stays HIGH. I have even tried reversing the transistor in case the data sheet or my understanding of it was incorrect. I cannot figure out what to do. I will attach several pictures including what I believe I have hooked up in a schematic, as well as two shots of the setup. please bear with me in the way that I know I only have one power source in use here. The original was in a crowded breadboard, so I quickly mocked up everything on a clear(ish) one to make it easier to see. In reality, I want the Source and Drain pins to be connected to a 7.4 volt Lipo battery.

And yes I know the pictures show nothing hooked up to the third pin. That would be connected to the positive of the battery.

I spent quite a time trying to get this to work. I am so frustrated right now that anything you can tell me would be much appreciated.

I couldn't get my photos to work right so here are the links to them.
http://www.flickr.com/photos/brandondub/8428913456/in/photostream
http://www.flickr.com/photos/brandondub/8427821511/in/photostream
http://www.flickr.com/photos/brandondub/8427822445/in/photostream

OK, first the terms NPN and PNP are used in reference to bipolar junction transistors (BJT) not terms used with MOSFET transistors, which are said to be either P-channel or N-channel mosfet transistors. The most commonly used type in applications like you wish to use is a N-channel as a 'low side' switch. The positive voltage source would wired to the load, electromagnet in your case, the other side of the magnet to the mosfet drain terminal and the source terminal back to the negative terminal of the voltage source. There also needs to be wire from the negative power terminal to a arduino ground pin. Then finally a wire from a arduino output pin through a low ohm series resistor to the gate terminal of the mosfet, 200-330 ohms should be fine.

Now what could be causing you your problems. The wiring of course has to be correct which I've tried to outline above. Second and just as important is the specific MOSFET you are trying to use. It's not what is called a 'logic' level mosfet, but rather a standard one that can't be fully turned on to it's lowest possible resistance (Ron value) unless you have at least +10vdc across it's gate/source terminals, and as a arduino can only go to a maximum of +5vdc, your mosfet can't fully turn on. So you really should get a proper mosfet for use with an arduino. You also need to know how much current the magnet draws at the voltage you are powering it with. If that data is not available to you, you should measure the current draw with a meter with the magnet simply wired across the power supply terminals. Once you know that value you are in a better position to select a properly rated 'logic' level N-channel power MOSFET for your project.

That help?

Edit: By the way the drawing in one of your linked photos is completely wrong and see if you can redraw it using the wiring directions I gave above. If you can't first draw it correctly, you aren't in a position to wire it correctly. :wink:

Lefty

Lefty: Thank you for correcting me on my use of "NPN." I'm about 2-3 months into electronics and almost a month into Arduino. I clearly have a lot to learn. There are no electronics classes at my high school so I'm doing everything on my own. It's really cool to show successful projects to my teachers because they are in awe, but it's a huge pain in the ass when I need help because no one there knows enough to help me out. :roll_eyes:

As far as my schematic goes, is this correct? http://www.flickr.com/photos/brandondub/8428978072/in/photostream

Also, probably an idiotic question: I don't need a pull down resistor on the gate here because the Arduino will write LOW when told so, but if I was just using an SPST switch it would need an in-circuit pulldown, correct?

Brandeaux:
Lefty: Thank you for correcting me on my use of "NPN." I'm about 2-3 months into electronics and almost a month into Arduino. I clearly have a lot to learn. There are no electronics classes at my high school so I'm doing everything on my own. It's really cool to show successful projects to my teachers because they are in awe, but it's a huge pain in the ass when I need help because no one there knows enough to help me out. :roll_eyes:

As far as my schematic goes, is this correct? http://www.flickr.com/photos/brandondub/8428978072/in/photostream

Your drawing is correct, except for forgetting about the all important ground wire from an arduino ground pin to the negative terminal of the battery.

Also, probably an idiotic question: I don't need a pull down resistor on the gate here because the Arduino will write LOW when told so, but if I was just using an SPST switch it would need an in-circuit pulldown, correct?

Not a idiotic question at all, but rather an insightful one. Yes a 10K ohm resistor wired directly across the source and gate terminals would insure the mosfet turns off when there is no signal going to the gate terminal. Some people advise to wire that in even when using an arduino in that there might be a case where your arduino is powered off but the battery is still available to power the magnet and without an active low coming from the now unpowered arduino the mosfet may not stop conducting.

Have you dealt with how much current your magnet draws when being powered via the battery?

On my board all of the ground buses are connected and I use separate buses for different voltages, so I'm (generally) automatically good on the grounds being connected. (I am powering other things directly from the Arduino so the ground is already present on the breadboard.)

Would a TIP120 work with the 5V from the Arduino?

To be honest, I don't have the electromagnet in my hands because I have yet to make it. I am going to try and wind magnet wire around the core of an AC induction motor out of a microwave, which I should get tomorrow. I was playing with a "test" electromagnet today though, and off of a 9 volt it drew 1.2ish Amps. So...I'm hoping I can play with these numbers a little and say that 9V/1.2A = 7.5? in the system. Provided that is correct, 7.2V/7.5? = 0.96A. I also would like to believe that making the actual electromagnet will require more wire than the beefy nail I made today, so the resistance will be higher, and thus the current lower.

I realize that these numbers are pretty low... If you don't mind me bouncing another idea off of you: What if I wired 2-3 9 volts in parallel to give this a little extra current capacity, put some resistors in parallel with the electromagnet to reduce resistance, thus causing more of a draw on current? Do you think this would be viable for a short period of time? I really only need this to work for about 15 minutes tops.

Also, this just came to mind: Because an electromagnet builds up an inductive field, should I be putting a diode backwards across the inputs of the electromagnet to protect the transistor from the potential voltage spike when it is turned off?

Would a TIP120 work with the 5V from the Arduino?

Then you would be using a NPN transistor, actually a Darlington NPN, which is two internally piggyback connected npn transistor to obtain very high current gain values. It might work fine but again knowing what your actual maximum current demand is the best way to then go selecting a component to complement it. One usually aims at a device rated at least double or triple the actual current you are going to draw and maybe max voltage rating of at least double or triple of your actual voltage source. One should never operate transistors or other semiconductors at their maximum ratings for best results and reliably, and the costs of the extra specification is almost insignificant.

And yes a reverse biased diode mounted directly on and across the magnet terminals is an important addition, I should not have forgotten to mention it.

So the arduino playground as a circuit layout that would work for A TIP120 hook up, not much different then the mosfet setup. Arduino Playground - HomePage

Thank you so much! I'm off to hunt for a more appropriate transistor. XD

Judging from your schematic, the primary reason your circuit is not working is that you have not connected the negative side of the battery to Arduino ground.

Although your mosfet is not a logic level one, it will probably work well enough if the current you are trying to switch is less than about 1A.

A mosfet is a better solution than a TIP120, it will have lower voltage drop and run cooler.

As far as my schematic goes, is this correct?

Something like that will never work: there is no signal loop.

You need to common the two circuits.

Before you embark on buying new devices, get the circuit right.

Brandeaux:
On my board all of the ground buses are connected and I use separate buses for different voltages, so I'm (generally) automatically good on the grounds being connected. (I am powering other things directly from the Arduino so the ground is already present on the breadboard.)

This would be why I forgot to draw it in.

retrolefty:
Then finally a wire from a arduino output pin through a low ohm series resistor to the gate terminal of the mosfet, 200-330 ohms should be fine.

OK I'll bite. I'm familiar with biasing transistors because you need to inject a current into the base to cause it to conduct, and you do this with a series resistor. But I haven't used MOSFETs yet but plan to. Why did you recommend a series resistor to the gate when no current is needed to bias it? The resistor to ground at the gate seems more understandable.

Thanks.

modeller:

retrolefty:
Then finally a wire from a arduino output pin through a low ohm series resistor to the gate terminal of the mosfet, 200-330 ohms should be fine.

OK I'll bite. I'm familiar with biasing transistors because you need to inject a current into the base to cause it to conduct, and you do this with a series resistor. But I haven't used MOSFETs yet but plan to. Why did you recommend a series resistor to the gate when no current is needed to bias it? The resistor to ground at the gate seems more understandable.

Thanks.

Good question. While once the mosfet is fully on or fully off there is indeed no gate current flow as the gate is insulated from the source/drain terminals, and that is the main difference from a mosfet from a npn/pnp transistor, the mosfet is a voltage operated device, where the latter is a current operated device.

Anyway that gate/source junction while insulated does have a significantly large amount of gate to source capacitance and when the output pin changes from low to high or high to low it has to supply significant current flow to charge or discharge the gate capacitance. This current flow is real and depending on the specific amount of capacitance a specific mosfet has could tax the arduino output current rating. So that is why many recommend a small value series gate resistor. You most likely could wire up without it, but most people like to pamper their arduino boards so they suggest gate resistors.

Lefty

retrolefty:
Anyway that gate/source junction while insulated does have a significantly large amount of gate to source capacitance and when the output pin changes from low to high or high to low it has to supply significant current flow to charge or discharge the gate capacitance. This current flow is real and depending on the specific amount of capacitance a specific mosfet has could tax the arduino output current rating. So that is why many recommend a small value series gate resistor. You most likely could wire up without it, but most people like to pamper their arduino boards so they suggest gate resistors.

Lefty

Ah I see - thanks Lefty.

I finally got my Arduino kit ordered so we'll be into the fray by next week ...

Why did you recommend a series resistor to the gate

So during high speed switching, the mosfet can burn up faster / sooner.

modeller:

retrolefty:
Anyway that gate/source junction while insulated does have a significantly large amount of gate to source capacitance and when the output pin changes from low to high or high to low it has to supply significant current flow to charge or discharge the gate capacitance. This current flow is real and depending on the specific amount of capacitance a specific mosfet has could tax the arduino output current rating. So that is why many recommend a small value series gate resistor. You most likely could wire up without it, but most people like to pamper their arduino boards so they suggest gate resistors.

Lefty

Ah I see - thanks Lefty.

I finally got my Arduino kit ordered so we'll be into the fray by next week ...

Well good luck. The Arduino platform really does open up a world of possibilities for having fun and learning lots of new stuff.

Good luck and keep us posted on your projects and progress.

Lefty

dhenry:

Why did you recommend a series resistor to the gate

So during high speed switching, the mosfet can burn up faster / sooner.

Better the mosfet then his arduino. No? :wink:

Lefty