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