I have a design where the power of my circuit comes from a 12V battery and I use the energy from the battery to turn on/off a solenoid valve using an ESP32 (which outputs 3.3V from it's GPIO).
In general the circuit will have some other elements that require power from the battery.
The logic of my circuit is as follows: If the battery voltage drops below a certain threshold, disconnect the power of the battery from every other component in the circuit BUT the ESP32 (which has a buck converter that converts 12V -> 3.3V)
Now, to do this, I'm considering using a MOSFET for switching on/off the current flow from the 12V from the battery to the rest of the circuit when this condition is met, I'm adding a flyback schottky diode for safety (because I'll have some inductive loads).
Now, I'm not entirely sure if I should connect the drain of my first MOSFET to the source of the second MOSFET. The second MOSFET will be used to turn on/off the solenoid valve using another GPIO of the ESP32.
I'm sorry if I'm not making myself clear, I'm struggling with my english over here. I'm attaching a schematic that I've been simulating on multisim.
The circuit on the left is the switch that cuts off the power from the circuit of the right. The circuit on the right is the one that turns on/off the solenoid valve (modeled as an array of inductances and resistors that I found on research gate)