Photon Freezes after running for a few hours/days

I’m using a Photon to run a weather station. I’ve stripped the my sketch down to read an Adafruit SHT31 and report to Blynk.

Power is supplied via USB or 2W solar panel through DFRobot solar charger and 44000mhA battery from Adafruit.

My photon will run for a few hours or a couple days and then something happens and it get stuck with a solid white LED (might be stuck in solid cyan, its outside in bright light and hard to see.)

I can reset, it goes through reset process and runs just fine for a while but crashes again.

I can’t figure out why it is not stable.

//Libraries ===================================================================
#include "Adafruit_SHT31.h" // include the SHT31 library from adafruit
#include "Wire.h"
#include "blynk.h"
#define DEBUG 1  // 1 debug on, 0 debug off

//Global constants ============================================================
const int samp_interval = 10;           // sampling/measurement interval in seconds, unique
const int stor_interval = 2;           // averaging/storage interval in minutes, unique

//blynk ========================================================================
char auth[] = "AUTH CODE";

//SHT31 - Temererature, Humidity, Dewpoint ====================================

Adafruit_SHT31 sht31 = Adafruit_SHT31();  // create SHT31 instance
float h;                  // humidity, %
float t;                  // air temperature, C
float d;                  // calculated dewpoint temperature, C
float Tdew(float Tair, float Rh)
  float X=log(Rh/100)+((17.27*Tair)/(237.3+Tair));
  float dp =(237.3*X)/(17.27-X);
  return dp;
// battery volts ==============================================================
float batt;

//SETUP --------------------------------------------------------------------------------------------------------
void setup()
  Serial.begin(115200); // start serial port; //set time zone to MST

   // start SHT31 T/RH sensor
   if (! sht31.begin(0x44)) {      //  0x44 for adafruit
   //  digitalWrite(redLED, LOW);  // turn  red on
     while (1) delay(1);

  Serial.println("setup complete");

//MAIN LOOP ----------------------------------------------------------------------------------------------------
void loop()

    h=sht31.readHumidity();                    // measure humidity
    t=sht31.readTemperature();                 // measure temp
    d=Tdew(t,h);                               // calc dewpoint with subroutine
    batt = (analogRead(A0)/1023.0*0.893/0.909); // measure battery with 100M/100K volt divider
    int  wifi = WiFi.RSSI();

        #ifdef DEBUG                               // print results during debug
        Serial.println("temp \t hum \t dwpt\t");
        //Send Data to Blynk =======================
        Blynk.virtualWrite(V1, t);
        Blynk.virtualWrite(V2, h);
        Blynk.virtualWrite(V3, d);
        Blynk.virtualWrite(V4, batt);
        Blynk.virtualWrite(V5, wifi);


I’m going to guess it’s because your battery is getting to low.

Check the battery voltage when you start seeing the white LED indicator.

I know it is not the battery voltage. I’m monitoring the battery voltage and it is constant. I’m monitoring via 1M/100K voltage divider connected to A0 and calibrated using voltmeter in my Mad Scientist Lab.

WiFi signal is also consistent. See code – WiFi.RSSI();

It froze a couple minutes ago and I went out to reset it.

Project is wired up on a bread board the weather station.

-Anemomenter (connected to digital pins with 4k pullups)
-Tipping bucket rain guage (connected to digital pins with 4k pullups)
-Soil moisture/temperature sensors (I2C w/ 4k pullups)
-Temp/RH (I2C w/ 4k pullups)

Anemometer seems to be the wink link. When I bumped the wiring the photon reset: flashing green then frozen cyan.

Pulling out the anemometer connection it reset again and started working again…

So now I think hardware/wiring.

What about the reed switch in the anemometer would cause the photon to reset and get stuck?

*****I restricted the code to the SHT31/WiFi and Battery voltage eliminating interrupts and ton of other code.

Could a loose connection cause this?

If you checked it then we can say it’s not the battery then.

I also have a SHT31 sensor along with a CCS811 on a breadboard with a Photon and I’ve seen the Photon go to breathing green sometimes which requires a reset. It’s weak wiring on the breadboard along with cold temps that are causing problems because 99% of the time there are no issues. I’ve noticed that the i2c communication between the sensor reads causes the sketch to freeze up and stop working.

Play with your wiring and see if that fixes it. Breadboards are notorious for weak connections and causing issues like this.

@Mister, I just did a Project using Blynk to help a friend’s son. What I noticed when I used the particle code within the project was that after a short while the photon LED turned white as well. I solved the issue in this instance by insertingParticle.process(); within the loop () because what was happening was that the loop was writing to LEDs and potentially taking >5 seconds and thus losing the cloud connection. I can’t see this type of situation in you code unless the . Have you tried adding at the startSYSTEM_MODE(AUTOMATIC); andSYSTEM_THREAD(ENABLED); ?

1 Like


Soldered everything to a proto board. Has been running for 24hrs with no problems. I’m thinking connection of the anemometer was creating the problem?

Fingers crossed.

Armor: I have not tried adding either of those.

I’ve been assuming my photon is in Automatic mode.

When using Blynk you need to avoid virtual writes in the loop. You are overloading the Blynk server. Use timers instead.
Go to and for more info.