werl-mie / rainwater-harvesting-sensor

0 stars 0 forks source link

Create MWE of a 'continuous monitoring timeout' #5

Closed eren-rudy closed 1 year ago

eren-rudy commented 1 year ago

When a pseudo-continuous data source (rainfall sensor) stops triggering for some amount of time, log data (in this case can just do Serial for demonstration purposes).

eren-rudy commented 1 year ago

Was able to implement easily using this convenient arduino-timer library.

eren-rudy commented 1 year ago

I just realized that this is useless because it relies on the microprocessor running (calling timer.tick() continuous is necessary for the timer to work...)

eren-rudy commented 1 year ago

I've also tried using a hardware timer library (TimerInterrupt_Generic), which utilizes the Timer/Counter (TC) peripheral on the SAM-D21 chip.

However, after trying all of the selectable timer instances, it seems that their clock source by default turns off when the chip is in standby. In principle, there is apparently a workaround for this:

image

Source: SAM_D1 Datasheet

However, I am slightly concerned about the ease of implementing this in practice, particularly the interrupt configurations (since the Arduino Low Power library doesn't have an interface for setting 'internal' interrupt sources...).

Next promising avenue might be the RTCZero Library, which -- after running the examples -- thankfully seems to support the Feather M0.

eren-rudy commented 1 year ago

Was able to get this working. See MWE_EventTimeoutWithInternalRTC