Introduction: Environmental Pollution Visualization Machine

Picture of Environmental Pollution Visualization Machine

Step 1: Assembly Part 1

Picture of Assembly Part 1

For this project, we used two other instructables as a base:

To begin, you must first assemble the Environment Monitor. Due to the nature of our project, we did not include the light or temperature sensors from the original instructable. This also means that the code for these two pieces of hardware must be either deleted or commented out of the code.

To assemble the electronics, first place the baseshield on the arduino. Make sure the slots on the shield match up with the slots on the arduino. Next, the sensors, button, and LCD screen must be inserted onto the base shield

  • Plug the LCD screen into the rightmost I2C slot on the baseshield.
  • Plug the button into the D8 slot on the baseshield.
  • Plug the loudness sensor into the A2 slot on the baseshield.
  • Plug the Multichannel gas sensor into the leftmost I2C slot on the baseshield.
  • Make sure the switch on the base shield is flipped towards the green LED.

Step 2: Import Code

Picture of Import Code

The next step involves loading the proper code onto the arduino.

First, we imported the appropriate libraries for the LCD screen and Multichannel Gas Sensor. They can be found here:

After those libraries have been imported and included, we uploaded the code from the Air Pollution and Environment Monitor.

*In order for the code to work, the code light and temperature sensors must be commented or deleted out of the document as such:

// 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");}

Step 3: Get Readings

Picture of Get Readings

After assembling the gas sensor, our team walked around Georgia Tech's campus in Midtown Atlanta to get readings for the gas sensor thresholds. This way, we could program thresholds that would react to the environment.

After obtaining readings from various places around the campus, we put them into a spreadsheet and calculated the averages. These averages were then used as the thresholds for the fan. Should the reading levels ever go above these levels, the fan would turn on, releasing the dry ice fog. In turn, these values could be replaced with other areas' averages or other values, such as the most ideal gas level values.

Step 4: Assembling the Fan

Picture of Assembling the Fan

In order to activate the fan, we needed a more powerful source of energy than the arduino. To remedy this issue, we used a relay that completes the circuit, relaying power to the fan, when the gas sensor reads a value at or above the threshold for the gases.

To connect to the relay, we attached a wire from pin 13 on the arduino to the IN1 slot on the relay, another wire from the ground of the arduino to the ground on the relay, and one wire from the 5V slot on the arduino to the VCC on the relay. We then soldered the negative end of the fan to the negative end of the 9V battery clip. The positive end of the battery clip was slotted into the middle port of K1 on the relay and the positive end of the battery was inserted into the right slot of K1 of the relay.

Step 5: Program the Fan

In order to operate the relay, we added simple if statements into the commands operating the gas readings, as well as the necessary commands to activate the relay from the arduino. In order to use this, simply copy-paste the code below:

#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);
pinMode(13,OUTPUT);
}

void loop() {
digitalWrite(13,HIGH);
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);
digitalWrite(13,HIGH);
lcd.print("NH3:");
if(c>=0){lcd.print(c);
if(c>=.213){
digitalWrite(13,LOW);
}
else{
digitalWrite(13,HIGH);
}
}
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);
if(d>=1.36){
digitalWrite(13,LOW);
}
else{
digitalWrite(13,HIGH);
}
}
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);
if(e>=.359)
{
digitalWrite(13,LOW);
}
else{
digitalWrite(13,HIGH);
}
}
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==3){
h = analogRead(2);
lcd.setRGB(8,30,63);
lcd.print("Noise:");
if(h>=0){lcd.print(h);
if(h>=26.25){
digitalWrite(13,LOW);
}
else{
digitalWrite(13,HIGH);
}
}
else lcd.print("invalid");
lcd.print(" units");
}

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

In order to amend the thresholds, simply replace the value in the if statement for each value. For instance, if changing the sound threshold, in the statement that says if(h>=26.25), replace the 26.25 with the corresponding value. This will not change how the LCD displays the values.

Step 6: Firmly Attach to Container

Picture of Firmly Attach to Container

Keeping all of the components together is key. In order to do this, we were originally going to use a coffee tin, but quickly realized that it was not the appropriate size for the fan. We used a large laundry detergent container. It is important that this container does not leak and it is preferable if it is insulated, although that is not necessary.

First, attach all of the hardware to a solid base. We used small pieces of balsa wood due to it's soft and easily mountable structure. Then attach the hardware in a way that will not get the arduino and other hardware wet (sans the fan, this will get wet no matter what). We then attached these strips of balsa wood to the container with duct tape.

In order to install the fan, simply trace out a hole on the lid of the container roughly smaller than the hole for the blades of the fan (not the size of the fan!). Then, if the fan has screws for mounting, drill the appropriate holes into the container lid and use screws and balsa wood to keep the fan secure. If the fan does not have screw holes, simply hot glue the fan onto the lid.

Step 7: Test!

In order to test the device, simply plug in the 9V battery to the arduino. Walk around with the device and make sure that it is reading the environment. Once it activates the fan at the appropriate thresholds, add in a few chunks of dry ice and pour hot water on the dry ice, creating fog. Some fog will leak out of the top, but large dispersals of fog won't occur unless the sensors monitor values above the appropriate thresholds.

Step 8: Final Thoughts

Although our project worked the way we wanted it to, we do have some design improvements we would like to implement:

  • Due to the size of the fan, we were unable to attach it to a container that would fit safely and securely on a bike. For the next iteration, we would like to find a 12V fan that is smaller in order to accommodate a smaller container size.
  • The overall look of the project is somewhat menacing. We would like to include covers for the components, as well as a noise shield to cut down on the ticking of the relay.
  • The speed of the fan can often dissipate the fog too quickly. For the next iteration, we would also like to incorporate a speed control on the fan so that the fog will not be so quickly blown away.

Comments

KarlM15 (author)2016-11-12

Replace the relay with an mosfet, its so simple, you only need a mosfet and a pull down resistor (for an example 10k resistor). Quiet and a more durable system... :P

tomatoskins (author)2016-09-26

Great project!

About This Instructable

1,487views

24favorites

License:

More by HaydenR4:Environmental Pollution Visualization Machine
Add instructable to: