I'm trying to build an internet-connected button. When button is pressed, WeMos D1 turns on, makes a network call and then cuts off the power by pulling the irlb8721
gate to LOW
.
Video: https://photos.app.goo.gl/QEpIgPa3gxHatTyG3
Here's the program I currently use for test:
void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, LOW); // Turn on built-in LED
pinMode(5, OUTPUT);
digitalWrite(5, HIGH); // Keep ourselves powered after button is released
delay(5000); // Do the work, e.g. make a network call
digitalWrite(5, LOW); // Cut off the power
}
void loop() {}
The problem is that after the power is turned off, there's still ~20mA current leaking, which is a deal-breaker for a battery-powered button. Disconnecting the pin 5
(D1
) gets rid of that for some reason.
Resistor between gate and source is 676kOhm
, between D1
and gate - 10kOhm
. Thanks for your help!