MCU with ultra low energy gpio input

Use a second DIO to control the pull-up voltage. The output is normally low. Set it high momentarily, read the DIO input, set the output low.

schematic

simulate this circuit – Schematic created using CircuitLab


Use 2 GPIOs (we'll call them GPIO 1 and 2) to monitor the switch, and test for switch closure by checking for continuity.

This works as follows:

  • Wake up the CPU
  • set GPIO 1 high, check GPIO 2 state
  • set GPIO 1 low, check GPIO 2 state

If GPIO2 followed GPIO1, then the switch was closed. If not, no.

This improves on pull-up or pull-down since there's no energy wasted even while the polling is happening.