I have connected the following diagram, using Pin 8 from Arduino to "turn on" the Mosfet.
What is the best way to protect the OUTPUT pin from Arduino?
Thank you in advance.
Pin 8 is defined as below:
int ledPin = 8; // LED connected to digital pin 13
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
[code]
That diagram shows an IRF1405 MOSFET which won't work from logic levels. You require a logic level
FET if driving at 5V.
If by "protect" you mean in case the MOSFET fails, then use a MOSFET driver chip, add 4k7 between
arduino pin and input of the MOSFET driver, which will usually be enough to prevent cascade failure
of MOSFET and driver from taking out the microcontroller too. An opto isolator is another option for
this, but most opto isolators are way too slow for PWM if you want that.