Checking Sensors every 10 seconds then sending update every 6 minutes

I assume that LoRaWAN.cycle(txDutyCycleTime) will override the TimerStart( &wakeUp ) function?

My goal here is to wake the board up every 10 (or used defined seconds) to check the sensor values. If they are within the set range then just go back to sleep.
If the readings are above the set range then transmit the details.
Or ever 6 (or user defined seconds) have elapsed then just transmit the current sensor values.

Initially I thought i would be smart and just use the TimerStart( &wakeUp ) function to trigger a read then keep the state machine for the LoRa side as it is but I seem to be getting some really strange results with this so I am assuming that TimerStart is overwriting the LoRaWAN.cycle.

I did think about just using LoRaWAN.cycle and adjusting the time on that however that seems to wake up the radio and I think does a join every time its run.

Any thoughts or suggestions as to how better to deal with this without having to wake the radio up?

I guess maybe dumping the LoRaWAN.cycle then manually setting "deviceState " could be an option however that will require the transmission times to be divisible by the sensor read times.

B

This is my humble opinion. If there is an error, I still hope to correct it.
Uploading: image.png…

1 Like

Thanks @Quency-D i will try that and if it works post some code.

FYI If you’re measuring time over deep sleep’s then you’ll find that millis() doesn’t work (non-zero, but also not sensible) and there’s no other time reference.

TimerGetCurrentTime() is what you want, although counting activations is just as good.

I don’t believe the radio wakes up until you call Send, so skipping the send until 60 10s wakeups has passed should be fine, as @Quency-D suggests (nice work!). I think @Quency-D meant 10 seconds rather than to wake every 1ms though, minor typo.

1 Like