Particle photon goes into "cloud not connected" or breathing green state on every reset or power outage

Hi, All.

I have tried to search for a solution here on the community and I have tried different solutions, but none of them seems to do the trick.

Every time I push the reset button on the photon device or power cycles it, it first connects to the wifi (breathing cyan) and then goes into a breathing green state where it does not connect to the cloud. The workaround is to put it in safe mode, reflash it via the particle build and then wait for it to boot up again. I hope this means that the very small piece of code I have put into it is working and not breaking it. I’m using 0.6.0 firmware.

> // This #include statement was automatically added by the Particle IDE.
> #include "blynk/blynk.h"
> char auth[] = "my_blynk_button_authentication_code";

> void setup() {
>     Serial.begin(9600);
>     Blynk.begin(auth);
>     pinMode(D0, OUTPUT);
>     Particle.connect(); //Probable solution or workaround found on community
> }

> void loop() {
>     if(System.updatesPending()) {
>         while(true) {
>             Particle.process(); // Probable solution or workaround found on community
>         }
>     }
> }

Does anyone have any thoughts about what the issue could be?

Thanks in advance.

// Thomas

Are you sure your Blynk auth string is valid? I think that Blynk.begin() blocks until it connects, which will never happen if the auth string is incorrect. Try putting a serial print statement right after Blynk.begin to see if the code ever reaches that point. If the problem is blocking code, you should be able to keep the device connected by using SYSTEM_THREAD(ENABLED), although your code still won’t work if it can’t startup Blynk.


Thanks for your reply Ric.

Well, the authentication string is correct, otherwise the code wouldn’t work after putting it into safe mode and reflash it. Since I’m not connected to the photon via USB I added some Spark.publish() instead and found out that it is indeed the Blynk.begin() portion that was failing, even though the authentication token is the same.

Nevertheless, I added SYSTEM_THREAD(ENABLED) as per your suggestion, and that actually solved the entire issue. It will now connect to the cloud and start the code (including Blynk) every time I reset the device or if it powercycles. If I remove the SYSTEM_THREAD(ENABLED) line, the problem reappears.

Does this make sense for you experienced developers out there, or could this be a “bug”?

// Thomas

@lefraas, the Blynk library may be starving the background process somewhere, preventing a proper OTA. With threading enabled, the system and user code run in their own threads, bypassing Blynk’s affect. :wink:

1 Like

Thank you very much for the clarification @peekay123 and for the solution @Ric :smile:

// Thomas

1 Like

I am always having the problem with this situation. I think it has something common with wifi signal or router, may be with internet connection as I deduce according to my experiments.

I have Photon application which publishes to the Blynk, Particle, and ThingSpeak clouds heavilly and has microcontroller’s hardware watchdogs and software reconnection procedure activated. At my flat it works without system threading reliably even at RSSI cca -65 dBm without reconnects to the Particle cloud or reboots, but at optical internet connection.

However, recently I took the Photon to my weekend house and without any change to the application and hardware the Photon started disconnecting from the cloud at the same wifi SSID and password even at -45 dBm with wifi repeater, but at LTE mobile internet connection. After switching the firmware to the system threading the Photon started working reliably.

1 Like