Heartbeat time out issues

I had been successfully running(24/7)/developing a project for about 3 weeks with no “Heart Beat” issues. Typical sketch with several virtual pins, a coupla sensors, nothing exotic. Out of the blue I began getting “Heart Beat Timeouts”. Tried everything I could think of including different ESP8266’s and 2 different ESP32’s. Ended up stripping everything out of the sketch except what you see below (Added lines 2 and 3) . Nothing has made a difference. Usually get the error apx every 3-5 minutes. (Serial Monitor output after the code).

#define BLYNK_PRINT Serial
#define BLYNK_HEARTBEAT      20
#define BLYNK_TIMEOUT_MS     3000UL

#include <BlynkSimpleEsp32.h>
char auth[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
char ssid[] = "bbbbbbbbbbbbbbbb";
char pass[] = "ccccccccccc";
BlynkTimer timer;
void myTimerEvent() { Serial.println("Timer fired."); }     

void setup()
 {
  Serial.begin(115200);
  Serial.println("Fire this baby up! "); 
  Blynk.begin(auth, ssid, pass); 
  timer.setInterval(1000L, myTimerEvent);
 }
void loop()
{
 Blynk.run();
 timer.run(); // Initiates BlynkTimer
}

14:02:36.297 → Fire this baby up!
14:02:36.297 → [26] Connecting to XXXXXXXXXXX
14:02:36.953 → [666] Connected to WiFi
14:02:36.953 → [666] XXXXXXXXXX
14:02:37.000 → [666]
14:02:37.000 → ___ __ __
14:02:37.000 → / _ )/ /_ _____ / /__
14:02:37.047 → / _ / / // / _ / '/
14:02:37.094 → /
//_, /////_
14:02:37.094 → /
__/ v0.6.1 on ESP32
14:02:37.141 →
14:02:37.141 → [737] Connecting to blynk-cloud.com:80
14:02:37.841 → [1568] Ready (ping: 296ms).
14:02:38.915 → Timer fired.

14:07:47.044 → [310773] Heartbeat timeout
14:07:47.887 → Timer fired.
14:07:48.920 → Timer fired.
14:07:49.906 → Timer fired.
14:07:50.890 → Timer fired.
14:07:51.922 → Timer fired.
14:07:51.922 → [315669] Connecting to blynk-cloud.com:80
14:07:52.203 → [315929] Ready (ping: 102ms).

14:13:43.072 → [666772] Heartbeat timeout
14:13:43.898 → Timer fired.
14:13:44.913 → Timer fired.
14:13:45.937 → Timer fired.
14:13:46.311 → [670034] Connecting to blynk-cloud.com:80
14:13:46.921 → Timer fired.
14:13:46.921 → [670640] Ready (ping: 305ms).

14:18:36.412 → [960145] Heartbeat timeout
14:18:36.921 → Timer fired.
14:18:37.946 → Timer fired.
14:18:38.924 → Timer fired.
14:18:39.904 → Timer fired.
14:18:40.914 → Timer fired.
14:18:41.007 → [964741] Connecting to blynk-cloud.com:80
14:18:41.518 → [965252] Ready (ping: 315ms).

14:28:30.897 → [1554579] Heartbeat timeout
14:28:30.944 → Timer fired.
14:28:31.923 → Timer fired.
14:28:32.934 → Timer fired.
14:28:33.949 → Timer fired.
14:28:34.929 → Timer fired.
14:28:35.675 → [1559386] Connecting to blynk-cloud.com:80
14:28:36.000 → Timer fired.
14:28:36.280 → [1559986] Ready (ping: 309ms).

14:38:25.627 → [2149315] Heartbeat timeout
14:38:25.951 → Timer fired.
14:38:26.932 → Timer fired.
14:38:27.944 → Timer fired.
14:38:28.955 → Timer fired.
14:38:29.936 → Timer fired.
14:38:30.442 → [2154121] Connecting to blynk-cloud.com:80
14:38:30.721 → [2154410] Ready (ping: 191ms).

14:43:40.194 → [2463891] Heartbeat timeout
14:43:40.949 → Timer fired.
14:43:41.965 → Timer fired.
14:43:42.941 → Timer fired.
14:43:43.960 → Timer fired.
14:43:44.846 → [2468512] Connecting to blynk-cloud.com:80
14:43:44.976 → Timer fired.
14:43:45.296 → [2468983] Ready (ping: 304ms).

14:48:34.814 → [2758487] Heartbeat timeout
14:48:34.960 → Timer fired.
14:48:35.973 → Timer fired.
14:48:36.945 → Timer fired.
14:48:37.998 → Timer fired.
14:48:38.987 → Timer fired.
14:48:39.406 → [2763085] Connecting to blynk-cloud.com:80
14:48:39.920 → [2763592] Ready (ping: 382ms).

14:53:29.436 → [3053096] Heartbeat timeout
14:53:29.950 → Timer fired.
14:53:30.961 → Timer fired.
14:53:31.989 → Timer fired.
14:53:32.969 → Timer fired.
14:53:33.946 → Timer fired.
14:53:34.040 → [3057693] Connecting to blynk-cloud.com:80
14:53:34.507 → [3058193] Ready (ping: 297ms).

Ping 382 ms seems very high.:scream:

Yes, as @Blynk_Coeur says, your ping times are quite high.
It seems that you’re in California, so its not like you’re thousands of miles from civilisation and have to rely on a passing camel to transport your data packets, so i would t expect such bad ping times.

I’d start by rebooting your router and any repeaters you have, and maybe running a speed check to see if you have an internet issue. Maybe kicking your wide off of Netflix and your kids off of their games consoles is the answer?

Pete.

1 Like

I don’t know about the long ping times, but the fact that it’s timing out every few minutes sounds vaguely like a rollover issue of a large number.
Heart Beat might be incrementing a number (of milliseconds or whatnot) that becomes higher than what the board is capable of storing, or storing in the type of variable provided to it.

Thanks all for responding. I did reset my router, did speed checks, no kids, and no Netflix. And no basic changes in our own behavior. But check this out… after running this Blynk project for a coupla weeks this issue cropped up out of the blue last Friday afternoon. Then Presto… today (Monday), fired up the Project first thing in the morning and no timeouts all day.