Blue screen/breath of death

Hi guys.

I am using a Photon. Second batch. Out of the little box, left for 30mins to update.

I am using the local network to post and get some values off a local server. All works wonderful.
When everything works well, I get a breathing green light and posts to my lan every second.

But when I try to test the WiFi robustness by rebooting the router or switching the Wifi off and on again, I sometimes get a BREATHING BLUE LIGHT, at which point all code stops executing. It is unreachable, no serial debugging output or any network activity.

I understand that the breathing blue light indicates no network available, but there is no coming back from it.
I have tried the forum and there are a few posts, but none which seem to be of any help to me.

I am looking at a solid HTTPClient implementation which will not die on me.

My code:

#include "OneWire/OneWire.h"
#include "HttpClient/HttpClient.h"
#include "LiquidCrystal_I2C_Spark/LiquidCrystal_I2C_Spark.h"
#include "SparkJson/SparkJson.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"

//General device settings
String deviceName = "Photon7";

//Probes - OneWire
int TempSensorPin = 2; 
OneWire oneWire(TempSensorPin);
DallasTemperature sensors(&oneWire);
float  lastGoodTemp = 0;

//LCD variables 
LiquidCrystal_I2C *lcd;

//HTTPCLient variables used
String serverResponse = "";
HttpClient http;
http_header_t headers[] = {
    //  { "Content-Type", "application/json" },
    //  { "Accept" , "application/json" },
    { "Accept" , "*/*"},
    { NULL, NULL } // NOTE: Always terminate headers will NULL
http_request_t request;
http_response_t response;

String ServerPinValue1 = "0";
String ServerPinValue2 = "0";
String ServerPinValue3 = "0";
String ServerPinValue4 = "0";

//Debug variables
String wifiStatus = "";
int    signalStrength = 0;
int    serverResponseStatus = 0;

void setup() {
    pinMode(D2, INPUT);  // OneWire bus


void loop() {
    Serial.println("---------------Beginning of loop-----------------");
    Serial.println("---------------End of loop-----------------");

void readSensors(){
    float tempC = sensors.getTempCByIndex(0); 
            lastGoodTemp = tempC;

void talkToServer(){
        request.hostname = "";
        request.port = 80;
        request.path = "/PostDataAndRequestInstructions.aspx?id:" + deviceName + "|pindata:1001|temp:" + String(lastGoodTemp) + "|SignalStrength:" + String(signalStrength);
        http.get(request, response, headers);
        serverResponseStatus = response.status;
            //Parse server returned string and get the new pin values
            ServerPinValue1 = serverResponse.substring(60, 61);
            ServerPinValue2 = serverResponse.substring(61, 62);
            ServerPinValue3 = serverResponse.substring(62, 63);
            ServerPinValue4 = serverResponse.substring(63, 64);
            Serial.println("good response from server");
            Serial.println("BAD response from server");
            Serial.println("Wifi not ready yet");

void debug(){
    if(WiFi.connecting()){ wifiStatus="connecting"; }
    if(WiFi.ready()){ wifiStatus="ready";}
    if(WiFi.listening()){ wifiStatus="listening";}
    Serial.println("wifi           :" + wifiStatus);
    Serial.println("lastGoodTemp   :" + String(lastGoodTemp));
    Serial.println("LocalValue1    :" + ServerPinValue1;
    Serial.println("LocalValue2    :" + ServerPinValue2;
    Serial.println("LocalValue3    :" + ServerPinValue3;
    Serial.println("LocalValue4    :" + ServerPinValue4;
    Serial.println("signalStrength :" + String(signalStrength));
    Serial.println("response status:" + String(serverResponseStatus));

I don’t know that color code - could it be breathing cyan or breathing white?
Could you post a video of that?

I can’t see any WiFi.connect() outside of setup(), could you add one in here

            Serial.println("Wifi not ready yet");
1 Like

Hi ScruffR

The color code/mode is like this:
It is breathing blue, which indicates “WI-FI MODULE NOT CONNECTED”

I will try, but I have not seen any serial debug output once this happens, which makes me wonder if the loop is still executed in this state.


I see, I wonder how long that’s there already :blush:

I didn’t know about breathing blue either. If neither ScruffR nor I knew about it, it must be pretty obscure! LOL


I seem to always have a different angle of logic. I always find the obscure ones :cold_sweat:

We’ll stand by your side :sunglasses: :wink:


I’ve added the WiFi.connect() and done another test.

Initially it runs fine. I then disable the WiFi on the router and it goes to breathing blue.
The debug output stops, nothing is running on the user code.

After enabling the wifi, it continues blue. It does not reconnect or anything.

It is now just shining that blue light at me. In a very “I dont care what you want, I am chilling” way.

It should reconnect. What version of firmware are you running?

It doesn’t look like you need to use SEMI_AUTOMATIC mode. Possible try commenting that out along with the WiFi.connect() calls as a test.

You can also give this a try if you suspect your loop() is not running:

It’s possible one of your sensors is blocking and causing an infinite wait.

1 Like

System version: 0.5.2

I tried to use SEMI_AUTOMATIC because there is not need for particle cloud. Also, I seem to get disconnected from the cloud when I do local calls. This is random and not a big issue, but I thought I’d stick to local only.

But, I did what you suggested and removed the line. It works better and it does in fact reconnect eventually (quite a long wait) to the lan/cloud.

I then took it a step further and used Particle.disconnect(); to disconnect from the cloud in setup.
This works fine, but as soon as I disabled the wifi on the router it went back to being stuck on breathing blue.

I am now testing ApplicationWatchdog and it would probably help to some degree. I would still think that this should not be a problem for the Photon to reconnect when the wifi comes back on.

Also, I will remove all sensors and code. I only have one (one-wire) temp sensor connected.

It looks like good news. Including the ApplicationWatchdog seems to make it more aware and it looks like it is recovering from the disconnected state. It does not have to time out to work. Just the mere inclusions seems to alter the response of the code.
This was before I disconnected anything… so this might be the solution to my problem.

Much appreciated.

Ok that makes sense.

Interesting, thanks for testing all of this. I’m still curious if the Photon won’t reconnect to Wi-Fi after cycling the router is power cycled when in SEMI_AUTOMATIC mode, so I’ll put that on my list of things to verify.

You could also add a few serial logging statements to your code and try to figure out where it’s getting stuck, if that’s what’s happening. It could be getting blocked by some weird case in the system thread (that’s what I want to look into).

@oks, @BDub, there is proposed code in the forum somewhere that will attempt to reconnect WiFi when it has been disconnected. I believe in SEMI_AUTOMATIC mode, the user code needs to do the reconnection.