Cellular Modem Poweroff Detection

I’ve noticed that if attempt to use System.sleep(SLEEP_MODE_DEEP) while the cellular modem is on, the cellular modem doesn’t properly power off and continues consuming ~10mA. Based on that, I was hoping to find a way to figure out when the cellular modem has turned off after calling Cellular.off()

Options I’ve found so far:

  • Delay 40s
    • One solution is to delay a fixed amount of time that ensures the modem has time to turn off.
    • Annoyingly, while this usually takes just a few seconds, I’ve seen It take up to 30s or so, so the delay time would have to be around 40s to guarantee we don’t accidentally sleep with the modem still on
  • Spam commands to fill buffer
    • It appears that if you issue enough modem commands (e.g. call Cellular.off() 57 times in a row), you’ll eventually fill some internal buffers and cause Cellular.off() to block until the cellular modem has powered off, allowing the following routine to consistently sleep the Boron with the cellular modem off:
      for (int i = 0; i < 100; i++) { Cellular.off(); }
      System.sleep(SLEEP_MODE_DEEP);
      
    • This feels really bad, but it works very consistently on particle OS 1.4.4 and 1.5.0 (untested on other OS versions)

Based on this, I have a few questions:

  • Is there a way to sleep in a way that properly powers down the cellular modem?
  • If not, is there an official way to figure out whether the cellular modem is on or off?
  • If not, how likely is the second method above to break things or be broken by a future particle OS update?
2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.