# How do you design a switch input to a MCU for ultra low power consumption?

I'm trying to build a low power door monitoring switch. I'm using an MSP430FR2311 with the below circuit. The switch is a SPST reed switch and there is an internal pull-down resistor on pin P1.0 of the MCU.

When the switch is open power consumption is 1 uA but when the switch is in the closed state consumption is 100 uA. I want to be able to run this on a small battery for years at a time. Is there a circuit that will get me low power consumption in both the open and closed states of the switch?

simulate this circuit – Schematic created using CircuitLab

## 2 Answers

The internal pulldown has 20–50 kΩ, typically 30kΩ, which limits your choice of resistor to pull the input up.

Fortunately, you can turn the internal pulldown resistor off, which is also the configuration used to measure the minimal leakage current reported in the datasheet.

simulate this circuit – Schematic created using CircuitLab

The datasheet suggests a leakage current of 30nA at 3V, so the internal resistance is on the order of 100MΩ. Whether you put an extra resistor in-line here does not affect the leakage current by much, so it can in principle be left out entirely if the inductance of the connection from the switch to the IC is low enough that the voltage won't overshoot.

• Thanks, that makes sense. So, do I pretty much need to use a SPDT style switch to achieve this? I only ask because the existing switches epoxied into the door in question are SPST. – Pete Jul 9 '17 at 2:49
• A SPST needs a pull-up or pull-down resistor somewhere, which means that you are forming a voltage divider when the switch is closed. The absolute values of these resistors can be in the MOhm range, but need to be small enough so the pull-down is strong enough to give a clear 0 against the internal resistance (so ~5–10MΩ), and the resistor in line with the switch needs to be small enough to pull that to a clear 1 (so (250kΩ-1MΩ). With 11MΩ resistance from +3V through the switch and the resistors to ground, you have 272nA leakage current when the switch is closed — more than 20–50nA. – Simon Richter Jul 9 '17 at 14:39

Turning the internal pull-up (or in your case, pull-down) resistor off is indeed a way to minimize the power consumption when a switch remains asserted against that resistor.

However, by itself that is unlikely to be workable.

What you need to do is turn off the resistor, then put the MCU to sleep with a scheduled wakeup interval at which you will wake up, briefly re-enable the resistor, and check to see if the switch is still closed. If it's still closed, disable the pulling resistor and go back to sleep for a while before checking again.

You may also want to use an extremely high value external resistor to bias the pin in the unconnected case, since a floating input could otherwise end up near the logic threshold voltage, and cause a degree of shoot-through of the upper and lower input transistors, leading to excessive current draw.

• Shoot-through shouldn't be a problem with Schmitt trigger inputs as MCUs typically have. – Kevin Reid Jul 9 '17 at 4:30
• @KevinReid Schmitt-trigger inputs still have shoot-through currents; they are just designed to be able to endure them. – CL. Jul 9 '17 at 12:09