Environment Pollution Measurement,IOT Project update for Pre defence United International University

//Soumd and Temperature and Air sensor MQ135 Arduino Code:

#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
float temp;
int tempPin = 1;

int sensorValue;
void setup(){ lcd.begin(16, 2);
Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}
void loop(){int Snd;
Snd=analogRead(0); //connect mic sensor to Analog 0
temp = analogRead(tempPin);
temp = temp * 0.12828125;

Serial.print("Sound=");
Serial.println(Snd,DEC);//print the sound value to serial
lcd.setCursor(0, 0); //sound 1st
lcd.print("Snd=");
lcd.print(Snd);
lcd.print(" ");

sensorValue = analogRead(2); // read analog input pin 2
Serial.print("AirQua=");
Serial.print(sensorValue, DEC); // prints the value read
Serial.println(" PPM");
lcd.setCursor(9,0); //airQ 2nd
lcd.print("AQ=");
lcd.print(sensorValue,DEC);
//lcd.print(" PPM");
lcd.println(" ");
lcd.print(" ");

Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
lcd.setCursor(0, 1); //tmp 3rd
lcd.print("TMP=");
lcd.print(temp);
lcd.print("C");



int value = analogRead(A3);
lcd.setCursor(6, 1); //4th rain
if (value > 500) {
Serial.println("Very heavy Rain");
lcd.print("C Hig rain");}
else if ((value > 300) && (value <= 500)) {
Serial.println("AVERAGE Rain");
lcd.print("C Raining");
lcd.print(" "); }
else{
Serial.println("Dry Weather");
lcd.print("C Dry Wthr");
lcd.print(" ");}
Serial.println(" ");
delay(1000);}

Comments

Popular posts from this blog

Learning to Pray

Arduino and MQ 2 gas sensor