LowPowerLab Forum

Hardware support => Low Power Techniques => Topic started by: Neko on March 24, 2017, 12:10:28 AM

Title: Pulse interval
Post by: Neko on March 24, 2017, 12:10:28 AM
There was a nice thread (https://lowpowerlab.com/forum/low-power-techniques/low-power-counter/) about counting a few months ago, using IRQ's to detect the pulses, and lowpower.powerDown in between.

I have an additional wrinkle, however. I want to know the time between counts.

Let's say an IRQ has occurred, I count it and go back to sleep for some period (for example, powerDown (SLEEP_1S)). If the next IRQ occurs during SLEEP, isn't sleep then terminated early? And since the millis() timer seems to be off during SLEEP, how do I tell how long it has been since the last IRQ?
Title: Re: Pulse interval
Post by: Felix on March 24, 2017, 07:48:22 AM
You need an external reference like an RTC or a good crystal, no other way.
You could use the RFM69 crystal and LISTEN_MODE to wake up, that saves power and is more precise, some guys have made that work in this forum. But I don't know how you'd count the elapsed time with that method either. You just need a reference I guess, maybe others have some novel ideas.