High-Power Control: Arduino + N-Channel MOSFET

Discussions area for bildr's blog posts.
From: http://bildr.org/2012/03/rfp30n06le-arduino/

Eventually you are going to find yourself holding a 12v solenoid, motor, or light and wondering "How the heck am I supposed to control this from my Arduino?" And we have covered this in the past. Today we are going to talk about another way of doing just that, this time with an N-Channel MOSFET metal–oxide–semiconductor field-effect transistor ...
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

The pull-down resistor isn't necessary, as the pins of the arduino are of a push-pull-type, meaning they can both source and sink a current.
DrLuke
 
Posts: 364
Joined: Sun Jun 20, 2010 6:01 pm
Location: Germany

Huh... My testing showed otherwise. Ill check again.
Thanks!


DrLuke wrote:The pull-down resistor isn't necessary, as the pins of the arduino are of a push-pull-type, meaning they can both source and sink a current.
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Ok, you are right. BUT.... if the pin ends up floating the transistor will trigger. So as a safety precaution I think we should leave it incase the wire came lose you dont want it to activate.

DrLuke wrote:The pull-down resistor isn't necessary, as the pins of the arduino are of a push-pull-type, meaning they can both source and sink a current.
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

That's a very good point!

You should change this part to clarify it:
The resistor holds the gate low when the arduino does not send a high signal. Simply calling LOW of the pin wouldn’t work, so that’s why that guy is there.
DrLuke
 
Posts: 364
Joined: Sun Jun 20, 2010 6:01 pm
Location: Germany

ameyer wrote:Ok, you are right. BUT.... if the pin ends up floating the transistor will trigger. So as a safety precaution I think we should leave it incase the wire came lose you dont want it to activate.


You have very good design skills - most inexperienced designers (myself included) sometimes neglect the fact that if a component (in this case, the Arduino) fails, you want your circuit to be in a controlled or "safe" state. Hence the term "fail-safe".

On another note, I think the following statement is flipped:
You basically have an In called the Source, an Out called the Drain, and a Control called the Gate. When you send a HIGH signal to the gate (control pin), the transistor switches and allows current to flow from the source (in) to the drain (out).


Using the traditional current "direction" the current actually flows from the drain to the source in a MOSFET (similarly, from the Collector to the emmitter in a BJT). IIRC, the names: drain and source, actually come from the direction that the electrons flow in a circuit (opposite to our traditional current "direction").
Xnient
 
Posts: 30
Joined: Sat Jan 28, 2012 4:42 pm

No, it "drains" the technical current and then "sources" it again.
DrLuke
 
Posts: 364
Joined: Sun Jun 20, 2010 6:01 pm
Location: Germany

DrLuke wrote:No, it "drains" the technical current and then "sources" it again.


Ah, yes, that makes more sense. But I think my correction is still valid.
Xnient
 
Posts: 30
Joined: Sat Jan 28, 2012 4:42 pm

Depends.

There was a reason for this.
WARNING: I am about to simplify the crud out of this, so beware… it is here in an attempt to explain, in simple terms, what is going on.


Do you want users to think of the drain as an output like in real life (drains go out), or as an input.
Mental models need not match implementation models. Forcing the user's brain to think like an engineer is not what we are about here. :lol:






Xnient wrote:
DrLuke wrote:No, it "drains" the technical current and then "sources" it again.


Ah, yes, that makes more sense. But I think my correction is still valid.
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

ameyer,

Your statement is actually correct if you use the electron flow current model (ie, current flows from the negative of a battery, though your circuit and back into the positive terminal). Most people (at least that I know of) use the conventional current model (where current flows from the positive of a battery, through the circuit and into the negative). In this case the statement that I mentioned above is backwards.

If your brain uses the electron flow model, you can just reject (and delete if you like) my complaints. It was shortsighted of me to think that the conventional current model is the only one in practice.
Xnient
 
Posts: 30
Joined: Sat Jan 28, 2012 4:42 pm

That's actually why I didn't have an issue saying that way because it is right if you want to scrutinize it. But really, for most of what people do with these articles, electron flow direction doesn't matter, so I went with something easier to understand metaphorically. Things come from a source and leave down the drain.

Draining to the source just kills me. I have never seen that happen in plumbing. :D

I can change it if it is doing a disservice to users. But anyone who really wants to know what is going on should watch Pete's video from sparkfun.


Xnient wrote:ameyer,

Your statement is actually correct if you use the electron flow current model (ie, current flows from the negative of a battery, though your circuit and back into the positive terminal). Most people (at least that I know of) use the conventional current model (where current flows from the positive of a battery, through the circuit and into the negative). In this case the statement that I mentioned above is backwards.

If your brain uses the electron flow model, you can just reject (and delete if you like) my complaints. It was shortsighted of me to think that the conventional current model is the only one in practice.
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Well, with the technical current your current goes down the drain and comes out of the source.

I don't really want to ensue a debate of technical vs. physical current, but there's a reason why all engineers and the whole industry use technical current, and it's not tradition. So everybody saying that physical current should be used over technical current "because it's right" should think about it again.
In the past 2 years of Physics at school, I learnt a lot about electric fields and basically what electricity is. And the fact is, the electric field propagates from the positive to the negative terminal.
But that is really a physical way of seeing it that is irrelevant for using it. All you need to know is that the technical current is the "righter" way of seeing energytransfer withing an electric circuit. Afterall all we do is move energy from A to B to do something in B, and that energy doesn't "propagate" the same direction as the electrons do.
DrLuke
 
Posts: 364
Joined: Sun Jun 20, 2010 6:01 pm
Location: Germany

Is there a reason why the pull-down resistor is not present in your previous post http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/?
wezside
 
Posts: 1
Joined: Wed May 16, 2012 5:48 am

Yes. The TIP120 Darlington Transistor does not work the same way.


wezside wrote:Is there a reason why the pull-down resistor is not present in your previous post http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/?
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Hi everyone, im trying to control the speed of a 12v 3.7A computer fan using this same setup (circuit and component wise), however i cannot seem to get full power to the fan.
The fan is powered by 12v from a computer power supply and i plan to use PWM with a potentiometer to control the speed. Also, the only change that ive made is increasing the pwm frequency.

I also tired measuring the voltage on the emitter and collector pins of the mosfet and was reading 11.3V. Is there anyway to get closer to 12V using this circuit?
awong
 
Posts: 2
Joined: Wed Aug 08, 2012 2:33 am

This circuit is capable of delivering (very close to) full voltage to your load.

Are your sure you have it set to 100% duty cycle? I ask this because if the duty isn't 100%, it will not reach 100% voltage level (minus Current*R_ds_on)

Can you measure the voltage without the load attached? It is possible that your supply can't handle 3.7 Amps. In this case, the supply may be losing regulation of the voltage.

The other option is that the 0.7V is being lost across your MOSFET. I haven't read the datasheet but you should be able to read the voltage drop across the mosfet by using your multimeter or by math: V_drop = I_ds * R_ds_on. R_ds_on can be found in the datasheet.

Good Luck
Xnient
 
Posts: 30
Joined: Sat Jan 28, 2012 4:42 pm

Yes, I was under the impression that going with a mosfet would bring me closer to my source voltage, and I am using the full duty cycle (255, and im at the other end of the potentiometer). Also, when i read the voltage going into the base pin of the mosfet i can read 5V.

When i measured the voltage without the load it shows 11.3V and then once i start using the PWM it reads somewhere between 0 and 0.2 V (im not quite sure if im measuring the right pins though, but the Emmitter and Collector pins seemed like a good choice)

The power supply is about 10 years old, but it says it can handle 6A with 12V. And when i plug my fan directly to the 12V power, it runs perfectly fine. I will check on the voltage drop calcs soon (wanted to get a reply out first), but im getting about the same voltage through the mosfet as when i was using a TIP120 transistor which was around 11.3/11.4V (using the other article on bildr).

MOSFET Spec Sheet:
RFP30N06LE
http://www.sparkfun.com/datasheets/Components/General/RFP30N06LE.pdf
awong
 
Posts: 2
Joined: Wed Aug 08, 2012 2:33 am

I am trying to understand the difference between FET and BJT transistors. You say in this tutorial that you can use either to accomplish the same thing, but that they require a different setup. Why would you use one over the other?
profmuggs
 
Posts: 1
Joined: Sun Aug 19, 2012 5:30 pm

FETs are easier to kill with static. They are switched with voltage, and are more efficient so they can switch higher currents.

BJTs are just older tech, but less easy to kill. But they are not able to switch as much current.


profmuggs wrote:I am trying to understand the difference between FET and BJT transistors. You say in this tutorial that you can use either to accomplish the same thing, but that they require a different setup. Why would you use one over the other?
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Could you link me to where you picked up that light bulb that you are switching in the video? Could you also give me a quick run down of the specs on it? I want one to play with! I thought most bulbs like that ran off of AC voltage? Anyways great write up as always, and if you could just show me where you got that bulb I would be most appreciative.
whitnasty1
 
Posts: 8
Joined: Mon Jun 11, 2012 6:39 pm
Location: Wilmington, North Carolina

No problem, there is actually a link to it in the article. It's a 15W 12V bulb. You can get it here: http://www.amazon.com/15-Watt-Frosted-A ... B0042F8HLS

This video is showing the capabilities of PWM with the RFP30N06LE. The light, though it looks like a standard house light, is actually a 15W 12V DC light.



whitnasty1 wrote:Could you link me to where you picked up that light bulb that you are switching in the video? Could you also give me a quick run down of the specs on it? I want one to play with! I thought most bulbs like that ran off of AC voltage? Anyways great write up as always, and if you could just show me where you got that bulb I would be most appreciative.
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Oh okay thank you very much, must have missed the link to the actual bulb in the article. What kind of receptacle for the bulb are you using? Just a standard one from any home improvement store or are you using something specifically? If you are could you give me an example of what I need to purchase? Thanks very much and keep up the great work on this awesome site!
whitnasty1
 
Posts: 8
Joined: Mon Jun 11, 2012 6:39 pm
Location: Wilmington, North Carolina

It's Just a normal light fixture.

whitnasty1 wrote:Oh okay thank you very much, must have missed the link to the actual bulb in the article. What kind of receptacle for the bulb are you using? Just a standard one from any home improvement store or are you using something specifically? If you are could you give me an example of what I need to purchase? Thanks very much and keep up the great work on this awesome site!
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

There seems to be an error in the third diagram. The flyback diode isn't necessary across the lamp leads. The article text is correct and indicates that only 2 of the 3 diagrams should show a diode, but it appears in all three.

Jay
jayusa123
 
Posts: 1
Joined: Wed Oct 03, 2012 1:07 am

Looks like I just copied it across all of them. Thanks. Ill fix that.


jayusa123 wrote:There seems to be an error in the third diagram. The flyback diode isn't necessary across the lamp leads. The article text is correct and indicates that only 2 of the 3 diagrams should show a diode, but it appears in all three.

Jay
ameyer
Founder
 
Posts: 3323
Joined: Thu Jan 21, 2010 11:59 pm
Location: The Bay Area

Next

Return to Blog Posts

Who is online

Users browsing this forum: No registered users and 0 guests