Mosfet, switching external power - wire to ground?

Hello everyone,

I'm wanting to have a mosfet turn my small motors and solidnoids and what not on and off. These are connected to their own power supply.

I read that "It's important that the external supply is grounded to the Arduino" and given my initial, limited knowledge of electronics, I was wondering why that was important...?

Hope someone could explain that to me. Thank you very much in advance.

(This is my initial approach:

[image deleted, non-working schematic]

The signal on the Arduino output is 5V, but voltage needs to be measured against some reference, usually a 0V aka ground. So the Arduino "knows" its output is 5V since that's measured against its own ground.

But if you take that wire to some other piece of kit, it can only be deemed 5V if it's measured against the same reference. So if you tie the grounds together, everyone knows what the ground is, and all measurements are taken against that. So what the Arduino says is 5V is also 5V to the other kit.

What is that diode doing? It should not be there. There should be one across the load.

The diagram here: Arduino Forum is more like it.

Every circuit is a circuit - current has to be able to flow round a loop. Thus whenever two circuits are
connected there are at least two wires joining them (otherwise each circuit acts as an antenna for
the other!).

With a MOSFET the gate-source circuit is driven by the controller, the drain-source circuit is switched.
The source terminal is in common and typically grounded (for n-channel MOSFET switch).

A diode is needed because the load is inductive, but it goes backwards across the load. The
diagram in this thread: http://arduino.cc/forum/index.php/topic,11565.0.html shows this.

[ the gate resistor is missing though - for larger power MOSFETs the gate-source capacitance is
so large than current limiting gate resistor is advised - 150 ohm is a reasonable choice. For very
high power PWM driving a proper MOSFET driver chip is worthwhile ]

I read that "It's important that the external supply is grounded to the Arduino" and given my initial, limited knowledge of electronics, I was wondering why that was important...?

Not only is it important it is vital:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

Thank you all for your input, MarkT your explanation made me visualize the scenario & helped turn it 'right' in my skull, so great choice of words, thanks,

such as this:?

[image deleted, non-working schematic]

I'm confused about the rectifier diode and am unsure I got it right. The diode is there to protect the delicate mosfet(?), so why isn't it on the 'mosfet-side' of the schematic? Like with this AC relay, for example, where the diode is on the coil and not on the load:

[image deleted, irrelevant schematic]

Feel like such a noob, thankfully that's what I am...

Grumpy_Mike:
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

Hello Grumpy_Mike,

thanks for that. "THIS WILL NOT WORK" - very educational coloring, too, will read it all and be much the wiser,

good of you to share you knowledge like that, cudos.

Your drawing is failing to show the actual motor and power supply wiring (and there is ways it could be wired wrong) and if it did then we could show you where the diode should be wired, which is right across the two motor terminals.

Lefty

Hello retrolefty,

thanks for your input,
I set out to try and make a small 'mosfet-module' into which I could plug various loads; motors, solenoids, consumer (pre-resistor'ed) led-strands and such, so that I wouldn't have to re-design for a specific motor or such. I surely would appreciate your thoughts on that, in regards to the wiring: how to shift the protection diode to the 'mosfet-module' and protect that curcuit no caring what's hooked up. I guess a relay would perhaps be best(?), I just really wanted to make it work with a mosfet and gain knowledge about those types of components.

As you have drawn it all that happens is that the FET shorts out your battery.
Now if you connect what you mark as + from the battery to one end of the motor and the other end to the actual + from the battery then the FET, when it is switched on, turns on the motor. The diode should be anode the junction of FET and motor, cathode to the + from the battery.

I set out to try and make a small 'mosfet-module' into which I could plug various loads; motors, solenoids, consumer (pre-resistor'ed) led-strands and such, so that I wouldn't have to re-design for a specific motor or such.

Not a bad idea. To implement it best in my opinion the output part of the module should have 4 terminals for external connections.

  1. Positive voltage source input
  2. Negative voltage source input
  3. Positive voltage output to device (motor, solenoid, relay, etc)
  4. Return from other side of device (motor, solenoid, relay, etc)

The input side of the module should have two terminals:

  1. Digital output signal from arduino
  2. Ground input from arduino

On the module 1 and 3 would be connected together.
A diode could be mounted on the module across terminals 3 and 4, with cathode of diode wired to 3.
However such 'flyback diodes' are more effective when wired right onto the two terminals of the inductive device.

On the module the mosfet drain terminal would wire to 4, it's source terminal to 2. The gate would wire to series current limiting resistor (200 ohms) and then on to an addition input pin on the module (5) for wiring to an arduino digital output pin. It's also a good idea to add a 10K ohm resistor from the gate terminal to ground to insure the mosfet is forced off if the arduino was ever to be powered off but the external voltage source for this module remained on.

Be sure #2 terminal wires to the arduino input ground terminal (6) of the module which then wires to an arduino ground pin.

What do you think?

Lefty

retrolefty:
What do you think?

I think you're a hero, that's what I think. Well you all are. I'm from the software world and some of these new things are tough to grasp, but you explain it great.

retrolefty:
However such 'flyback diodes' are more effective when wired right onto the two terminals of the inductive device

Trying to wrap my mind around the above link - why would the diode be more effective when closer to the device, as opposed to having to travel a minor distance? The flow of current will never reach the other curcuit anyway?

Thanks for your patience :slight_smile:

For others that might come across this thread, here's a link to a page about flyback-diodes which was helpful to me, http://digital.ni.com/public.nsf/allkb/336D3653F6B6387386256F36005BE09F

Hello Runaway Pancake,

did you have that handy or did you just whip it up on account of this thread? Either way I'm grateful, thanks!

why would the diode be more effective when closer to the device, as opposed to having to travel a minor distance?

Because the fact that the larger voltage generates a current that is routed over a long distance causes it to radiate electromagnetic interference more. It is like having a bigger antenna.

Grumpy_Mike:
Because the fact that the larger voltage generates a current that is routed over a long distance causes it to radiate electromagnetic interference more. It is like having a bigger antenna.

I see - thanks. In your opinion, should I take measure to shield against any such interference? The mosfet should switch a maximum of 24 volts, 2 amps load, not a lot but still... Thanks in advance.

harleydk:
Hello Runaway Pancake,

did you have that handy or did you just whip it up on account of this thread? Either way I'm grateful, thanks!

Sketched it out just for you.

...and if you cannot grasp how an inductive spike an antenna can radiate "electromagnetically"... know this... the first 30 years of radio were dominated by Spark Gap radios. They relied on a spark, an antenna and the behavior of a wire coil to transmit.

pwillard:
...and if you cannot grasp how an inductive spike an antenna can radiate "electromagnetically"... know this... the first 30 years of radio were dominated by Spark Gap radios. They relied on a spark, an antenna and the behavior of a wire coil to transmit.

Spark-gap transmitter - Wikipedia Fascinating stuff to read about. Makes me want to go out and build one.

Awesome. Please accept my humble karma upvote.