Temperature and Humidity monitoring with DHT22, ESP8266, and Blynk application!

Temperature and humidity monitoring are important in many applications, including agriculture, HVAC systems, and even in our homes. With the help of modern technology, monitoring these factors has become easier than ever. In this blog, we will learn how to use the DHT22 sensor, ESP8266 microcontroller, and Blynk application to monitor temperature and humidity levels in real-time.

The DHT22 sensor is a popular choice for measuring temperature and humidity. It uses a capacitive humidity sensor and a thermistor to measure humidity and temperature, respectively. The sensor communicates with the ESP8266 microcontroller through a single-wire digital interface. The ESP8266 is a low-cost Wi-Fi microcontroller that is capable of connecting to the internet and transmitting data.



REQUIREMENTS:

To get started with this project, you will need the following components:

DHT22 sensor
ESP8266 microcontroller
Breadboard
Jumper wires
USB cable
Blynk applicationArduino IDE

LIBRARIES TO INSTALL

Node MCU (ESP8266)
DHT22
Blynk


open Arduino ide: goto Sketch > Include library > manage libraries > search for blynk

Use the same procedure to install the DHT22 and esp8266 libraries

If found any problem check the link below:


Install esp8266 board in Arduino ide:

you can google (install esp8266 board for Arduino ide) or go to the link below


Circuit Diagram:  (design in https://www.circuito.io/)

Esp8266  -   DHT22 / DHT11
 3v3                V+
 Gnd               Gnd
 D4                 Signal


How to create Blynk App:





Arduino Code:

// electronstop.blogspot.com
// madeinmind91  , @instagram
//Temperature sensor
/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************/

#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[] = "       "; //Enter the Auth code which was send by Blink
char ssid[] = "     ";  //Enter your WIFI Name
char pass[] = "     ";  //Enter your WIFI Password

#define DHTPIN 2          // Digital pin 4, select the pin to which you connected the data wire

#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321


DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

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!");
    return;
  }
  Blynk.virtualWrite(V5, h);  //V5 is for Humidity
  Blynk.virtualWrite(V6, t);  //V6 is for Temperature
}

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);
  dht.begin();
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}



Comments

Popular posts from this blog

Schematic and PCB design of wearable heart signal monitoring device.

How to Control a Servo Motor with Arduino: A Beginner's Guide to Robotics and Mechatronics