I am learning how to create a soft latch power switch, using an N channel mosfet.
Currently, I have this:
simulate this circuit – Schematic created using CircuitLab
The idea is (so far) that I can turn it on with the switch, the Arduino immediately brings the power control high (ensuring the FET stays on), and brings that same pin low after 1.5s (simulating a timed shutdown).
However; when the power control goes low, I still see about 1.8v in the power control line (I'm presuming its floating?), which leaves this particular FET partially open.
If I disconnect the power control line from the MCU, I get the behaviour I expect. I can touch the power control to +ve and the FET will switch on. If I lift the control line from +ve, the FET closes the gate, due to the pull down resistor.
I'm struggling to understand why the FET works in isolation, but does not work when connected to the MCU output pin. The pinMode is OUTPUT.
FET (3055VL): https://www.onsemi.com/pub/Collateral/MTP3055VL-D.PDF
Here's the test code I'm using. It simply flashes a build in LED 10 times then does a power off.
int ledPIN = 17;
int controlPin = 11;
int lDelay = 150;
bool shouldBeUp = true;
void setup()
{
pinMode(ledPIN, OUTPUT);
pinMode(controlPin, OUTPUT);
digitalWrite(controlPin, HIGH);
}
void loop()
{
if (shouldBeUp) {
for (int i = 0; i < 10; i++)
{
digitalWrite(ledPIN, LOW); // on
delay(lDelay);
digitalWrite(ledPIN, HIGH); // off
delay(lDelay / 2);
}
// Leave the LED low
digitalWrite(ledPIN, LOW);
digitalWrite(controlPin, LOW);
shouldBeUp = false;
}
}
Any help is appreciated! Thank you :)