Storing data on Blynk Server virtual pins


If I send an a value to a virtual pin on the Blynk server. Will it be safely stored and able to be read back to my arduino sketch at a later date even if the arduino and app are restarted?

What if the server is restarted, if its a local server will the data be lost?

@NickMurray the value on the virtual pin is stored forever whether you restart the Arduino or the app.
It will only change if you write another value to the pin.

I don’t use local servers but my understanding is that they perform exactly the same as the cloud server.

Thanks @Costas. I’m testing it out now. I was going to try and save some information on the SD card of a w5100 ethernet sheild but I might try using the BLYNK virtual pins instead as I don’t need much storage and i’m guessing it will be easier than writing to an SD card.

Ok, I need a hand. I must not be understanding the documentation as what i’m doing is not working.

I’m doing this in my sketch one time (triggered by a button press)

Blynk.virtualWrite(V120, 1111,1234,6969);

Then I’m expecting this function to run and give me a serial output

int x = param[0].asInt();
int y = param[1].asInt();
int z = param[2].asInt();
Serial.print("Read from V120 x value - “);
Serial.print(” y value - “);
Serial.print(” z value - ");

Storage right now supports only 1 value per pin. Also you need to have a corresponding widget (value display for example). However this is will improved very soon. Here is ticket for that.


Use V120, V121 and V122 rather than just V120.

Thanks for the help guys. @Dmitriy solved it. I did not have a value display widget assigned in my APP project. Now that I do it works but not really what I am after as I do not want another display widget on the screen showing my stored data.

I see that there is an example sketch of an SD card reader in the Blynk examples. Is this a widget that is available now?

Nope. It just test sketch.

Yes I understand. But Blynk server was initially designed exactly for serving application needs :slight_smile:.

I’m not complaining. I love what you are building. I’ll use the SD card option for now. Thanks for the help

1 Like

Sorry to bring up an old topic, but is it still the case that in order to use/access data stored on a Virtual Pin you must have a Value Display linked to the pin you are trying to access. I see the GitHub ticket was closed, but when I remove the Value Display from my project it seems to stop working as expected.


I remove the Value Display from my project it seems to stop working as expected.

Details please?

//#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <SimpleDHT.h>
int pinDHT11 = 4;
SimpleDHT11 dht11;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Office Wifi Internet";
char pass[] = "quake233";
//char ssid[] = "GetYourOwnWifi";
//char pass[] = "SeptemberFirst";

const int sleepTimeM = 15; //Sleep Time Minutes Max 70

float bat;
float bat1;
int bat2;

char Buffer[16];
char Buffer1[16];

BlynkTimer timer;

  int value = param.asInt();
  if (value == 1 && bat2 <=70)
  Blynk.notify("Battery LOW!!");
  Blynk.virtualWrite(V3, 0);
else if (bat2 <=50)
  Blynk.notify("Battery VERY LOW!! CHARGE NOW!!");
else if (bat2 >= 90){
Blynk.virtualWrite(V3, 1);

void sendSensor()
  //Blynk.notify("Device started");
  bat = analogRead(A0);
  bat1 = mapfloat(bat, 593, 937, 2.6, 4.2);
  bat2 = map(bat, 593, 937, 0, 100);
  dtostrf(bat1, 1, 2, Buffer); 

  // read without samples.
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err =, &temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT11 failed, err="); Serial.println(err);
  Serial.print("Sample OK: ");
  Serial.print((int)temperature); Serial.print(" *C, "); 
  Serial.print((int)humidity); Serial.println(" H");

  int tempF = (temperature * 1.8) + 32;
  Serial.print(tempF); Serial.print(" *F, ");

  Blynk.virtualWrite(V5, Buffer);
  Blynk.virtualWrite(V6, bat2);
  Blynk.virtualWrite(V7, tempF);
  Blynk.virtualWrite(V8, humidity);

  //Blynk.virtualWrite(V3, 5); //must run this first then comment out and reload code
  //ESP.deepSleep(sleepTimeM * 60000000);


float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);
  // Setup a function to be called every 20 second
  timer.setInterval(20000L, sendSensor);

void loop()

I am trying to monitor battery voltage, and send an alert when it gets below a certain percentage. I do not want to send a message every time it cycles (until it get really low), so I thought I would use a virtual pin as a flag. It seems that I first have to write the virtual pin to some value and run my code, then remove that line of code from the program and re-upload it. As long as I have a value widget assigned to that virtual pin it works just fine. If I remove the widget the virtual pin stops working and seems to just not exist. If I re-add the widget, I have to re-run the code that first assigns the virtual pin a value, then re-upload the code without it.

What do you mean by pin stops working?

It is like the BLYNK_WRITE (V3) never execute

How it should be executed if you have nothing assigned to it?

so a virtual pin must be assigned to a widget in order to access/store data

No. But


is triggered from app with widget assigned to it. However I still don’t see how this is related to “access/data storing”.

Please read docs regarding virtual pins it has all answers - Introduction - Blynk Documentation

@Toro_Blanco Make sure you’ve saved a value before requesting.
i.e. in your sketch the Blynk.virtualWrite(V3, …); should be executed at least once before Blynk.syncVirtual(V3);