BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Nodemcu dht11 blynk

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  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?

Pete.

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:

https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=More%2FDHT11

Pete.

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.

  WARNING :
  For this example you'll need Adafruit DHT sensor libraries:
    https://github.com/adafruit/Adafruit_Sensor
    https://github.com/adafruit/DHT-sensor-library

  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:

Pete.

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, “- - -“);

    return;
  }

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.

Pete.

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.

Pete.