Photon losing Wifi

@DRCO , could it be a router issue?? I’m using an ASUS RT-AC56U with 5GHZ not enabled. You don’t happen to be using this model, do you? I hope I’m not speaking too soon, but I may have solved the problem for me by another iteration of the reconnect code, but also probably more importantly, I changed some of the stock settings on my router and now NO PROBLEM! Just sorry I have to throttle the router speed. @mdma Maybe we need a wiki for troubleshooting router settings for Particle devices.
Here’s the new reconnect code:

#include "application.h"
uint32_t lastTime;
volatile int lostconnectionTimeUnix = 0;

void setup(){
//Your normal setup code here
void loop() {
    if (!Spark.connected()) {  //record when photon lost connection
        lastTime = millis();
        while(millis() - lastTime < 500) {Spark.process();}            
        lastTime = millis();
        while(millis() - lastTime < 500) {Spark.process();}      
        lastTime = millis();              
        while( (!Spark.connected()) && (millis() - lastTime < 3000) ) {Spark.process(); }
        if(firstlostconnectionTimeUnix == 0) {firstlostconnectionTimeUnix =;}    
    }//if (!Spark.connected())
    if (Spark.connected()){
        lostconnectionTimeUnix = 0;

//normal loop code here

    }//if (Spark.connected())       

Here’s the settings I needed on my router:

Hope it helps.

1 Like