
What is AQI Sensor or Air Quality Index Sensor?
A standardized measurement called the Air Quality Index (AQI) is used to convey how clean or polluted the air is in a particular area at a given time. It offers the public an easily understood means of receiving information about air quality.
A number of significant air pollutants that are governed by international environmental agencies are usually included in the Air Quality Index (AQI), including ground-level ozone, particulate matter (PM2.5 and PM10), carbon monoxide (CO), sulfur dioxide (SO2), and nitrogen dioxide (NO2). The AQI value is determined by the threshold levels and scales specific to each pollutant.
The Air Quality Index (AQI) has a range of 0 to 500, with distinct categories denoting the degree of health concern linked to the air quality:
0 to 150: Normal to Moderately Polluted-This range encompasses air quality conditions that are considered acceptable for most individuals, with occasional concerns for sensitive groups in the higher end of the scale.
151 to 200: Poor- Everyone may start to experience health effects, and sensitive groups are more likely to be significantly affected.
201 to 300: Very bad - Health warnings of emergency conditions. The entire population is likely to be affected, and serious health effects may arise.
301 to 500: Toxic - Health alert: everyone may experience more serious health effects due to the extremely poor air quality.
How does Air Quality Monitoring System Work?
Sensors are used by the Air Quality Monitoring System to identify environmental factors such as humidity, temperature, and gas concentrations. Data on air quality is specifically obtained from analog readings from the gas sensor that are connected to an analog pin on an Arduino. By mapping these readings to predetermined thresholds, the air quality is categorized as "Good," "Poor," "Very Bad," or "Toxic." A DHT11 sensor measures temperature and humidity simultaneously. The Adafruit libraries are used to show the gathered data in real-time on an OLED screen. The system provides a snapshot of the air quality conditions, allowing users to evaluate and react to changes in their surroundings through continuous monitoring of these parameters.
Components Required for this Project are:
Arduino board
MQ135 gas sensor for detecting various gases.
DHT11 temperature and humidity sensor
OLED display for visual output
Breadboard and jumper wires
Arduino Air Quality Monitoring System Circuit Diagram
The entire air quality monitoring system project will be connected as follows: an Arduino Uno on a breadboard, an OLED, a DHT11, and an MQ135 gas sensor.

With the aid of the SDA and SCL pins, the Arduino is connected to the OLED via the I2C protocol. Analog signals from the MQ135 gas sensor are sent to the Arduino's analog input pin A0. One digital data output pin on the DHT11 sensor is linked to the Arduino D2 pin.
Code
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <dht.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define sensor A0
#define DHT11PIN 2
int gasLevel = 0; //int variable for gas level
String quality ="";
dht DHT;
void sendSensor()
{
int readData = DHT.read11(DHT11PIN);
float h = DHT.humidity;
float t = DHT.temperature;
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
display.setTextColor(WHITE);
display.setTextSize(1);
display.setFont();
display.setCursor(0, 43);
display.println("Temp :");
display.setCursor(80, 43);
display.println(t);
display.setCursor(114, 43);
display.println("C");
display.setCursor(0, 56);
display.println("RH :");
display.setCursor(80, 56);
display.println(h);
display.setCursor(114, 56);
display.println("%");
}
void air_sensor()
{
gasLevel = analogRead(sensor);
if(gasLevel<151){
quality = " GOOD!";
}
else if (gasLevel >151 && gasLevel<200){
quality = " Poor!";
}
else if (gasLevel >200 && gasLevel<300){
quality = "Very bad!";
}
else if (gasLevel >300 && gasLevel<500){
quality = "Toxic!";
}
else{
quality = " Toxic";
}
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(1,5);
display.setFont();
display.println("Air Quality:");
display.setTextSize(1);
display.setCursor(5,23);
display.println(gasLevel);
display.setCursor(20,23);
display.println(quality);
}
void setup() {
Serial.begin(9600);
pinMode(sensor,INPUT);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
}
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(50, 0);
display.println("Air");
display.setTextSize(1);
display.setCursor(23, 20);
display.println("Quality monitor");
display.display();
delay(1200);
display.clearDisplay();
display.setTextSize(1.5);
display.setCursor(20, 20);
display.println("BY Circuit");
display.setCursor(20, 40);
display.println("Digest");
display.display();
delay(1000);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
air_sensor();
sendSensor();
display.display();
}All the best.
Hire me on Fiverr. I will provide you the codes and schematics of your project. I can also build a project for you and ship it to your country. Pricing starts with just $15. Click here https://www.fiverr.com/s/o8o1p4X
