ESP32-Based Air Quality Monitor with LCD Display and Exhaust Fan Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to monitor environmental parameters such as temperature, humidity, air quality (CO2, NH3, NOx), and carbon monoxide (CO) levels. It utilizes an ESP32 Devkit V1 microcontroller to interface with various sensors and an LCD display for real-time data output. The circuit also includes a relay module to control an exhaust fan based on sensor readings or predefined conditions.
Component List
ESP32 Devkit V1
- Microcontroller with WiFi capability.
- It has multiple digital and analog pins for interfacing with sensors and other peripherals.
Lcd 20x4 i2c
- An LCD display with 20 characters per line and 4 lines.
- Uses I2C communication protocol for displaying data.
12v Power Supply
- Provides a 12V power source for the circuit.
Exhaust Fan 12"
- A 12-inch fan used for ventilation, controlled by the relay module.
DHT11
- A sensor for measuring temperature and humidity.
MQ-135 SENSOR AIR QUALITY
- A sensor for detecting various gases such as CO2, NH3, and NOx.
MQ-7 Breakout
- A sensor specifically designed for detecting carbon monoxide (CO) levels.
1 Channel 5V Relay Module
- A relay module for controlling high power devices such as the exhaust fan.
Wiring Details
ESP32 Devkit V1
3V3connected to sensors and LCD VCC for power.GNDconnected to sensors, LCD, and relay module GND for common ground.D15connected to DHT11 DATA for temperature and humidity data.D5connected to Relay Module IN for controlling the relay.D21connected to LCD SCA for I2C data.D22connected to LCD SCL for I2C clock.D34connected to MQ-135 A0 for analog gas readings.D35connected to MQ-7 AO for analog CO readings.
Lcd 20x4 i2c
GNDconnected to common ground.5vconnected to ESP32 3V3 for power.SCAconnected to ESP32 D21 for I2C data.SCLconnected to ESP32 D22 for I2C clock.
12v Power Supply
+connected to Relay Module N.O. for supplying power to the fan.-connected to Exhaust Fan Neutral for completing the fan's power circuit.
Exhaust Fan 12"
Liveconnected to Relay Module COM for controlled power.Neutralconnected to 12v Power Supply-for completing the power circuit.
DHT11
DATAconnected to ESP32 D15 for data communication.GNDconnected to common ground.VCCconnected to ESP32 3V3 for power.
MQ-135 SENSOR AIR QUALITY
A0connected to ESP32 D34 for analog gas readings.GNDconnected to common ground.VCCconnected to ESP32 3V3 for power.
MQ-7 Breakout
AOconnected to ESP32 D35 for analog CO readings.GNDconnected to common ground.VCCconnected to ESP32 3V3 for power.
1 Channel 5V Relay Module
VCC+connected to ESP32 3V3 for power.VCC- (GND)connected to common ground.INconnected to ESP32 D5 for control signal.N.O.connected to 12v Power Supply+for normally open contact.COMconnected to Exhaust Fan Live for common contact.
Documented Code
LCD Display Code (sketch.ino)
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
hd44780_I2Cexp lcd;
void setup() {
// Initialize serial communication
Serial.begin(9600);
delay(1500);
// Initialize the LCD (20 columns x 4 rows)
lcd.begin(20, 4);
lcd.backlight();
}
void loop() {
// Variables for sensor data (placeholders)
float t, h, co2_value, co_value;
// Read sensor data here (code not provided)
// Display Temperature
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.print(t);
lcd.print(" C");
// Display Humidity
lcd.setCursor(0, 1);
lcd.print("Humidity:");
lcd.print(h);
lcd.print(" %");
// Display Air Quality
lcd.setCursor(0, 2);
lcd.print("CO2,NH3,NOx: ");
lcd.print(co2_value);
lcd.print(" ppm");
// Display CO Level
lcd.setCursor(0, 3);
lcd.print("CO: ");
lcd.print(co_value);
lcd.print(" ppm");
// Update every second
delay(1000);
}
Note: The actual sensor data reading and processing code is not provided. The placeholders t, h, co2_value, and co_value should be replaced with actual sensor data variables obtained from the respective sensors.