MOSFET – How to Switch Sensor On and Off with MOSFETs

arduinoesp32mosfet

I have a question, I have noticed similar solution for voltage divider to measure voltage on battery with ESP32 using one pin to enable the divider and have it otherwise off the voltage to save power. My question is if the same principle can be used for sensors, let's say the ESP32 wakes up and depending on time it wants to read a specific sensor, so no need to power all of them all the time. Would this work l? Or is there some glaring issue with this schematic? We are talking about 3.3 V logic and power to the sensors.

enter image description here

Best Answer

Other than Q5 being upside down, it looks great. Pay attention to the parallel "body diode" between drain and source in a MOSFET.

It may take some time for the sensor to stabilize, check the datasheet or experiment. A tiny portion of this delay will come from R5 and the capacitance of Q3. (Do not remove R5, it reduces ringing and current spikes.)
\$ t = 2 \cdot R \cdot C \$
Ought to be enough time for the MOSFET, but the sensor may also need some time to stabilize.