Author Topic: Pulse interval  (Read 516 times)

Neko

  • Newbie
  • *
  • Posts: 34
  • Country: us
Pulse interval
« on: March 24, 2017, 12:10:28 AM »
There was a nice thread 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?
« Last Edit: March 24, 2017, 12:24:30 AM by Neko »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6023
  • Country: us
    • LowPowerLab
Re: Pulse interval
« Reply #1 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.