BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk thinks Photon is offline

Hi all,

I have a Particle Photon hooked up to my gate opener, controlled by the Blynk app on my smartphone. This has worked since August 2019.

This morning, I found that it no longer worked. The Blynk app is showing that my Photon is offline. However, I have confirmed that my Photon is connected to the Internet because I can signal it with the Particle app.

Additionally, I searched for other people with similar issues and have already tried the following to no avail:

  1. Reflashed my Photon to the latest Device OS
  2. Refreshed my Auth Token in the Blynk app and updated my Photon code with it
  3. Updated the Blynk library using the instructions here

I am at a loss and would greatly appreciate any help so I can open/close my gate with my smartphone again :frowning:

Thank you!

#include "blynk.h"
char auth[] = "MyAuthCodeHidden";


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(D0, OUTPUT);
  pinMode(D3, OUTPUT);
}

void loop()
{
    Blynk.run();    
}

It came back online last night, seemingly on its own accord. If anyone has any ideas as to why it went offline in the first place, I would greatly appreciate the insight so I can quickly fix it next time.

Is your Photon running AUTOMATIC, SEMI-AUTOMATIC or MANUAL?

I’m not sure - how can I check this?

You can add a connectivity check function like this

 if ( !Particle.connected() ) 
{
    Particle.connect();
} 

if ( !Blynk.connected() )
{
Blynk.connect();
}

https://docs.particle.io/reference/device-os/firmware/photon/#particle-connected-

Should I put this in the void loop() function, like so?

#include "blynk.h"
char auth[] = "MyAuthCodeHidden";


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(D0, OUTPUT);
  pinMode(D3, OUTPUT);
}

void loop()
{
  if (!Particle.connected())
  {
        Particle.connect();
  }
  if (!Blynk.connected())
  {
        Blynk.connect();
  }

    Blynk.run();    
}

For anyone else who is having similar problems, I ended up doing this, with suntop’s help. It’s too early to tell whether this will work, since it took me 7 months to get that error in the original post.

#include <blynk.h>

char auth[] = "MyAuthCodeHidden";
BlynkTimer checkConnection;

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);
  pinMode(D0, OUTPUT);
  pinMode(D3, OUTPUT);
  checkConnection.setInterval(30000, repairConnection);
}

void repairConnection()
{
    if (!Particle.connected())
    {
        Particle.connect();
    }
    if (!Blynk.connected())
    {
        Blynk.connect();
    }
}

void loop()
{
    Blynk.run();
    checkConnection.run();
}