Power consumption08 Oct 2017
tl;dr. Changes done to increase stand-by time, should be about one and a half year before the battery is drained now.
Upon measuring the power consumption behaviour in sleep-mode it looked like there were some room for improvements after changing the code to deal with the issue with the turn on time for the sensor.
In that implementation the behaviour was to wake from sleep, turn on the sensor, do nothing for about 100 ms, check the sensor and finally go back to sleep if no magnet is present. The power consumption during these 100 ms not spent sleeping had large impact on current draw. The average consumption at 3 V was 11.5 µA during one wake-check-sleep cycle.
Changing the code so the behaviour was, wake, activate sensor and then go back to sleep for 64 ms to make sure the sensor has time to be activated improved matters some but not much. On a hunch we tried removing the decoupling capacitor (100 nF) for the hall sensor, removing this had a huge impact. It seems that during each cycle the capacitor was charged and discharged wasting power.
Removing the capacitor didn’t seem to affect stability. That change together with putting the MCU in sleep instead of just waiting brought the stand-by power consumption down to about 1.5 µA!
Also, see the Sample gallery for new images!