I have a Raspberry Pi Zero which I want to be able to power on/off via code, so I made this circuit:

simulate this circuit – Schematic created using CircuitLab
I would like to avoid powering the Raspberry Pi directly through the GPIO pins, so I chopped a micro USB cable up and connected its 5 V to my power supply (later on it will be a battery, but for now is a phone charger). The rest of my circuit is also powered through the same power supply. The signal to the gate is supplied from another microcontroller which also operates at 5 V. I added an LED just to aid in troubleshooting.
When I apply the 5 V signal at the gate the LED lights up, then I plug in the micro-USB in the Raspberry Pi's PWR slot and the LED turns off. Needless to say, the Raspberry Pi is not powering up. If I leave it plugged in, after about 5 - 10 seconds the LED flashes really quickly, and if I unplug the Raspberry Pi the LED glows back up after the same time period.
I measured the supply voltage in the circuit while the Raspberry Pi is plugged in and it stays at 5 V. I also measured the voltage at the gate which is 5 V without the Raspberry Pi plugged and drops to 0 V (20 mV to 150 mV, I don't know if that's an issue with my multimeter or something) as soon as I plug it in.
The Raspberry Pi's ground is connected to the circuit ground only through the MOSFET, although there are I²C and SPI connections to other devices, which I wasn't sure would work and was something I was hoping to test, short of knowing I wouldn't even be able to power the Raspberry Pi on. I'm mentioning that because I'm trying to be as exhaustive as possible to aid anyone who's willing to help me out.


