Photon not waking up from SLEEP_MODE_DEEP after several hours [Solved]

I’ve got some code that’s attempting to check a moisture sensor, post the resuts to ThingSpeak, and go into SLEEP_MODE_DEEP for 60 seconds. That works great initially, but after several hours, the Photon just stops responding/posting.

Here’s my code - pretty simple.

#include "ThingSpeak/ThingSpeak.h"

TCPClient client;

int sensorPin = A0;    // set the input pin for the moisture sensor

void setup() {

void loop() {
   int sensorValue = 0;

   Serial.println("Reading sensor value...");
   sensorValue = analogRead(sensorPin);
   Serial.println("Attempting to publish a reading...");

   ThingSpeak.writeFields(MYCHANNEL, "APIKEY");
   //go into deep sleep for 60 seconds
   System.sleep(SLEEP_MODE_DEEP, 60);

I’ve searched the forum, but I couldn’t find anything that wasn’t pertaining to an old firmware. I’m building with firmware 0.5.2.

Can anyone point me in the right direction as far as troubleshooting? Unfortunately, the device is remote, so troubleshooting is pretty brutal (raises hand for deferred OTA updates, please! :smiley: ). Any help would be very much appreciated.

Hey @mdma are you able to help them with this?

Does the Photon still wake up, but only fails to send your data to ThingSpeak?

1 Like

Yes. That’s actually what happens now that I dig into it a little further. It might just be a mqtt timeout issue and not a Photon issue. My bad. :frowning: