Measuring Air Quality With IoT

Pollution is increasing day by day and health risk is incresing with increasing pollution. A simple air quality detection system can be made to detect the quality of air around us.  So let us create an Air Quality Monitor with the Internet of Things.


  • Intel Edison
  • Grove Base Shield
  • Air Quality Sensor
  • Jumper Cables
  • USB Cable

Air Quality Sensor

This sensor is designed for comprehensive monitoring over indoor air conditions. It’s responsive to a wide scope of harmful gases, such as carbon monoxide, alcohol, acetone, thinner, formaldehyde and so on. Due to the measuring mechanism, this sensor cannot output specific data to describe target gas concentrations quantitatively. But it’s still competent enough to be used in applications that require only qualitative results, like auto refresher sprayers and auto air cycling systems.

image001 (1)

image002 (1)


  • Responsive to a wide scope of target gases
  • Cost efficient
  • Durable


  1. Power on the Edison board.
  2. Wait for 15-20 seconds to boot up.
  3. Stack grove base shield.
  4. Connect the air quality sensor to A0 port.


Download the file!

Save this to your Arduino folder.

Then open the example below by the path:

File / Example / AirQuality_Sensor / AirQuality_Sensor

Upload the code and see the results in serial monitor.

image003 (1)


#include "AirQuality.h"  

#include "Arduino.h"  

AirQuality airqualitysensor;  

int current_quality =-1;  

void setup()  





void loop()  



    if (current_quality >= 0)// if a valid data returned.  


        if (current_quality==0)  

        Serial.println("High pollution! Force signal active");  

        else if (current_quality==1)  

        Serial.println("High pollution!");  

        else if (current_quality==2)  

        Serial.println("Low pollution!");  

        else if (current_quality ==3)  

        Serial.println("Fresh air");  




  if(airqualitysensor.counter==122)//set 2 seconds as a detected duty  











  • Require relatively clean air as an initial condition.
  • Long time exposure to highly polluted air can significantly weaken its sensitivity.

Leave a comment

Your email address will not be published. Required fields are marked *