Air Pollution and Environmental Monitor




Introduction: Air Pollution and Environmental Monitor

This project is a sensor station that can detect parts per million levels of carbon monoxide, ammonia, and nitrogen dioxide in the air through the Grove Multichannel Gas Sensor ( It also uses the Grove Light Sensor, Temperature Sensor, and Loudness Sensor to monitor your environment. A Grove LCD RGB Backlight display displays the data and a push button allows the user to display the output of each sensor.

This project was initially designed for and funded by the Columbia Engineering Rio Design Challenge with the goal of providing personal monitoring of air and noise pollution by either setting up the sensor in the house or placing the sensor in a case to be used as a backpack clip to monitor pollution wherever the user goes.

Step 1: Assemble Your Parts!

You'll need:

  1. Arduino Uno
  2. Arduino Grove Base Shield
  3. Grove LCD RGB Backlight
  4. Grove Light Sensor
  5. Grove Temperature Sensor
  6. Grove Loudness Sensor
  7. Grove Multichannel Gas Sensor
  8. Grove Button
  9. Connectors for all the Grove sensors and outputs (6)
  10. Arduino USB cable
  11. USB power pack/Battery pack for arduino

Step 2: Stack It Up!

Stack the Grove Base Shield on top of the Arduino

Step 3: Plug in the Analog Sensors!

  1. Use Grove connectors to plug in Light Sensor to A0,
  2. Temperature Sensor to A1
  3. Loudness Sensor to A2

Step 4: Plug in the I2C Devices!

  1. Use Grove connectors to plug in the Multichannel Gas Sensor,
  2. and the LCD RGB Backlight to I2C sockets

Note: order does not matter since I2C communicates by setting an address rather than being assigned to a specific spot. I have my gas sensor plugged into the leftmost, and the display plugged in to the right of that

Step 5: Plug in the Button!

The button goes in at D8, again connected using the Grove wires

Step 6: Download Libraries

The libraries are in the following links, take a look at the image to see where to download the .zip file for the libraries

Step 7: Add Your Libraries to the Arduino IDE

Go into Sketch --> Include Library --> Add .ZIP Library, and add the two libraries you have just downloaded

Step 8: Add in the Arduino Code


Code for Environmental Sensor that takes air quality, light, temperature, and noise data from the environment to display on a lcd screen */

#include #include "MutichannelGasSensor.h" #include "rgb_lcd.h" rgb_lcd lcd;

const int buttonPin = 8; int buttonPushCounter = 0; int buttonState = 0; int lastButtonState = 0;

void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows Serial.begin(9600); // start serial for output lcd.println("power on!"); lcd.noAutoscroll(); mutichannelGasSensor.begin(0x04);//the default I2C address of the slave is 0x04 //mutichannelGasSensor.changeI2cAddr(0x04); mutichannelGasSensor.doCalibrate(); pinMode(buttonPin, INPUT); }

void loop() { float c; float d; float e; int f; float g; int h; float r; float t; float fah; mutichannelGasSensor.powerOn();

buttonState = digitalRead(buttonPin); // compare the buttonState to its previous state if (buttonState != lastButtonState) { if (buttonState == HIGH) { buttonPushCounter++; } // Delay a little bit to avoid bouncing //delay(50); }

if (buttonPushCounter==0){ c = mutichannelGasSensor.measure_NH3(); lcd.setRGB(155,221,255); lcd.print("NH3:"); if(c>=0) lcd.print(c); else lcd.print("invalid"); lcd.print(" ppm");}

if (buttonPushCounter==1){ d = mutichannelGasSensor.measure_CO(); lcd.setRGB(196,216,226); lcd.print("CO:"); if(d>=0) lcd.print(d); else lcd.print("invalid"); lcd.print(" ppm");}

if (buttonPushCounter==2){ e = mutichannelGasSensor.measure_NO2(); lcd.setRGB(204,255,255); lcd.print("NO2:"); if(e>=0) lcd.print(e); else lcd.print("invalid"); lcd.print(" ppm");}

if (buttonPushCounter==3){ f = analogRead(0); lcd.setRGB(182,134,44); lcd.print("Light:"); if(f>=0) lcd.print(f); else lcd.print("invalid"); lcd.print(" units");}

if (buttonPushCounter==4){ g = analogRead(1); r = (float)(1023-g)*10000/g; //resistance calculation t=1/(log(r/10000)/3975+1/298.15)-273.15; //temperature in celsius fah=t*9/5+32; lcd.setRGB(255,102,255); lcd.print("Temp:"); lcd.print(fah); lcd.print(" *F");}

if (buttonPushCounter==5){ g = analogRead(1); r = (float)(1023-g)*10000/g; //resistance calculation t=1/(log(r/10000)/3975+1/298.15)-273.15; //temperature in celsius lcd.setRGB(255,153,255); lcd.print("Temp:"); lcd.print(t); lcd.print(" *C");}

if (buttonPushCounter==6){ h = analogRead(2); lcd.setRGB(8,30,63); lcd.print("Noise:"); if(h>=0) lcd.print(h); else lcd.print("invalid"); lcd.print(" units");}

if (buttonPushCounter==7){ buttonPushCounter=0; lcd.setRGB(255,255,255); } delay(250); lcd.clear(); }

Step 9: Upload Your Code!

  1. Plug the Arduino into the computer
  2. Make sure your port under tools has selected the correct Arduino
  3. Open up the Environmental_sensor.ino file in the Arduino IDE
  4. Upload the code onto your Arduino

Step 10: Use Your Board!

  1. Unplug the board from the computer
  2. Plug the USB into a USB power source or use an Arduino battery pack to power your project
  3. Click the push button to advance through the sensors: NH3 concentration, CO concentration, NO2 concentration, light level, temperature in Fahrenheit, temperature in Celsius, and noise level

Direct any questions to!

Step 11: Make It Rainbow?!?

Within the code, lcd.setRGB(r,g,b); sets the color of the backlight for each sensor readout screen. With this code, you can set the screen to change through the colors of the rainbow.

Red: lcd.setRGB(255,0,0);

Orange: (255,127,0)

Yellow: (255,255,0)

Green: (0,255,0)

Blue: (0,0,255)

Indigo: (75,0,130)

Violet: (143,0,255)

Rainbow Contest 2016

Participated in the
Rainbow Contest 2016

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Sensors Contest 2016

Participated in the
Sensors Contest 2016

Be the First to Share


    • Meatless Challenge

      Meatless Challenge
    • First Time Author Contest

      First Time Author Contest
    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge


    Gul asfand
    Gul asfand

    5 years ago

    I am using Grow - Multichannel Gas Sensor . I tested it with lpg gas ,smoke and smoke lighter but it nothing show any concentration of gases .please guide about that sensor how to test it .I have already library of Multi channel Gas Sensor . I connected to vcc and gnd pin of multiple Channel gas sensor to arduino vcc and gnd pins and Scl pins connect Scl pin of arduino and sdl pin connect to sdl of arduino through jamper wires i am not using base shield . sir please share me some information about that sensor.


    Reply 5 years ago

    The library was recently updated because people were having problems with it. In my case, I noticed that the sensor was shutting itself off every few cycles, so I included a part in the code to force the sensor to be on for every cycle

    Gul asfand
    Gul asfand

    Reply 5 years ago

    Dear sir ,
    can you please share the code with me beacuse i try many times but Multichanel gas sensor did not detect any gas concertation
    can you mail me code at ( and also guide me about this sensor how to test this sensor
    i am looking forward for you relpy

    Gul asfand
    Gul asfand

    Reply 5 years ago

    Please guide about code and share the code with me and from where I download the updated liabrary


    5 years ago

    Hi all,

    I tried your tutorial but when I upload code on my arduino uno, there is a strange message ( image cf attached )

    Thanks you for your help :)



    6 years ago

    Im torn between the two- Should I used Pi or Arduino for outdoor pollution monitoring?
    I have roughly a budget of $120 USD per node. Can I use both of them together?

    - If pi. What do you do about battery conservation?
    Pushing data to a webpage recomendations?
    Uploading data?

    What sensors should I use? Ive seen someone trying to sell a single CO2 sensor for $50 USD?!?
    CO2, NO, CO, NO2 sensor suggestions?
    Ive been looking at grove
    Some will be battery powered. others by the mains. im going to try 3D print a case for weatherproofing.


    Reply 5 years ago

    I think that the arduino is good enough for this application. It also sounds like you're interested in recording measurements from these sensors over time. It might be worth getting a bluetooth or wifi module to connect the arduino and be able to take in the data. Again, raspberry pi has less support for projects like this and tend to be more energy intensive, so the arduino will be enough.

    It may be worth looking up reviews for various sensors. I was able to get this particular sensor due to a small grant, but I noticed that it is not always dependable.

    Hope the 3D printing goes well! That step is always my favorite part of a project!

    DIY Hacks and How Tos

    I need to make one of these to see just how bad the in my house is.


    Reply 6 years ago

    Grove actually has several gas sensors you can choose from. The multichannel gas sensor is on the pricier side, but depending on your needs, you can select a gas sensor that might be cheaper and still give you the info that you need