Sleep mode - counter during sleep


I have read somewhere that some microcontrollers have a sleep mode that allows them to count events, such as interrupts, without being fully awake. Does the Photon have this feature?

For example, if I have a rain gauge that uses a ‘tipping cup’, where the weight of a certain volume of water causes the cup to tip and empty, in the process triggering a switch, it would be nice to be able to count the pulses while in sleep mode, and only wake up every 15 minutes or so to get the count and send it.


Any solution?


I’m pretty sure the Photon would have to fully wake in order to capture interrupts. And considering that the sleep modes only wake with the WKP pin, the tipping cup would specifically have to be hooked up to that pin. The next best viable option would be to use an external 4 or 8 bit counter. Hook the tipping cup up to the counter, the photon would wake periodically to retrieve the counter value, publish values, reset the counter and go back to sleep. Look for a counter with a reset pin. There have been other threads on here but usually discussing how to track wind speed (anemometer) interrupts. I believe @peekay123 has suggested a suitable counter chip on one of those threads. The number of bits required could be estimated by forecasting the maximum rain fall during your sleep periods and then calculating the number of “tips” that would occur during that period.

Here’s one thread:

LPTIM Timer- Counter on Sleep for Rain Gauge

Sleep modes - plural?
Deep sleep (aka Standby sleep) and its different flavours is hard wired to WKP. However, Stop Mode sleep does allow other - even multiple - pins.

This discussion should be continued on the new tread

closed #5