Over a million developers have joined DZone.

Environmental Monitoring With IoT

DZone's Guide to

Environmental Monitoring With IoT

Want to make your own air quality monitor? Grab an Arduino and a sensor and let's get started with this quick, simple guide.

· IoT Zone ·
Free Resource

Digi-Key Electronics’ Internet of Things (IoT) Resource Center Inspires the Future: Read More

House dust is an asthma trigger. Pollution caused by dust particles causes respiratory illness in children and older people. Dust and pollution particles mix in the atmosphere and can travel for days across continents and countries before settling on the ground’s surface. People with heart or lung diseases and other chronic diseases are at increased risk from dust and particle pollution. Pollution can aggravate the disease. Let us create an IoT-based device to measure dust concentration so we can prevent respiratory illness by taking precautions.

Dust Sensor

This dust sensor gives a good indication of the air quality in an environment by measuring dust concentration. The Particulate Matter level (PM level) in the air is measured by counting the Low Pulse Occupancy time (LPO time) in a given time unit. LPO time is proportional to PM concentration. This sensor can provide reliable data for air purifier systems; it is responsive to PM of diameter 1μm.




  • Stable and sensitive detection of not only cigarette smoke, but house dust, too. Both are indoor asthma triggers.
  • Air is pushed around via an air generation mechanism with a built-in heater.
  • Easy maintenance, highly sensitive, and long-lasting.
  • Dual output for particle sizes over 1 micron and 2.5 micron (approx).
  • Compact and light.
  • Easy installation.


  • Connect the Edison board to a computer via USB cables.
  • Stack the grove base shield.
  • Plug in a Grove Dust Sensor to the D8 port of your base shield.
  • Copy and paste the code below in your Arduino IDE.
  • Deploy it and monitor the results in the serial monitor.


int pin = 8;

unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 2000;//sampe 30s ;
unsigned long lowpulseoccupancy = 0;

float ratio = 0;
float concentration = 0;

void setup() {
    starttime = millis();//get the current time;

void loop() {
    duration = pulseIn(pin, LOW);
    lowpulseoccupancy = lowpulseoccupancy+duration;
    if ((millis()-starttime) >= sampletime_ms)//if the sampel time = = 30s
        ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100
        concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve

        Serial.print(“concentration = “);
        Serial.println(” pcs/0.01cf”);
        lowpulseoccupancy = 0;
        starttime = millis();



  • Please keep it upright.
  • A 3-minute preheat time is required when using the system for the first time.
  • Arbitrary operation may cause unexpected damage.
  • The onboard potentiometers are used only for the factory setting. Please do not change the default configuration.

Digi-Key’s IoT Component Selector is your one-stop-shop for the IoT

iot ,air quality monitoring system ,arduino ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}