ClimaGrid is a home air quality monitoring system that uses the ESP32 microcontroller, DHT22 temperature and humidity sensor, and AMS CO2 sensor to provide real-time indoor environmental data. The system displays air quality parameters on an LCD screen and sends the data to an MQTT broker for further analysis and integration.
- Real-time Air Quality Monitoring: Displays temperature, humidity, and CO2 levels on an LCD screen.
- Heating System Analysis: Tracks when heating systems are turned on and how long it takes to reach the desired temperature. Monitors time taken to return to a comfortable range after the heater is turned off.
- MQTT Integration: Sends sensor data to an MQTT broker for remote monitoring, logging, and integration with other smart home systems.
- Air Quality Alerts: Provides insights into indoor air quality trends and sends alerts when air quality exceeds predefined thresholds.
- Energy Efficiency Insights: Helps analyze the efficiency of home heating systems based on usage patterns.
- ESP32 Microcontroller
- DHT22 Sensor (Temperature & Humidity)
- AMS CO2 Sensor
- LCD Display (320x240) ILI9341
- Jumper Wires
- Breadboard or PCB
- Arduino IDE with ESP32 Board support
- MQTT Broker (e.g., Mosquitto, or cloud-based brokers like HiveMQ or AWS IoT)
- Libraries:
DHTfor DHT22 sensor.PubSubClientfor MQTT communication.LiquidCrystalfor LCD display.
-
Connect the DHT22 sensor to the ESP32.
- VCC -> 3V3
- GND -> GND
- Data -> GPIO Pin 25
-
Connect the AMS CO2 Sensor to the ESP32.
- VCC -> 3V3
- GND -> GND
- SDA -> GPIO Pin 21
- SCL -> GPIO Pin 22
-
Connect the LCD Display to the ESP32.
LCD PIN Description ESP32 Notes PIN 01 VCC 5V PIN 02 GND GND PIN 03 CS LCD chipselect GPIO Pin 05 PIN 04 LCD reset signal GPIO Pin 04 PIN 05 DC/RS LCD register GPIO Pin 02 PIN 06 SDI(MOSI) SPI GPIO Pin 23 PIN 07 SCK GPIO Pin 18 PIN 08 Backlight control GPIO Pin 16 to enable 3v pinMode(16, ONHIGH);PIN 09 SDO(MISO) GPIO Pin 19
-
Install the required libraries in Arduino IDE:
DHTby AdafruitPubSubClientfor MQTTLiquidCrystalfor the LCD screen
-
Update the
WiFicredentials and MQTT broker details in the code.
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASSWORD "your_wifi_password"
#define MQTT_SERVER "your_mqtt_broker_ip"
#define MQTT_PORT 1883
#define MQTT_USER "your_mqtt_username"
#define MQTT_PASSWORD "your_mqtt_password"-
TFT_ESPI LCD driver header file update
- User_Setup.h
#define ILI9341_DRIVER // Generic driver for common displays
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 5 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)