Introduction
Indoor air quality (IAQ) plays a crucial role in our overall well-being, especially considering the significant amount of time we spend indoors. Poor air quality can lead to health issues and discomfort. Monitoring and controlling indoor air quality is essential for maintaining a healthy and comfortable living or working environment. In this article, we will explore how to create an air quality monitoring and HVAC (Heating, Ventilation, and Air Conditioning) control system with LCD feedback using Arduino.
Working Principle
The system we are building will measure several key parameters to assess indoor air quality, including temperature, humidity, carbon dioxide (CO2) levels, and volatile organic compounds (VOCs). Based on these measurements, it will control an HVAC system to maintain optimal air quality.
Things We Need
To build this system, you will need the following components:
- Arduino Uno or compatible board
- DHT22 or DHT11 temperature and humidity sensor
- MQ-135 gas sensor for measuring CO2 and VOC levels
- 16×2 LCD display with an I2C adapter
- Relay module for HVAC control
- Breadboard and jumper wires
- 5V power supply
- Enclosure (optional)
DHT11
The humidity sensing component of the DHT11 is a moisture holding substrate with the electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes while lower relative humidity increases the resistance between the electrodes.
MQ-135
The MQ-135 sensor contains a gas-sensitive material, often a metal oxide semiconductor (MOS), inside its casing. This material interacts with gases in the environment. When the MQ-135 sensor is exposed to a specific gas, such as carbon dioxide (CO2), the gas molecules interact with the surface of the gas-sensitive material. This interaction causes a change in the electrical conductivity or resistance of the sensing element. To measure the resistance change of the sensing element, the MQ-135 sensor is typically connected to a voltage divider circuit. This circuit includes a fixed resistor (known resistance) and the variable resistance of the gas-sensitive material. The voltage at the junction of these resistors is proportional to the gas concentration. MQ-135 sensors have a response time, which is the time it takes to detect changes in gas concentration. This response time may vary depending on the specific gas being detected.
Circuit Diagram
Working of the System with Arduino
- Sensor Connections: Connect the DHT22 or DHT11 sensor to the Arduino for temperature and humidity monitoring. Connect the MQ-135 gas sensor for CO2 and VOC measurements. Wire the LCD display using the I2C adapter for easy communication.
- HVAC Control: Use a relay module to control the HVAC system. Connect the relay to the Arduino and configure it to switch the HVAC unit on and off based on the air quality readings.
- Data Acquisition: Read data from the sensors using Arduino’s analog and digital pins. The DHT sensor provides temperature and humidity values, while the MQ-135 sensor gives CO2 and VOC data.
- Display: Display the obtained data on the LCD screen. You can set up the LCD library and use it to show real-time air quality information.
Installing Libraries
Download and Install the DHT and the Liquid Crystal I2C Libraries. To add the libraries in the Arduino IDE Click on Sketch –> Include Library –> Add .zip to Library
Then select the download zip files and now you are ready to code the Arduino. Ignore the steps if you already have the libraries included.
Code
// Include necessary libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
// Define sensor pins
#define DHTPIN 2
#define MQ135PIN A0
// Initialize DHT sensor
DHT dht(DHTPIN, DHT11); //change the DHT11 to DHT22 as per your sensor spec
// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// Start sensors
dht.begin();
// Start LCD
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Air Quality:");
// Initialize relay control pin
pinMode(3, OUTPUT);
}
void loop() {
// Read temperature and humidity
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
// Read CO2 and VOC levels
int co2Level = analogRead(MQ135PIN);
// Display data on LCD
lcd.setCursor(0, 1);
lcd.print("T:");
lcd.print(temperature);
lcd.print("C H:");
lcd.print(humidity);
lcd.print("% CO2:");
lcd.print(co2Level);
// Control HVAC based on air quality
if (co2Level > 800) {
digitalWrite(3, HIGH); // Turn HVAC on
} else {
digitalWrite(3, LOW); // Turn HVAC off
}
delay(5000); // Delay for 5 seconds before taking the next reading
}
Conclusion
Monitoring and controlling indoor air quality is a significant step toward ensuring a healthy and comfortable indoor environment. By creating this air quality monitoring and HVAC control system with LCD feedback using Arduino, you can actively manage the air you breathe. Regularly check and calibrate your sensors to maintain accurate readings, and customize the system to fit your specific needs. With this system in place, you can enjoy improved air quality and well-being in your home or workplace.