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

Sparkfun EPS32 The Thing Board connection problems


#1

I’m having a problem with blynk on a Saprkfun ESP32 The Thing Board. The problem is that after uploading the code everything works fine, but for some reason, after some time (it could be hours or minutes…) the device goes offline and I need to unplug it from the power source and plug it back in order for blynk to run again. I have never had the device online for more than a few hours…

I have already tried to different for loops, the simple on with just Blynk.run() command an a more complex one that checks if bool Blynk.connected is true or false. If it’s true it simply does Blynk.run otherwise it does Blynk.connect.

My code right now is:

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

bool isConnected;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "My token is here";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wifi SSID";
char pass[] = "Wifi Password.";

void setup()
{
  Serial.begin(9600);
  pinMode(5,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(14,OUTPUT);
  pinMode(27,OUTPUT);
  digitalWrite(5,LOW);
  digitalWrite(13,LOW);
  digitalWrite(12,LOW);
  digitalWrite(14,HIGH);
  digitalWrite(27,LOW);
  Blynk.begin(auth, ssid, pass);
  
}

void loop()
{
  isConnected = Blynk.connected();
  if (isConnected){
    Blynk.run();    
  }
  else{
    Blynk.connect();
  }

  
}

#2

Hello.

Single Blynk.run(); should do the work. Did you try it?

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

#3

Thanks for the reply but I have already tried that as I said in my question.


#4

As the timeframe is so varied, I would look at local environmental issues; week WiFi (or device antenna is just not good enough), RF interference, power fluctuations, etc.


#5

I don’t think that is the problem because the wifi the ESP is connected to is always ok and always online…

Wait can I do to debug the problem?


#6

i didn’t mean the WiFi being faulty as much as the device having the weakness issue, as in this users case: (RESOLVED) Difference between Wemos D1 mini and mini pro

troubleshooting options… perhaps monitor RSSI & ping times within script (if possible) and moving device closer to WiFi source.


#7

I’d just like to drop this, it could be a router issue. From personal experience, I have two routers that work flawlessly with all phones and laptops etc.

Then I have this Chinese Wifi IP camera that on my Asus router drops connection and refuses to reconnect, at random times. But works without issue on my netgear that is an older model.

It would be good if you tried on another router.


#8

Try it: