Graph widget data log

Hello Blynkers,

I wanted to store data and view this in the graph widget. But since this is not possible (yet) i came up with this:

int index = 0;
const int graphsize = 36; // there are 36 different spots in the graph widget
int buffer[graphsize];

void addReading(int x) {
buffer[index] = x;
if (index >= graphsize) index = 0;

Blynk.virtualWrite(3, 40); // this is so you can see the values moving along the x axis
for (int i = 0; i < graphsize; i++) {
Blynk.virtualWrite(3, buffer[i]);
delay(60); //to prevent the blynk-bug#Flood thing from happening

void StoreTemp() {

timer.setInterval(1200000, StoreTemp);

Every twenty minutes it stores a value from a sensor in a circular buffer on the next index position. Upon triggering virtual pin 0 this every index position from this cirular buffer is written to the graph widget,

Does someone have a good idea how to improve this?
And maybe a programming category would be nice.


Bas Peter


Heh, that’s good. Thanks for sharing. So now we don’t have to implement this graph data log :wink: .

Also - in that particular case delay not needed. Cause you do batch of 32 writes within 20 mins. that is < than our current limit 50 req-sec per user.

It does not? It does not write the 36 values of the buffer to the virtual pin every 20 minutes, but every time you push the button it writes all the values to the virtual pin. So it does, without any delay, 36 requests as fast as possible. When i try to do that it actually gives that flood error. (when printing millis() before and after the 36 requests it gives a difference of 304 millis. so 36 requests in 0.304 sec = 117.6 req-sec).

Blynk.virtualWrite(3, 40);
for (int i = 0; i < graphsize; i++) {
Blynk.virtualWrite(3, buffer[i]);
Blynk.virtualWrite(1, getTemp());
Blynk.virtualWrite(2, getHumi());

Even when i add a delay so that the total time this loop above takes is about 730 millis, (730/36*50=±1000 millis) the flood error still pops up… sometimes…

Is there a way to make sure the arduino or my Blynk app isnt making any onther requests while this loop is playing?


So initially we had limit restriction only on server side. Server uses one-minute exponentially-weighted moving average rate. That’s mean in case you sent 32 rec-sec within 1 min, average load is 0.5 req-sec within 1 min for user and limit is 50, so you able to send more 100 times more.

But later we found that it is very easy to create code that fills bandwidth even on slow arduino, so we added restriction also on lib side and seems here calculations are bit different…

@vshymanskyy could you explain how flood detected on lib side?

hmm okay.
i must say it works pretty well at the moment, with the 12 millis delay. But when i press the button (attached to the BLYNK_WRITE while the loop is still going it gives the error. Is there a way to prevent this from happening? To make sure the second button press does not activate anything?