Hi I'm using a IRFS630B (power MOSFET) rated at 200V and 9A max. Vth is 2~4 V. I'm trying to sink the current of 8 common cathode LEDs and I'm having some troubling getting my code to switch the transistor on/off. I have the gate connected to the Arduino Mega on pin 8 and when I configure the pin as an input and activate the pull up resistor it's on and when I deactivate the pull up resistor, it's still on. However, the transistor works properly when the pin is an output which is confusing to me. If anyone can explain why this is that would be great.
Essentially here is my goal:
8x8 LED layer (not yet built, I'm just tasting on one row of the 8x8 layer) switched by the above MOSFET and the Arduino Mega sinking the current from the layer (the layer is interfaced to the Arduino through the MOSFET). I was under the impression that the only way to do this is to configure the pin that sinks current as input. I've tried this and it doesn't work, or sometimes the LED's slowly fade and eventually turn off.
Is the pin not meant to be set to OUTPUT when controlling a FET, meaning its working properly?
I was under the impression it was supposed to be configured as an input. If I can control the transistor using a pin configured as output, is the Arduino still sinking current on that pin?
Go with the arduino pin as an output, it can sink or source.
When you use the pulllup, the gate is at +5, fine.
But when you take away the pullup, the gate keeps a charge, and the pin is floating, and the MOSFET stays on.
Awesome that makes sense. Thanks.
2 things,,, It is good practice to put a 10K resistor from gate to ground, it will be a 500 uA load... and second the Mosfet is a Voltage operated device and it is wise in a 5V system to use Logic Level Mostefs. Vgth is the Gate Threshold Potential... the point at which the device just begins to conduct "Threshold" A mosfet with a 4V vgth would be conducting less than it's full current rating at rated load, where the gate drive is 5 volts or les as you must remember that the output of a '328 is Guaranteed to be 2/3rd's Vcc High and less than 1/3rd Vcc low (off) voltages can be 500 mv to a vol deepening on the port load. Mosfets with Vgth in the range of 2 - 3 V would work better as a high current switch than a device with a 4V Vgth as there is a significant chance of the gate not being properly enhanced. This isn't much of an issue at low currents but for some devices at a HIGH or High current pulse (motor start or solenoid) the low entrancement would force the transistor to be a current limiter. If Vgth is (for example 4V them about 6 to 8 volts would be Required for "Full Enhancment" of the gate. As to the gate pull down it is there in the case that for any reason the gate drive circuit becomes open, "high impedance",... like switching the Proc pin from ouput to an input. Mosfet gates are Extremely High impedance and Very Prone to electrical and electrostatic fields very delicate too (input impedance's of 1000 Mohms are typical) a 2n7000, vnk10m, BS170 would make a great great electrometer with a 500 Mohm gate load and a 1 m resistor from drain to PSU source grounded. A meter from drain to ground and 6" of wire on the gate as a sensor makes a very effective static electricity sensor. The large resistor is necessary for a drain on the antenna ( to reduce response time to the 500 ms range. I made one for my lab electronics bench and the numbers of Cmos devices failed dropped quickly... one last thought... Diode protected gate devices are much more robust than non protected devices (they make poor electrometers.