High ping in South America?


Hello, I’m attempting to do a simple project with a NodeMCU and Blynk, i only need to read from the analog input and control a relay via digital o/p. However, after connecting it to my wifi (the nodeMCU and my phone are at less than a meter from my router), I get a brief moment where a simple test button to D4 actually toggles the 8266 LED, and after that split second it stops working even though the app says it’s working.

Ping is consistently above 200ms, and there’s a “heartbeat timeout” every once in a while:
[340456] Connecting to
[340889] Ready (ping: 202ms).
[486628] Heartbeat timeout

(i’d have copied the entire log, but this detects the links)

Is there any other suitable server? I’d like to avoid a local server if at all possible. I live in Argentina so I guess that’s the cause of the huge ping. Right now the nodeMCU is using blynk cloud 80. Thanks



You could also be running into issues with your code, or even your hardware that might be contributing the the heartbeat issue… which at approx 10 seconds, is not likely to be triggered by a ping rate such as yours.

And on that note, that is not a really bad ping for general use… but it could also be affected by local region, your ISP, your own equipment, temporary or not so temporary :stuck_out_tongue_winking_eye: net routing from “political” issues and so on.

There are three Cloud Servers so whatever one is for your region is the one you will automatically use.

Local Server may very well be your only option for faster signal… at least inside your own network. Any particular reason you do not want to go that route?



There’s literally no code, it’s only the example for nodeMCU as i was just testing if i could toggle the onboard LED for the first time. It might as well be my ISP for all I know. I’ll try different stuff tomorrow, maybe even another router i have lying around (highly doubt it’ll make a difference).

I want to avoid a local server because of frequent power outages around here. I’ll be away from home, so that’s why I’m making this monitoring thingamajig… Plus it’s not like I need perfect timing or w/e, i just need to be able to read a value and sometimes toggle a gpio pin that’s that. i need it to stay connected at least

Thanks for the quick reply



Then introduce some connection management code to allow Blynk (and or WiFi) reconnection as needed.

A router and RPi will use very little power, so UPS backups and even dedicated RPi battery/solar systems can potentially run a very long time.



@matias2k I have a similar problem, I live in China (although I’m British) and the ping value is typically 300ms and can be 2000ms+ at peak times. I am also using NodeMCU’s and I have found, thanks to @Gunner and @Costas, that some form of connection management is essential otherwise everything grinds to a halt.

The other thing suggested by @vshymanskyy is that in this situation you need to increase the BLYNK_TIMEOUT_MS value and decrease the BLYNK_HEARTBEAT value, the default timeout is 3000ms and I’ve increased it to 4500ms, the default heartbeat is 10 seconds and I’ve decreased it to 5 seconds. These values work good for me.

#define BLYNK_TIMEOUT_MS     4500UL                           // Blynk config default 3000UL

#define BLYNK_HEARTBEAT      5                               // Blynk config default 10

@Gunner has given you a suggested connection management routine but the one I’m using is from @Costas.

/* NoBlynkBlock.ino by Costas for
will recover from server or router going down   


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char ssid[]   = "xxx";
char pass[]   = "xxx";
char auth[]   = "xxx";
char server[] = "";

BlynkTimer timer;
unsigned int myServerTimeout  =  3500;  //  3.5s server connection timeout (SCT)
unsigned int myWiFiTimeout    =  3200;  //  3.2s WiFi connection timeout   (WCT)
unsigned int functionInterval =  7500;  //  7.5s function call frequency   (FCF)
unsigned int blynkInterval    = 25000;  // 25.0s check server frequency    (CSF)

void setup()
  if(WiFi.status() == 6){
    Serial.println("\tWiFi not connected yet.");
  timer.setInterval(functionInterval, myfunction);// run some function at intervals per functionInterval
  timer.setInterval(blynkInterval, checkBlynk);   // check connection to server per blynkInterval
  unsigned long startWiFi = millis();
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED){
    if(millis() > startWiFi + myWiFiTimeout){
      Serial.println("\tCheck the WiFi router. ");
  Blynk.config(auth, server);

void myfunction(){
  Serial.println("\tLook, no Blynk  block.");
  if(WiFi.status()== 3){
    Serial.println("\tWiFi still  connected.");
    Blynk.virtualWrite(V11, millis() / 1000);

void checkBlynk() {
  if (WiFi.status() == WL_CONNECTED)  
    unsigned long startConnecting = millis();    
      if(millis() > startConnecting + myServerTimeout){
        Serial.print("Unable to connect to server. ");
  if (WiFi.status() != 3) {
    Serial.print("\tNo WiFi. ");
  Serial.printf("\tChecking again in %is.\n", blynkInterval / 1000);

void loop()
  if (Blynk.connected()) {;};

I live in hope that one day Blynk will have a Cloud Server in China and the Great Firewall of China will no longer be a problem!

EDIT: If you use the above connection management routine from Costas and increase the BLYNK_TIMEOUT_MS to 4500UL then you will need to increase the myServerTimeout to 5000UL.




That’s nice, thanks for the code. I tried again this morning, and it works perfectly (ping 173ms, and it didn’t disconnect in an hour). Guess it’ll come down to having everything set up so that it reconnects properly.