I have simulated this circuit (where the 2N7000 is the 2N7002 in practice, which is its SMD counterpart) to control power to a sensor with a STM32 board (3.3 V logic). The problem is that it never turns off when I mounted it in my PCB (i.e. the PMOS never turns off). I have tried 2 R1 values: 10K (when the NMOS is turned off voltage should be 5V, but is 30 mV) and 1k (voltage is 2.4V, should be 5V again). I have replaced the MOSFETS, the result is still the same. All the other voltages, aside from the resistor look fine. Does anyone have an idea of what is going on? I am using an LED with a 220ohm resistor to simulate the output of my sensor. Am I doing anything wrong with the design of the circuit? I repeat, I simulated the circuit and it is working as desired in the simulator.
I have been searching people putting a pull down resistor on the gate, can that work?