Count events with Interrupt during Deep Sleep and LoRaWan


the goal is to count events with the interrupt (GPIO) during DeepSleep (wake up with an Interrupt) and to send the result every 24 hours (wake up per timer) via LoRaWAN.

First question: How can i store date and read it after DeepSleep and WakeUp.

Are there special registers that do not lose the information during DeepSleep, which I can then use for storing.

Wake up per Interrupt should be possible done wit this Code:

attachInterrupt(ACC_INT_PIN, accelWakeup, RISING);

count = count +1;

Go in DeepSleep

Greetings E_T

As far as I know, all registers/memory retain values during sleep.

Yes it should so!

Thank you

I’m trying to do this with a tipping bucket rain gauge.

For some reason I get 3 counts for every tip?

Do I need to debounce? Although it is 3 every time.

I also noticed that either sending or waking up from sleep also adds a count to the tally

hatd to say without knowing your code

yep sorry - was using GPIO7 and realised that’s linked to the user button, changing pins and retrying now

There is a great example of this over here created by @memo5

I’m doing something similar too, currently testing stability of the system, I’m not sure whether memo5 was able to fix their issue of the board hanging after a few days. My next thing I’m trying to figure out is do I have the counter reset every 24h on the board or continuously divide the amount of pulses / days through the back-end.

No, I was not able to fix it until now. If someone is testing my code and do not have any problems I would be happy to get an answer because that it might be a problem on my board.