The AeroMonitor: a Dust Detection Device With Arduino Uno

by learningninja496i in Circuits > Arduino

73 Views, 0 Favorites, 0 Comments

The AeroMonitor: a Dust Detection Device With Arduino Uno

Image_20250929_200641_846.jpeg

Dust. Pollution. It's all around us, in some form or the other. Other than the Air Quality Index, there is not much of a measure for how polluted the air is. For some with dust allergies, that can be really concerning, which stresses the need for a dust detection device that provides information about the air nearby. This project guides you through how to build a device that provides a dust level from 0 to 1023, with 0 being least polluted and 1023 being most.

Supplies

1x Arduino Uno R3

1x Waveshare GP2Y1014AU0F Dust Sensor

1x I2C LCD 1602

1x Passive Buzzer

1x Red LED

1x Green LED

3x 220Ω Resistor

Jumper Wires

1x Cardboard Box(at least 5" x 2" x 4")


You will also need the Arduino IDE downloaded on your computer.

Find a Box

You will want to find a box that is at least 5" in length, 2" in width, and 4" in height. Amazon boxes will do, as will HP instant ink boxes. If you want, you can also use a 3D printed box but make sure the holes in it are applied beforehand.

The Circuit

Screenshot 2025-09-29 183258.png

If you are using different pins than provided in the schematic, please edit your code such that it will reach the right pins.

Cutting Holes

To accommodate the circuits in your device, you will need to have some holes for the wires to pass through. This is because some of the components, like the dust sensor and the display, have to go through the box in order for the device to function properly.

The following steps will explain where to cut holes.

The LCD

Image_20250929_201130_922.jpeg

On the top of the box, cut a hole using a utility knife that the LCD screen can fit through.

The Sensor

Image_20250929_201603_596.jpeg
Image_20250929_201554_190.jpeg

The sensor has 4 screws. Using a push pin, make 4 holes that you can put the screws through, and put the screws there. On the side, cut a hole for the wires to pass through, and fit the wires through it.

The Code

Write the following code in Arduino IDE.

#define DUST_SENSOR A0 // Analog pin for dust sensor output (Vo)
#define DUST_LED 6 // Digital pin for dust sensor LED (controls sampling)
#define RED_LED 7 // Red LED for high dust alert
#define GREEN_LED 8 // Green LED for safe dust levels

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16x2 LCD

// Dust threshold (adjust after testing, higher value = more dust)
#define DUST_THRESHOLD 300

void setup() {
lcd.init();
pinMode(DUST_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(DUST_SENSOR, INPUT);

// Initialize serial for debugging
lcd.clear();
Serial.begin(9600);

lcd.backlight();
}
void loop() {
// put your main code here, to run repeatedly:
// Turn on dust sensor LED to take a sample
digitalWrite(DUST_LED, LOW); // LED on (active low)
delayMicroseconds(280); // Wait 280 microseconds for sensor to stabilize
int dustValue = analogRead(DUST_SENSOR); // Read dust level (0-1023)
delayMicroseconds(40); // Complete sampling timing
digitalWrite(DUST_LED, HIGH); // LED off

// Print dust value for debugging
Serial.print("Dust Value: ");
Serial.println(dustValue);

// Check dust level and trigger alerts
if (dustValue > DUST_THRESHOLD) {
// High dust: turn on red LED
digitalWrite(RED_LED, HIGH);
digitalWrite(GREEN_LED, LOW);
lcd.setCursor(2, 1);
lcd.print("HIGH Dust Level");
} else {
// Safe dust: turn on green LED
digitalWrite(RED_LED, LOW);
digitalWrite(GREEN_LED, HIGH);
lcd.setCursor(2, 1);
lcd.print("LOW Dust Level");
}

// Wait before next reading
delay(1000); // Check every 1 second
lcd.clear();
}

How the Code Works

First, we have to define the LED for the dust sensor, the red LED, the green LED, the dust sensor, and the LCD display.

#define DUST_SENSOR A0 // Analog pin for dust sensor output (Vo)
#define DUST_LED 6 // Digital pin for dust sensor LED (controls sampling)
#define RED_LED 7 // Red LED for high dust alert
#define GREEN_LED 8 // Green LED for safe dust levels

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16x2 LCD


Next, we define the dust threshold (the threshold for which the red LED will light up, which is set to 300), the pin modes for the components, and the LCD initiation:

// Dust threshold (adjust after testing, higher value = more dust)
#define DUST_THRESHOLD 300

void setup() {
lcd.init();
pinMode(DUST_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(DUST_SENSOR, INPUT);

// Initialize serial for debugging
lcd.clear();
Serial.begin(9600);

lcd.backlight();
}

Then, we analyze the dust value, and light the LCD display:

void loop() {
// put your main code here, to run repeatedly:
// Turn on dust sensor LED to take a sample
digitalWrite(DUST_LED, LOW); // LED on (active low)
delayMicroseconds(280); // Wait 280 microseconds for sensor to stabilize
int dustValue = analogRead(DUST_SENSOR); // Read dust level (0-1023)
delayMicroseconds(40); // Complete sampling timing
digitalWrite(DUST_LED, HIGH); // LED off

// Print dust value for debugging
Serial.print("Dust Value: ");
Serial.println(dustValue);

Finally, we light the LED according to the dust value and the dust threshold, and we display the value (from 0 to 1023) on the LCD.

// Check dust level and trigger alerts
if (dustValue > DUST_THRESHOLD) {
// High dust: turn on red LED
digitalWrite(RED_LED, HIGH);
digitalWrite(GREEN_LED, LOW);
lcd.setCursor(2, 1);
lcd.print("HIGH Dust");
} else {
// Safe dust: turn on green LED
digitalWrite(RED_LED, LOW);
digitalWrite(GREEN_LED, HIGH);
lcd.setCursor(2, 1);
lcd.print("LOW Dust Level");
}

// Wait before next reading
delay(1000); // Check every 1 second
lcd.clear();
}

This device is portable and runs on a 5V battery. It can measure dust in a classroom, a storage room, or even your house! The threat of dust has finally been alleviated.