Arduino Powered Dust Particles Monitoring Station




Introduction: Arduino Powered Dust Particles Monitoring Station

You can fairly easily build a DIY internet of things device that monitors dust pollution in your home for less than $50 and get notified when the dust level gets too high so you can aerate the room, or you can set it outside and get notified if it's safe to go outside if you live in a highly polluted area.

I made this as a school project, so I didn't have enough time to find a service that will take MQTT messages and send them to you like notifications or emails.

Also note that keeping the sensor powered at all times will reduce the fan's lifetime.

Step 1: Parts Needed

What you'll need

  • Arduino Uno
  • Arduino Ethernet shield
  • Particulate matter laser sensor (usually go for $10-$30 on eBay/aliexpress)
  • DHT11 temperature and humidity sensor (optional)
  • Breadboard
  • Jumper cables

Step 2: Assemble the Parts

First, you need to plug the ethernet shield on the Arduino

The PM sensor has multiple wires, but the ones we need are VCC, GND, TX, RX.

Connect the VCC and GND to + and - on the breadboard respectively.

The Arduino has hardware RX and TX pins, but we'll use software emulation of RX and TX pins on pins 2 and 3 respectively. Plug the RX of the sensor to TX of the Arduino and TX of the sensor to RX of the Arduino.

If you are going to be using the temperature sensor, plug the VCC and GND lines to + and - on the Breadboard and the data line to pin 7.

Step 3: The Code

You can either install MQTT broker on a raspberry pi or a computer you have always on at home, or use a cloud MQTT service, like Cloud MQTT. Then you can write a script that sends the data as HTTP to an IFTT webhook, as they don't yet support MQTT webhooks and set up notifications for when dust levels in your home get too high.

Arduino air station

IPAddress ip(169, 169, 100, 98);
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
constchar *mqtt_server = "";
constint mqtt_port = 11895;
constchar *mqtt_user = "jhetjewk";
constchar *mqtt_pass = "QB2p9PiMV6pn";
constchar *mqtt_client_name = "arduinoClient1"; // Client connections cant have the same connection name
EthernetClient ethClient;
PubSubClient client(ethClient);
SoftwareSerial pmSerial(RX_PIN, TX_PIN);
dht DHT;
int pm1;
int pm2_5;
int pm10;
unsignedlong id;
//File myFile;
String s;
StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
voidsetup() {
id = 0;
pm1 = 0;
pm2_5 = 0;
pm10 = 0;
if (Ethernet.begin(mac) == 0)
Serial.println("Failed to configure Ethernet using DHCP");
// attempt with fixed ip addr
Ethernet.begin(mac, ip);
client.setServer(mqtt_server, mqtt_port);
client.connect("arduinoClient", mqtt_user, mqtt_pass);
voidloop() {
intindex = 0;
char value;
char previousValue;
if (!client.connected())
if (client.connect("arduinoClient", mqtt_user, mqtt_pass)) {
while (pmSerial.available()) {
value =;
if ((index == 0 && value != 0x42) || (index == 1 && value != 0x4d)) {
Serial.println("Cannot find the data header.");
if (index == 4 || index == 6 || index == 8 || index == 10 || index == 12 || index == 14) {
previousValue = value;
elseif (index == 5) {
pm1 = 256 * previousValue + value;
root["pm1"] = abs(pm1);
elseif (index == 7) {
pm2_5 = 256 * previousValue + value;
root["pm2_5"] = abs(pm2_5);
elseif (index == 9) {
pm10 = 256 * previousValue + value;
root["pm10"] = abs(pm10);
elseif (index >15) {
while (pmSerial.available());
int chk = DHT.read11(DHT11_PIN);
if (DHT.temperature == -999 || DHT.humidity == -999) {
root["temperature"] = "N/A";
root["humidity"] = "N/A";
} else {
root["temperature"] = DHT.temperature;
root["humidity"] = DHT.humidity;
voidsendResults() {
// publish to MQTT
char jsonChar[100];
Serial.println(client.publish("arduino", jsonChar));
// debug to serial
// Handles messages arrived on subscribed topic(s)
voidcallback(char* topic, byte* payload, unsignedint length) {
view rawair_quality.ino hosted with ❤ by GitHub

Step 4: Assemble the Box

I just used a box I had lying around and drilled a hole for the sensor to get air from and cut out a hole for the cables to go out (although it was a bit too big).

I used glue pads to attach the sensor to the box, aligning the input hole of the sensor with the drilled hole on the box.

Finally, I plugged in the ethernet and power cables.

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018

Be the First to Share


    • Make It Bridge

      Make It Bridge
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Big and Small Contest

      Big and Small Contest


    DIY Hacks and How Tos

    Great First Instructable. Good luck in the First Time Authors contest.


    Reply 5 years ago