Almost every microcontroller support any kind of sleep mode which
enables power saving. But even in sleep mode or deep sleep mode
power is consumed. So I wondered if there is a circuit design which
can be used for absolutely switching off a controller uppon its request.
The circuit shall suport some kind of switch to switch on the controller.
The first question to be answered is: Should you switch the high side or
low side of the circuit. Well, in most designs I have some kind of ground
plane. The controller is attached to the ground plane with multiple vias.
Sometimes because the controller does have multiple ground pins or just to
allow a good flow of charges. So switching low side seems not to be a good
approach.
A mechanical switch could be a good solution for some projects, but most of the
time a transistor is the better way to go. I picked a p-channel MosFET. A IRF9540N
to be precise. It is kinda overkill for a microcontroller, but I had it laying around.
Next we need a way to activate or deactivate the MosFET. This will be done by a BJT,
like the jellybean BC547 (Q3). It will be used to pull the gate of the MosFET to ground to
make it conduct. But how do we switch the BC547?
I decided for a reed switch, but you can use all kind of switches. If the reed switch
is closed, the Q3 will pull Q2s gate to ground and power will be switched on.
R6 keeps the circuit latched even if the reed switch is opened. C2 is needed to prevent
toggling.
To switch the circuit off we add a second BC547 (Q1). It will be controlled by the
microcontroller.
What you have to keep in mind
The continuous collector current of a BC547 shal not exeed 100 mA. So you have to pick the
resistors R3 and R4 according to your input voltage. In my case I designed for 12V.
R3/4 = 12V / 0,1A = 120 Ω
I went of 100 kΩ for almost every resistor, except R3. Because I ran out of
100 kΩ resistors.
Last edit: 2023-03-13