Soft switching allows a single button to be used as both an input and a power button. An example of this is the LCR45 LCR meter from Peak Electonic Design which has two buttons – on/menu and enter/off. As you can tell from the names, both buttons operate to turn the device on/off and also trigger the menu and enter functions in the interface.
This could be achieved by using both buttons only as inputs to the processor (a PIC in this case) and never turning the chip off, simply putting it into low power mode and using the ‘on’ button to wake it from this sleep. But even the best low power mode uses more power than actually turning the device off and the battery would eventually drain. So how can we achieve a multipurpose button and still use no power when turned off? To answer this I reverse engineered the LCR45 and drew out the circuit which I will now explain.
Ultimately, the aim of this circuit is to use a 12V battery to provide 5V to the PIC (not shown) when we turn the device on using the switch (SW1). Once turned on, the PIC should be able to tell when SW1 is pressed again, and also turn itself off. In order to achieve this, we connect ON/MENU_D_L to an input pin and OFF_L to an output pin on the PIC.
To understand the operation of this circuit, lets assume for now that everything is off – PP_5V is at 0V and the PIC has no power so OFF_L is at 0V. Therefore, the base of T1 (an NPN transistor) is at 0V and T1 is off meaning that the base of T2 (a PNP transistor) is pulled to 12V by R2 and T2 is therefore off. With T2 off, no current can flow to MIC5205 (a 5V linear regulator) and therefore PP_5V remains at 0V and the PIC remains off.
Now what happens when we close SW1? Doing so would connect the cathode of D1A to ground and pull the base of T2 low. Because T2 is a PNP transistor, this will make T2 conduct (turn on) and supply current through its emitter to the input of U2 (the voltage regulator) which in turn provides power to the PIC. If we were to let go of SW1 now, the base of T2 would once again be pulled up to 12V by R2 and the whole system would turn off. To prevent this, the PIC brings OFF_L to 5V which turns T1 on, shorting the base of T2 to ground through it’s collector. Therefore the device will stay on as long as the PIC holds OFF_L at 5V.
When the PIC decides to turn off (e.g. when the off/enter button is held or after a period of time), it simply pulls OFF_L to ground which turns off T1 and ultimately turns off T2 as the base of T2 is pulled to 12V once again by R2.
So what about this circuit allows SW1 to be used as an input to the PIC as well? D1A is key here. D1A allows SW1 to pull the base of T2 to ground (turning on the device), but does not allow T1 to pull the switch to ground if the switch is not already pressed. Meanwhile, D1B allows SW1 to pull ON/MENU_D_L (the PIC input) to ground when it is pressed but does not allow 12V to pass through D1A and into the PIC when the device is off which would permanently damage the chip.
As for the remaining components, D2 prevents the device being damaged if the battery is connected backwards while R11 and R7 create a potential divider to bring V_sense to between 5V and 0V so that the PIC can use an ADC to measure the battery voltage. The capacitors are just there to smooth the voltage rails.
I am thinking of fully reverse-engineering the whole LCR45 circuit as I think will likely have many more interesting circuits within it.