jenswilly.dk


Self-shutdown and any-key power-up

I need the Thermometer's MCU to be able to switch itself off to save battery power. And I also need to be able to power up the device by pressing any of the buttons. At the same time, of course, I need to be able to distinguish which button has been pressed.

I am using a MAX1796 PMIC which has a SHDN pin that turns off the device when high. Note that many PMIC's have a shutdown feature that doesn't disconnect the output pin from the input pin when shut down, but which simply disables the voltage regulation. I need a PMIC with what in the datasheets is called "true disconnect" (the MAX1796 has that. An example of a PMIC that doesn't is the MAX1724 which I first planned on using but rejected for this reason.)

Self-shutdown

Inspired by this post on electronics.stackexchange.com, I designed this basic circuit to switch off the PMIC from the MCU and to switch it on from a push button. (I have not taken into account the delay from the user pressing the button to the MCU starting up and taking over control of the PMIC so if the user lets go of the button before the MCU is ready, power will turn off again):

Basic circuit

Basic circuit

  • Normally, the SHDN pin is pulled up and the PMIC is off.
  • When pressing the push button, SHDN gets grounded and the PMIC turns on.
  • The MCU will on start-up configure a GPIO pin as low and thus the SHDN pin is grounded to allow the PMIC to remain on.
  • When switching itself off, the MCU sets the GPIO pin high and the PMIC turns off.

NOTE: many PMIC's has a #SHDN pin which shuts down the PMIC when low and not high like the MAX1796.

Any-key power-up

I would like the device to turn on when the user presses any button (as opposed to a dedicated "power-on" button).

The buttons work as inputs that are pulled high so a HIGH value means the button is not pressed and a LOW value means the button is pressed.

But, of course, I can't just connect the switches like this:

Push buttons tied together

Push buttons tied together

Because the MCU would then be unable to distinguish which button has been pressed since they are all tied together.

Diodes to the rescue! Adding diodes like this will fix it:

With diodes

With diodes

This way, pressing switch doesn't affect the voltage at the other GPIO pins. But: a normal diode has a voltage drop of about 0.7 V. This means that the voltage at the SHDN pin will be 0.7 V when pressing a switch. To check if this is low enough to be considered "low" some perusing of the datasheet is necessary and reveals the following:

Parameter Symbol Min Max Units
SHDN Input Voltage VIL 0.2 ✕ VBATT V

And is we assume that VBATT is at max. 3.3 V, we get 0.66 V for the maximum allowed LOW voltage. In other words: a voltage of 0.7 V will not be interpreted as LOW.

But if we use a Schottky diode (like the trusty ZLLS1000) with a voltage drop of about 0.4 V, everything will be fine.

At least that's the theory. We'll see how it works out in real life…

Leave a Reply