A few questions about some features

Hello Blynkers,

After a few days of playing around with Blynk a came across some thing that I dont really understand.
At first, I am quite new to the world of Arduino, I started like 8 months ago with the programming and soldering etc. I think I have learned alot, but dont be mad if I make stupid mistakes :stuck_out_tongue: .

At this point I have hooked up Blynk to some lamps and a temperature sensor (DHT11) in and around my room, on an homemade Arduino UNO. It works perfectly, because Blynk is amazing!

What I would love to do is to hook the DHT11 up to the graph widget, which i did, but at this point every time when i re-open the Blynk app the graph widget is blank. Is there a way to store the values from the DHT11 every hour or so, so when i open the app I can actually see the temperature from the last hours?

Right now I have this in my code:

Blynk.virtualWrite(1, getTemp());
Blynk.virtualWrite(2, getHumi());
Blynk.virtualWrite(3, getTemp());

So everytime i click the button attached to virtual pin 0 the data gets updated and printed to two displays (1 and 2) and the graph widget (3). I tried to display the temperature and a “°C” on the display:

Blynk.virtualWrite(1, getTemp() + “°C”);

But this only shows a value of 0 on the display. Is this because the display cant actually display characters?

One last question: :see_no_evil:
The lamps on my room are simple connected to a button, which was amazingly easy to do.
To have some kind of feedback from the Arduino in the Blynk app I have a virtual pin continuously copying the state of the digital ouput.

void LEDcheck() // This function is called in the void loop
if (digitalRead(7) != state7) { // state7 is a boolean set to LOW by default.
state7 = digitalRead(7);
Blynk.virtualWrite(7, state7);

This works perfectly, but when i re-open the Blynk app while the virtual pin is high the led does not update or check the state of the virtual pin and so it does not turn on. I could of course update this state periodically, but that would only cause unnecessary trafic on your servers. Is this just the way the app (or the LED widget) works, or did I do something wrong?

< My dashboard

This was way more text than I expected…
Seriously, Blynk is amazing! I really love to play around with it and i am looking forward to the next update!


Bas Peter

Hello @BasPeter,

thank you for your feedback!

. Is there a way to store the values from the DHT11 every hour or so

This is not yet implemented. Will be available soon (year/month/daily/hourly).

But this only shows a value of 0 on the display. Is this because the display cant actually display characters?

Nope. This is iOS bug. It is already fixed. Will be available after next update.

Is this just the way the app (or the LED widget) works, or did I do something wrong?

This is the way app works right now. But this is often requested feature, so will’ll implement this soon.

Sorry, I can’t give you concrete dates. But all this in on our track, we need just time, so don’t worry, soon or later it will be done.

Regards, Dmitriy.

Can you help me connect my DHT11.
Please provide me with the code.

My code:

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11);
#define BLYNK_PRINT SwSerial
#include <BlynkSimpleSerial.h>

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

void setup()
  // Default baud rate is 9600. You could specify it like this:
  //Blynk.begin(auth, 57600);

void loop()


This is what i build with Blynk and the DHT11.
I installed the DHT11 outside my house, with the sensor pin connected to pin 2 of my arduino.
Then in the Blynk app i connected 3 value displays to virtual pin 1,2 and 4; a graph widget to virtual pin 3 and a button to virtual pin 0.

The value displays V1,V2 and V3 show respectively the temperature, the humidity and the average temperature of the past 24 hours.
The graph widget show the temperature of the past 24 hours.
The button activates a function which writes all the temperature values to the graph widget. (dont forget to put this button on switch mode, not push, when you put it on push it tries two write the values to the graph widget multiple times when you push it, which may cause the #flood error)

This is my code:

 #define BLYNK_PRINT Serial // Enables Serial Monitor
 #include <SPI.h>
 #include <Ethernet.h>
 #include <BlynkSimpleEthernet.h> // This part is for Ethernet stuff
 #include <SimpleTimer.h>
 #include <EEPROM.h>
 #include "DHT.h"
 #define DHTPIN 2
 #define DHTTYPE DHT11   // DHT 11

The stuff above the libraries needed, Blynk, simpletimer (not necessairy to get the DHT11 working), DHT and EEPROM.
–> https://github.com/adafruit/DHT-sensor-library

In this code the timer calls a function (StoreTemp()) every 40 minutes. This function gets the temperature and saves it in a buffer. This buffer is written on EEPROM so that when you reset your arduino (or the power cuts of or anything, you do not lose your data from the past 24 hours.)

char auth[] = "***";
SimpleTimer timer;
int index = EEPROM.read(40);
const int graphsize = 36;
void addReading(int x) {
  if (index >= graphsize) index = 0;
  EEPROM.write(40, index); // this saves the index position to EEPROM

// This calculates and returns the average
long average() {
long sum = 0;
for (int i = 0; i<graphsize; i++) {
sum += EEPROM.read(i);
return (sum/graphsize);

// This listens for a butten press on virtual pin 0, walks through the entire buffer (starting at the value which was written the longest time ago, so approximately 24 hours) and writes this to the graph widget. After that it writes the current temperature, humidity and the average to the displays.

  int v = index;
  for (int i = 0; i < graphsize; i++) {
    Blynk.virtualWrite(3, EEPROM.read(v));
    if (v >= graphsize) v = 0;
    delay(50); // to prevent the #flood error
  Blynk.virtualWrite(1, getTemp());
  Blynk.virtualWrite(2, getHumi());
  Blynk.virtualWrite(4, average());
void StoreTemp() {
int getHumi() {
  float h = dht.readHumidity();
  return h;
int getTemp() {
  float t = dht.readTemperature();
  return t;

These two functions above are the only two things that really read the values from the DHT11

void setup()
  timer.setInterval(2400000, StoreTemp);
void loop()

I hope i helped you with this, and i hope i did not forget anything :smile:. Just copy all the pieces of code into your IDE, setup the arduino and Blynk app like i did and it should work!

Thanks to the latest update the BLYNK_WRITE(0) is automatically called upon starting the app, which is amazing!

Thanks for the update @Dmitriy @Pavel !

Bas Peter

Thank you, but I switched to DHT22 and already got it working, I now can display my temp and hum easily :smile:

@Dmitriy maybe add the suffix just on the app side so no unnecessary data get’s transfered like the ºC part. ideally you could do both :stuck_out_tongue:

1 Like


Yeah, agree. Would be much better. Need discuss with @Pavel regarding how to design that.

Is there any easier way to get ºC in iOS app or do i have to send ºC inside my VirtualPin?

I usually put it to widget name. But we will add suffix later on for your convenience. And you can send it through Virtual Pin as well

I have tried to put the text in a VirtualPin but not succeeded yet.
Do you have any instruction here on the Community where it explain how to do?

I am using FLOAT variable.

@Flopp you could send floats directly to virtual pin

float temp = 0.11;

If you want to add text to float like C char. It is a bit more complicated.

float t = 13.7;
char buf[5];
dtostrf(t, 3, 1, buf);
Blynk.virtualWrite(V5, String(buf) + "℃");
1 Like

Worked perfect, thanks.