Print Friendly, PDF & Email


In this project we will learn how to get and read temperature and humidity values using NodeMCU and BLYNK. Through BLYNK application we can get temperature and humidity values in our smart phone.

Whenever we are out of our home environment, we are constantly worried about different miss-happenings, like fire, burglars, trespassers etc, we can use this project with little modifications so as to use anywhere we want.

Right  now this project strictly rotates around the idea of getting  count on changing Temperature and Humidity.

Components Required:

  • NodeMCU (ESP8266) – Buy
  • DHT11 – Buy
  • Jumper Wires – Buy
  • Blynk (Software)


At first we need to establish connection between NodeMCU and DHT11 module and after that we need to create project in BLYNK.

Connections are as follows:

  • Connect pin 1 of DHT11 module with Vin of NodeMCU.
  • Connect pin 2 with D4 of NodeMCU.
  • Connect pin 3 with Gnd of NodeMCU.

Setup in BLYNK Application:

  • Create a New Project in BLYNK app.
  • Write Project Name and Select NodeMCU from dropdown.
  • An AUTH token will be sent to your registered email, note this down.
  • Tap on the screen and add a 1 Gauges and 1 Graphs.
  • Tap on the Widget and select the respective Virtual pins for temperature and humidity data (V6 for temperature and V5 for humidity).

Circuit Diagram:


   For this example you'll need SimpleTimer library:
   and Adafruit DHT sensor library:
   and Adafruit Sensor library:
   App project setup:
     Value Display widget attached to V5
     Value Display widget attached to V6

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Himesh";
char pass[] = "himesh1234";

#define DHTPIN 2         // Signal pin connected to D4 of nodemcu

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

SimpleTimer 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, h);
  Blynk.virtualWrite(V6, t);
  Serial.print("Temp = ");
  Serial.print(" Humi = ");

void setup()
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);
  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);

void loop()
{; // Initiates Blynk; // Initiates SimpleTimer