Creating a USB-C power disconnect

I'm working with an Arduino Giga, and I have it set up to run on 12V through the VIN (though my main power is 36V, and I am using a buck converter to bring this down to 12V). There are times that I also need plug the Giga in to the USB-C so that I can use the Serial monitor while the larger system is running (it has both the 12V VIN and USB-C connected, and I have been told that this is fine for Gigas, but please correct me if I am wrong). I have a bad habit of forgetting to unplug the Giga from the USB before turning the power off in my system, and I don't think that this is very good for the Giga because it starts trying to power everything.

What I am looking at doing is creating a power disconnect on the USB. I found some USB-C power split breakout modules, so I was thinking that I would wire them up to connect the data+, data-, and GND together, then place a FQP27P06 MOSFET on the 5V VCC. The idea is that the Giga won't recognize that there is a computer attached until the 5V power is connected, but I don't know enough about how USB communication works to know if this is how things actually work.

My plan is to use:

  • the 5V from the USB-C to pull the MOSFET gate HIGH (through a 10kΩ pull-up resistor)
  • connect the MOSFET gate pin to a 2N4401 transistor collector pin (through a 270Ω resistor)
  • connect the 2N4401 base pin to the 36V (through a 12kΩ resistor)
  • connect the 2N4401 base pin to GND (through a 100kΩ pull-down resistor)
  • connect the USB-C from my computer to the MOSFET source pin
  • connect the USB-C to the Giga to the MOSFET drain pin

Basically, it's high-side switching: the 36V turns the 2N4401 on, which turns the MOSFET on and allows the USB-C power to connect to the Giga. Then, when the 36V turns off, the 2N4401 loses power and the base pin goes LOW, and the 5V from the USB-C coming from the computer pulls the MOSFET gate pin HIGH and cuts the power off.

Is this a usable design? Am I missing anything?

In case the arts and craft version helps to explain what I am talking about:

If "everything" is at 5 volts, then I'd think about powering "everything" directly from a 5 volt supply and use a Schottky diode between that and the 5v pin on the MCU to prevent it [the MCU] powering any of the peripherals.

I may have missed something specific to your setup but your solution sounds rather elaborate and I'd definitely be looking for something simpler.

No

Am I missing anything?

Yes the fact that the PMOS may not turn on with only 5V gate drive.

it has both the 12V VIN and USB-C connected

Even simpler, since you never need to power the GIGA via USB then just cut the USB Vbus wire

What about this?

Even simpler, since you never need to power the GIGA via USB then just cut the USB Vbus wire