Trying to create a timestamp every second

Hello, I want to create a program, that saves 10 values every second in one timestamp. From documentations and other forum entries I gathered that it would be possible with the HTTPS API, but I also wanted to try the rather new beginGroup/endGroup functionality. This functionality works really well and my produced timestamps are as I want them.
BUT it was not able to make a timestamp every second. Rather my project skipped a second every few times, sometimes even up to 3 seconds. (I added a screenshot below)

Question: Is there a way to create a 10 value timestamp with begin/end Group?

• Hardware model: ESP32
• Blynk server
• Blynk Library version

#define BLYNK_TEMPLATE_NAME "Blynk beginGroupendGroup Test Template"
#define BLYNK_AUTH_TOKEN "uq8IRaXwc45_KQvtC0ZGdFWUSpwq0LQM"

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <ezTime.h>

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "secret";
char pass[] = "very secret";

BlynkTimer timer;

int32_t distances[10];
int counter = 0;

int32_t randNumber;

void setup() {
  Blynk.begin(auth, ssid, pass);

  timer.setInterval(100L, getDistanceValue);

void getDistanceValue() {
    randNumber = int32_t(random(0,255));    
    distances[counter] = randNumber;

    if(counter >= 10){
      counter = 0;

void updateBlynkValuesAsGroup() {
  uint64_t ts = (uint64_t) * 1000 +;
  Blynk.virtualWrite(V0, distances[0]);
  Blynk.virtualWrite(V1, distances[1]);
  Blynk.virtualWrite(V2, distances[2]);
  Blynk.virtualWrite(V3, distances[3]);
  Blynk.virtualWrite(V4, distances[4]);
  Blynk.virtualWrite(V5, distances[5]);
  Blynk.virtualWrite(V6, distances[6]);
  Blynk.virtualWrite(V7, distances[7]);
  Blynk.virtualWrite(V8, distances[8]);
  Blynk.virtualWrite(V9, distances[9]);

void loop() {;;

@Jakob_Lijo I think the problem here is that every Blynk.virtualWrite is an actual packet to the server (due to the tcp nodelay=true, if you ale to find this property in your sketch - changing it may help). So if request takes 100ms for 1 write command you’ll get 1 second delay for the next batch.

Another thing to try - do readings once a second and send values once a second. Maybe rand() function is slow and shifts the execution.

Another thing to try, add this on the top of the sketch:


@vshymanskyy are we able to handle this somehow?

1 Like

Let’s see if it helps

1 Like