Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Smart Environment Monitoring System with Blynk Integration

View and Edit Project In Cirkit DesignerImage of ESP32-Based Smart Environment Monitoring System with Blynk Integration

Smart Environment Monitoring System Documentation

Summary

The Smart Environment Monitoring System is designed to measure environmental parameters such as air quality, light intensity, temperature, and humidity. The system is based on the ESP32-WROOM-32UE microcontroller, which is connected to various sensors including the MQ-135 air quality sensor, an LDR module for light intensity, and a DHT11 sensor for temperature and humidity. The ESP32 microcontroller is programmed to read the sensor data and send it to the Blynk IoT platform for remote monitoring.

Component List

ESP32-WROOM-32UE

Module LDR

MQ-135 SENSOR AIR QUALITY

KY-015 DHT11

Wiring Details

ESP32-WROOM-32UE

Module LDR

MQ-135 SENSOR AIR QUALITY

KY-015 DHT11

Documented Code

#define BLYNK_TEMPLATE_ID "TMPL6Gg7e2pVQ"
#define BLYNK_TEMPLATE_NAME "Smart Environment Monitoring System"
#define BLYNK_AUTH_TOKEN "sDAyP5tfJN5vol0a2ens8SbvtNxtG-ks"

#include <DHT.h>
#include <BlynkSimpleEsp32.h>

#define DHTPIN 27     // Pin connected to the DHT11 sensor
#define DHTTYPE DHT11 // DHT11 sensor type
#define MQ135_PIN 34  // Pin connected to the MQ-135 air quality sensor
#define LDR_PIN 32    // Pin connected to the LDR module

DHT dht(DHTPIN, DHTTYPE);

char ssid[] = "Harnantee-Maxis_Fibre"; // Replace with your Wi-Fi SSID
char pass[] = "hanahome7919";          // Replace with your Wi-Fi password

void setup() {
  Serial.begin(115200);
  dht.begin();
  analogSetPinAttenuation(LDR_PIN, ADC_11db);
  
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}

void loop() {
  Blynk.run();
  
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  
  int mq135Value = analogRead(MQ135_PIN);
  
  int ldrValue = analogRead(LDR_PIN);

  Blynk.virtualWrite(V0, t);       // Send temperature data to Blynk
  Blynk.virtualWrite(V1, h);       // Send humidity data to Blynk
  Blynk.virtualWrite(V2, mq135Value); // Send air quality data to Blynk
  Blynk.virtualWrite(V3, ldrValue);   // Send light intensity data to Blynk

  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println(" °C");

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.println(" %");

  Serial.print("Air Quality (MQ-135): ");
  Serial.println(mq135Value);

  Serial.print("Light Intensity (LDR): ");
  Serial.println(ldrValue);
  delay(2000);  // Delay between readings
}

Note: The Blynk template ID, Blynk template name, and Blynk authorization token are placeholders and should be replaced with actual values for deployment. Additionally, the Wi-Fi SSID and password are included in the code for the purpose of connecting to the Blynk platform and should be replaced with secure credentials before deploying the system.