Cmtelesann
Published

Blynk, NodeMCU and DHT-22

Setup a home temperature monitoring system on your phone within minutes! Literally just copy and paste!

EasyFull instructions provided1 hour556
Blynk, NodeMCU and DHT-22

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
DHT22 Temperature and Humidity Sensor
DFRobot DHT22 Temperature and Humidity Sensor
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring Diagram

Code

NodeMCU

Arduino
Upload to your NodeMCU
#include "DHT.h"                              // DHT Sensor
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "Blynk Auth";
char ssid[] = "SSID";
char pass[] = "Password";

DHT dhtA(5, DHT22);                           // DHT instance named dhtA, D1 and sensor type

void setup() {
  Blynk.begin(auth, ssid, pass);              // Connecting to blynk
  dhtA.begin();                               // Starting the DHT-22
}

void loop() {
  Blynk.run();
  climateRoutine();                           // Climate routine
  delay(4700);                                // 4.7 sec between routines
}

void climateRoutine() {
    byte h1 = dhtA.readHumidity();            // f1 and h1 are celsius and humidity readings
    // byte t1 = dhtA.readTemperature(true);  // for temperature in farenheits
    byte t1 = dhtA.readTemperature();         // from DHT/A
    Blynk.virtualWrite(V0, t1);               //  Set Virtual Pin 0 frequency to PUSH in Blynk app
    Blynk.virtualWrite(V1, h1);               //  Set Virtual Pin 1 frequency to PUSH in Blynk app
}

Credits

Cmtelesann

Cmtelesann

2 projects • 3 followers
Keeping my head busy! Looking for challenges! Trying to keep up with evolution! IoT is the future!

Comments

Add projectSign up / Login