Waking up photon without an interrupt

I am creating a photon based garden watering system with soil moisture sensors (hopefully adding PH sensors too) and a 12V water pump. I am wanting to check the soil moisture content twice a day and trigger the pump accordingly. I am running this “off the grid” with a solar charging system and battery and need to conserve as much power as possible and limit the amount of time that the moisture sensor experiences current flow to reduce oxidation. I cannot figure out a way to wake up the photon on a schedule of twice a day without an interrupt. Any help is appreciated, I am new to the C++ style of code.

@jonmlewis, take a look at the Photon sleep modes, specifically the DEEP SLEEP mode:

https://docs.particle.io/reference/firmware/photon/#sleep-sleep-

The Photon has an onboard RTC (optionally battery backed) which can keep track of time but it does drift. When you connect to the Particle cloud, it resyncs itself but since you are running off the grid, this will not be possible. You may want to consider a more accurate, low drift I2C RTC to provide an accurate time source. The rest is all in how you calculate the number of seconds to DEEP SLEEP so you wake at the desired times. :wink:

2 Likes

When you say “off the grid”, does that include the Internet? Are you connecting to the Particle cloud when the device is awake?

Using this method of just using a number of seconds between each wakeup and the drift of the timer would eventually result in an error and a drift in the time of day when the photon does wakeup, correct? Is there a way to use the actual cloud time to schedule wakeups? If so could you provide a brief example of it please?

Thank You

If you have cloud time you can sync the RTC on each wake and the drift per day is not that extreme :wink:
The unpredictable reconnection time would impact timing a lot more than the RTC drift IMHO.