Electrical – Low power switch input with MCU wake-from-sleep interrupt

dischargelow-powerpullupsleepswitches

Im trying to read the falling edge of digital logic input to wake up a microcontroller. Below is the circuit I have used. There is an RC filter to provide a ~5ms debounce time, and a 100K pullup so the circuit doesn't use lots of power while the switch is in its on-state. The switch may be in its on-state for roughly 10% of the circuit operation time.

schematic

simulate this circuit – Schematic created using CircuitLab

The problem with my circuit may seem obvious to some but I seem to have overlooked it; The input is pulled low quickly (discharges) just how i wanted it, but it is pulled high (charges) very very slowly due to the 100K pullup.

I don't want the circuit to take a long time to charge up (ideally <20ms) but I also don't want it to draw lots of current when the switch is in its on-state. Are there any engineering tricks i can employ to achieve these two things together? I assume its a classic problem but I cannot find any solutions.

Best Answer

Why are you using falling edge for interrupt at all? However small, you still have some current permanently flowing through the pull-up, which defeats the purpose of sleep mode. Plus the pull-up makes you RC filter lopsided.

Anyway, you have several options. First, you can use SPDT switch which will guarantee same timing for charge and discharge. See first schematics below (BTW, it works for either edge).

If you want to keep using rising edge and SPST switch you can

  • use two identical resistors, but shunt one of them with diode, resulting in almost the same rising and falling times (tweak one of the resistors to counter voltage drop on a diode, if you wish), and
  • recalculate your RC for high resistance and much smaller capacitance, to keep quiescent current low for the same time constant, e.g. 50k resistors and 0.1 µF capacitor.

enter image description here