This includes any possible changes to the code. I've been failing to make a circuit work and I am using a MOSFET instead of the transistor in the demo, could this be the problem?
Since "T" means transistor, yes they are used the same way.
What model MOSFET? Is it logic level?
They can be used "similarly" as a switch or an amplifier... That is, with either one, a small voltage or current can control a large voltage or current.
It's similar to the gas pedal in your car... The further you push the gas pedal, the faster you go but your foot is only controlling the car, you're not moving the car with your muscles. Or, you can think about a water valve... You twist to turn on the water, but the water pressure is coming from somewhere else.
But, you cannot replace one with the other in an existing circuit. The circuit has to be designed for one or the other.
[u]Here is a transistor-driver circuit[/u].
[u]Here is a MOSFET driver circuit[/u].
Similar, but not identical. And the MOSFET must be a "logic level" MOSFET because most MOSFETs require more than 5V to turn-on.
I am using a MOSFET instead of the transistor in the demo, could this be the problem?
It might be but until you say what demo it is hard to say.
This is the demo I am trying to reproduce Breadboard Layout | Arduino Lesson 13. DC Motors | Adafruit Learning System
Not a good idea to power motors from the 5V pin, but in general, a n-mosfet would hook up the same. All that is missing is a 10resistor from gate to ground.
You need to post exactly which mosfet you are using. It might not be suitable for the arduino.
I am using the mosfet that the starter kit came with, the Mosfet transistors [IRF520], would my circuit be the same if I subbed in this mosfet instead of the transistor or would i need to change some things?
IRF520
will work poorly, if at all.
It is not a logic-level MOSFET transistor, so if it was included in your kit, throw it away and buy some logic level MOSFETS, like this one.
You can use it, but you will need a 12v power supply and a transistor to switch the gate. That mosfet only 'just' starts turning ON in the 3-4V range. It might work with some light loads (led's), but for anything that pulls power it will get hot.
Ok thanks guys!
Just to reiterate this point, a MOSFET is a type of transistor.
The transistor shown in the schematic at the first link is called a Bipolar Junction Transistor. It's a transistor too, just a different type of transistor than a MOSFET. Call it a BJT.
It is irritating to me whenever I see this "transistor or MOSFET" kind of question. MOSFETs are transistors. Even professional retailers who really should be doing some more due diligence about these things write this way (I'm looking at you, SparkFun!). It's "BJT or MOSFET", that's the way you should be asking it. A BJT is a type of transistor, and a MOSFET is a different type of transistor. Both are transistors.
You can be more precise and say NPN, or PNP, or n-channel/p-channel...
Man, why do so many vendors sell IRF520 fets as if they were logic level?! There's a lot of shady business practices among the ebay sellers, but I think that's one of the more obnoxious ones)
I normally recommend the IRF3708PBF as a versatile FET, since they're pretty beefy, through hole, and can be used with 3.3v on the gate.
Man, why do so many vendors sell IRF520 fets as if they were logic level?!
Because, they were only $.689 when you buy 10,000 and the logic level mosfet was $.692. The bean counters look at the 100 year profits and see another $2 by using the cheapest one that sorta works. Same thing goes for cars anymore.
DrAzzy:
Man, why do so many vendors sell IRF520 fets as if they were logic level?!
They read instructibles that use them and don't know any better?
DrAzzy:
Man, why do so many vendors sell IRF520 fets as if they were logic level?!
Because they don't give a shit?