mosfet to power motors

I was trying to put together the mosfet circuit shown in the Arduino booklet to run a computer fan. The circuit shown above seems to work.

Does this circuit look correct? Am I going to damage anything with this circuit?

I found it hard to figure out the drawing in the booklet.

There is a diode across the load shown in the booklet drawing. What is this diode for? To short out any reverse voltage? Is it necessary? Is a switching diode adequate? Would an LED work?

yes that looks right...

you should put the diode in. Mosfets are particularly noise/garbage sensitive. the diode is called a "freewheeling diode".. give that term a little Googe and all shall become evident :)

D

i’m just learning mosfets too. When you remove current suddenly from a coil (electromagnet inside the motor) the coil will briefly put out a high voltage spike. The reversed diode will short out that backfeed from the coil.

The explanation for this is inductance. A coil of wires is basically an inductor that "wants" to keep the current flowing through it from changing. When you shut off the current through the motor, the magnetic field set up by the motor coils acts to keep the current flowing. The presence of the diode gives this current a harmless place to go. Without it, the resulting voltage spikes could mean trouble for the rest of your circuit (e.g. your microcontroller might repeatedly reset).

  • Ben

All the above is true....though a computer fan is probably not going to exhibit those effects. They're almost all brushless motors, therefore they already have a controller inside with transistors controlling the coils. :)

oh right ya for a pc fan you won't need it

I dont understand this Ground... this is in fact "-" right? What if my motor is using 24V and I have separate power supply for it? Do I connect gnd from arduino and -24V of the motor supply in this case?

ground isnt always the same as the "-". ground means zero potential, meaning you could have positive 24 volts or negative 24 volts in relation to ground. im assuming your power supply is a positive voltage one, so yes, connect the "-" to the arduino ground. make sure though, im not responsible if anything blows up.

will this circuit still work if I put the load between S and Ground? I want to keep the mosfet near my circuit and not have to run a long wire from the MCU to the Gate.

will this circuit still work if I put the load between S and Ground?

No, this type of circuit requires that the load is connected between the positive power supply and the MOSFET's Drain terminal. To put the load on the ground side, you must use a P-channel MOSFET in a circuit configuration called a "high side driver".

i was under the impression that you could do that, i thought thats how the all n-channel h-bridges work, would you please elaborate anachrocomputer.

(ahh, i see now, that would mess up the ground potential to the gate, nevermind, unless im wrong again.)

Yes, it's all to do with getting a ground-referenced logic level from the Arduino to drive a MOSFET that's connected to a higher voltage (say 12V). You must set the Gate pin to 12V for the P-channel MOSFET to switch off. And connecting the Gate to 0V will switch it on. Going from 0V to 5V won't work.

Regarding N Channel H bridges, I found the following helpful. Beginning: http://www.mcmanis.com/chuck/robotics/projects/servo.html and ending with schematic . . . http://www.mcmanis.com/chuck/robotics/projects/images/page1.gif