Nodemcu dht11 blynk

Before creating the topic

  1. Search forum for similar topics
  2. Check and
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

void loop()

@Pgeorge what is your question?


I can’t upload dht11 to Nodemcu because it says converting to nodemcu is not possible

I assume you mean that you have some code that was written for an Arduino device, which you’re trying to use with a NodeMCU.

If that is the case then start your journey from a different place, with DHT11 code written for the NodeMCU, such as this:


Dear Pete,
I tried with the example you suggested, and this is the error message!

Arduino: 1.8.7 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
Multiple libraries were found for "BlynkSimpleEsp8266.h"
In file included from C:\Users\Pvinnailevi\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

 Used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Blynk_For_Chinese
 Not used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Blynk
 Not used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Blynk
 Not used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Blynk
 Not used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Blynk
Multiple libraries were found for "DHT.h"
 Used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\DHT_sensor_library
 Not used: C:\Users\Pvinnailevi\Documents\Arduino\libraries\Grove_Temperature_And_Humidity_Sensor
C:\Users\Pvinnailevi\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

 #include <Adafruit_Sensor.h>


compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

If you’d have read the comments at the beginning of the code example that you downloaded, you would have seen this:


  This example shows how value can be pushed from Arduino to
  the Blynk App.

  For this example you'll need Adafruit DHT sensor libraries:

  App project setup:
    Value Display widget attached to V5
    Value Display widget attached to V6

You obviously haven’t followed the instruction to download and install the Adafruit libraries, which is why the compiler is saying:


I am ready, Work! Than you Pete

Sorry I wrote it wrong! Thank you Pete

1 Like

Dear Pete, I found a mistake! Works fine with nodemcu in blynk on dht11! But! If the connection between nodemcu and dht11 is disconnected, or between the network and nodemcu, the gauge will still display a real value in the blynk! It would be nice if the connection is lost somewhere then just write dots instead of gauge values! Is it possible? Thank you.

Adding these two new lines of code should fix the problem if the sensor is disconnected, although I’ve not tried it…

if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    // new lines added by Pete Knight...
    Blynk.virtualWrite(V5, "- - -");
    Blynk.virtualWrite(V6, "- - -");


As far as solving the problem of a value still showing when the device Is disconnected from the Blynk server, that can’t be done, but you will get a red dot at the top of the app screen to show that your device is offline, so you’ll know that the readings displayed are incorrect.


Hi Pete, Tried it but unfortunately it doesn’t work! By inserting the 2 lines you will no longer allow it to be uploaded to nodemcu! Could I have copied the two lines incorrectly?

It looks like the forum has changed the quotation marks from normal ones to ones that slope to the right.
This would give a message something like “stray character 222” when you compile it.
Edit the sketch and the-type the quotation marks and it should work.


I am facing the same problem with the same codes for DHT11… but i did not get this message, like what are the steps exactly to make it work without disconnecting or offline.

What problem?
What codes?
What message?


1 Like

The blynk application on the top of the app screen it shows that your device is offline then disconnected

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "QxVfsb-qOWXonSGHW79mOUGoY6i8Gtnw";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Glide";
char pass[] = "";
#define DHTPIN 2            // D3
// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, "t = dht.readTemperature()");
  Blynk.virtualWrite(V6, "h = dht.readHumidity()");
void setup()
  // Debug console
  Blynk.begin(auth, ssid, pass,"", 8442);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
void loop()

What does your serial monitor show?


16:06:27.938 -> connected with Glide, channel 6
16:06:27.974 -> dhcp client start...
16:06:28.012 -> cnt 
16:06:28.012 -> ip:,mask:,gw:
16:06:28.051 -> [3503] Connected to WiFi
16:06:28.098 -> [3504] IP:
16:06:28.137 -> [3504] 
16:06:28.137 ->     ___  __          __
16:06:28.137 ->    / _ )/ /_ _____  / /__
16:06:28.173 ->   / _  / / // / _ \/  '_/
16:06:28.207 ->  /____/_/\_, /_//_/_/\_\
16:06:28.244 ->         /___/ v0.6.1 on NodeMCU
16:06:28.279 -> 
16:06:28.279 -> [3618] Connecting to
16:06:28.317 -> [3756] Ready (ping: 38ms).
16:06:33.388 -> [8849] Connecting to
16:06:33.437 -> [8910] Ready (ping: 32ms).
16:06:37.863 -> pm open,type:2 0
16:06:38.537 -> [13992] Connecting to
16:06:38.585 -> [14048] Ready (ping: 27ms).
16:06:43.665 -> [19128] Connecting to
16:06:43.699 -> [19187] Ready (ping: 28ms).

You need to change this to use port 8080 instead of 8442


Thank you, but i am still having the same results and blynk is offline

16:26:32.237 -> [29476] Ready (ping: 26ms).
16:26:37.285 -> [34559] Connecting to
16:26:37.395 -> [34621] Ready (ping: 31ms).
16:26:42.417 -> [39701] Connecting to
16:26:42.476 -> [39760] Ready (ping: 29ms).
16:26:47.599 -> [44862] Connecting to
16:26:47.682 -> [44922] Ready (ping: 26ms).
16:26:52.743 -> [50002] Connecting to
16:26:52.791 -> [50061] Ready (ping: 26ms).