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.
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.
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).
[ 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...?
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...
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.
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.
Positive voltage source input
Negative voltage source input
Positive voltage output to device (motor, solenoid, relay, etc)
Return from other side of device (motor, solenoid, relay, etc)
The input side of the module should have two terminals:
Digital output signal from arduino
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.
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?
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.
...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.