How to update a bulk of data

could you recommend me any way, how to update a lot of data (i.e. after push button - reqest)? I have probably problem with flooding, since I’m uploading a lot of data in short time… Easyest way will be to add delay(1000); after each single Blynk.virtualWrite command, but it is not recommended…

void updateStatisticData() {                                    
  Blynk.virtualWrite(V11, t1min);                               
  Blynk.virtualWrite(V12, t1max);                               
  Blynk.virtualWrite(V13, t1avg);                               
  Blynk.virtualWrite(V21, t2min);                               
  Blynk.virtualWrite(V22, t2max);                               
  Blynk.virtualWrite(V23, t2avg);                               
  Blynk.virtualWrite(V31, h1min);                               
  Blynk.virtualWrite(V32, h1max);                               
  Blynk.virtualWrite(V33, h1avg);                               
  Blynk.virtualWrite(V41, h2min);                               
  Blynk.virtualWrite(V42, h2max);                               
  Blynk.virtualWrite(V43, h2avg);                               
  Blynk.virtualWrite(V80, timeOn/3600.);                        
  Blynk.virtualWrite(V90, millis()/1000/60/60.);                
  Blynk.virtualWrite(V91, (millis()-timeStatistic)/1000/60/60.);
  Blynk.virtualWrite(V70, dht1error);                           
  Blynk.virtualWrite(V71, dht2error);                           
  Blynk.virtualWrite(V81, countSwitchOn);                       
  Blynk.virtualWrite(V82, samplesDHT1);                         
  Blynk.virtualWrite(V83, samplesDHT2);

Thanks for advices,

use blynk timer.
but how often would you like to update those pins?

Just few a days? Let’s say 5 times…
The amount of data is not so huge (measured per day or hour). But I’m not able to push all the data at the “same moment” - from the point of Blynk server. I think, that this is a problem of fooding prevention on server…

This function is called on request sent from app (button), when I need it. It is not regulary updated at intervals.

What MCU are you using?

ESP8266, respectively ESP-201. But I think, that is (should be) irrelevant at this issue…

yes, the mcu can be relevant in some cases.

that amount of data shouldnt cause flood error, if you not uploading continuosly.

what esp core library version are you using? once i had a similar problem because of v 2.3, after i updated to 2.4, the problem gone.

it is relevant.

Regarding ESP core library version, I’m not sure now, I have to check it later.
Ok, sorry guys. :slight_smile: It’s matter on device, you have convinced me.
Is there any published limit, how many data can I pass to Blynk server in one minute or so? Is there any difference on the way? I mean from device - to blynk server and/or from blynk server - to android?
The most of my variables are 4 bytes, either long or floats…

Yes it’s in the docs that Blynk prepared, no more than 100 commands per second but each MCU also has it’s own limits. Most Blynkers are using Arduino ESP libraries that are over 12 months old. With these libraries any more than about 4 consecutive virtualWrite() commands will crash the ESP. With the new libraries this is not an issue but there will still be a limit.

@Petamoravec we have 2 limits.

  • One is on the server side and it is pretty big - 100 req/sec;
  • Second one on hardware side and it is 20 req/sec; - It was added as some hardware was crashing with higher limit;

You can increase second limit with

#define BLYNK_MSG_LIMIT 20

in case your hardware is powerful enough.

More info -

1 Like

Ok, thaks for advices.
First of all I’ll try to update library. Then I can try increase BLYNK_MSG_LIMIT. Em I right, that does not matter on the type of variable? It’s counted just per request (I mean at Blynk server side)?
But, back to the programming issue, do you have any suggestion how to pass/send all of the request with delays between them? I mean somehow easily, by elegant way?

The V for Virtual is not actually required, although I generally use it as it avoids confusion with digital pins.
If you were to structure your project so the 20 widgets were numbered 0 to 19 and put the data for each in an array then this should work.

  for(int i = 0; i < 20; i++){
    Blynk.virtualWrite(i, DataArray[i]); 

Delay()?!? :slightly_smiling_face:
If it is allowed, I can add this to my sketch like this
void updateStatisticData() {
Blynk.virtualWrite(V11, t1min);
Blynk.virtualWrite(V12, t1max);
Blynk.virtualWrite(V13, t1avg);
But I was wondering, if there is any elegant use of timer instead of delay

I’m sure there is but experienced Blynkers don’t normally send 20 variables at a time.

Another sample for you. Extract from the end of setup() onwards:

  timer.setInterval(2000L, updatetwenty); // 1s gives flood error

unsigned int sliderValue = 0;

void updatetwenty(){
  for(int i = 50; i < 70; i++){
    Blynk.virtualWrite(i, millis()); 
    delay(sliderValue); // i.e. no delay but you can test with a slider

On a decent ESP with latest Arduino ESP core gives:

1 Like

Small delays are also fine as long as the sum of those delays doesn’t break your connection :slight_smile:.

My program runs automatically and there is no need to upload all of the statistic data to the server, just 4 of actual values for graphs. But, when I start the control app, I’d like to see all available data. I dont want to update them regulary, since I need to keep data traffic as low as possible. So I’d like to send them just on reqest. BTW, I changed float variables to int, in order to save a few bytes. But, as I saw in docs, all data are send as string? So the only way, how to reduce amount of transfered data is to cut unnecessary decimal places? Right?


Replacing float to int is still may save you some bytes.

Right. Also small numbers (1,2,3 digits) are actually smaller than int numbers (4 bytes).