Photon losing connection from time to time

One of my photons is intermittently losing wifi/cloud connection, going from breathing cyan to solid.

After about 30 minutes of data not being received from my photon I get an alert at which time I go outside to unplug it and plug it back in. It reestablishes just fine then a day or two later needs cycling.

Could I test connection in code and kick off a system reset when it loses cloud connection? Like this…

 if (Particle.connected()=="false") {

I’m guessing that it is losing Wifi because it’s on the edge of my wifi range.

Thank you for your advise.

This works well for me so far:

Thank you for the suggestion. Is your approach easier on the Photon than doing a system reset? I’d just like to learn why one method is preferred. Thanks again!

You won’t get to reset the Photon physically in a remote location ya :smile:

I use it on my devices to ensure they always get on Wifi and soft reset the wifi module if it doesn’t after some time. With this, I am certain my device is constantly trying to get connected and any failure to do so is most probably related to a broken router or there’s no internet connection.

@kennethlimcp, I’m totally following you on the need to reset via code, but I was proposing this code solution. Would love to know the difference between the two approaches.

Opps my bad :smiley:

My device continue to process and run task while attempting to connect to Wifi periodically.

For a system reset, your device will reboot and start as though it just power up. There are cases that you would not want to do that. eg. while running a motor halfway.

A solid cyan indicates that the device has hung. Are you using I2C? There is an issue in 0.4.7 that will be resolved in 0.4.8 this week.

1 Like

@kennethlimcp @mdma, Yes, I am using I2c. Thanks for the heads up.

Kenneth, Thank you very much for the explanation. That makes complete sense. Appreciate you taking the time to educate. My loop puts the Photon into Deep Sleep so I needed to add Wifi connect and Particle.Connect into setup. With that minor mod your code is working great.

Thanks again!!!


1 Like

I have a few questions regarding this:

– I lose connection from time to time as well. Goes from Breathing Cyan to Flashing green. Most times, its able to connect back to the Particle Cloud but what are the reasons it loses connection in the first place?

– How long does the Photon try the Wifi Connection before it resets the Wifi Module again to retry?

– What is the average time it has taken to connect to the Particle cloud based on the data from testing?

I have two Photons that go from breathing cyan to rapidly blinking green, or solid green. A reset or power cycle brings them right back and connected. They have been doing this since I first deployed them. I am hoping that newer firmware due soon will fix this very annoying issue. Sorry I can’t offer a solution, but thought you would want to know you aren’t alone.

1 Like

There are several possible reasons.
If this happens rather often it’s usually related to application code blocking for 10+ seconds starving the cloud houskeeping tasks.
If it’s regularely with hours in between, it could be your routers IP lease time running out causing a release.
If it’s sporadic an irregular it might be noisy WiFi neighbourhood, noisy power supply, or several other reasons.