Micro weather station. table no.:-2

Teacher name- Amita Rasal

Students name-Shreyash pul ,Prem Sonowane,Yash Gaikwad

We made weather station successfully as we use dht11 sesor which gets the current status of temperature and other details which is after shared or passed to lcd display and current status of temperature and weather display on it

Code:-#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <DHT.h>
#include <LiquidCrystal_I2C.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP085 bmp;
LiquidCrystal_I2C lcd(0x27,16,2);

int led = 8;
int buzzer = 9;
int button = 7;

int screen = 0;

float maxTemp=-100;
float minTemp=100;
float oldPressure=0;

unsigned long screenTimer=0;

void setup()
{
pinMode(led,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(button,INPUT_PULLUP);

lcd.init();
lcd.backlight();

dht.begin();
bmp.begin();
}

void loop()
{
float temp = dht.readTemperature();
float hum = dht.readHumidity();
float pressure = bmp.readPressure()/100;

if(temp>maxTemp) maxTemp=temp;
if(temp<minTemp) minTemp=temp;

// AUTO SCREEN CHANGE
if(millis()-screenTimer>3000)
{
screen++;
if(screen>9) screen=0;
screenTimer=millis();
}

lcd.clear();

// 1 WEATHER
if(screen==0){
lcd.print(“Temp:”);
lcd.print(temp);
lcd.print(“C”);
lcd.setCursor(0,1);
lcd.print(“Hum:”);
lcd.print(hum);
}

// 2 PRESSURE
if(screen==1){
lcd.print(“Pressure:”);
lcd.setCursor(0,1);
lcd.print(pressure);
lcd.print(“hPa”);
}

// 3 RAIN
if(screen==2){
lcd.print(“Rain Status”);
lcd.setCursor(0,1);
if(pressure<1000 && hum>75)
lcd.print(“RAINING”);
else
lcd.print(“NO RAIN”);
}

// 4 AIR QUALITY
if(screen==3){
lcd.print(“Air Quality”);
lcd.setCursor(0,1);
if(hum<60) lcd.print(“GOOD”);
else if(hum<80) lcd.print(“MODERATE”);
else lcd.print(“POOR”);
}

// 5 DROUGHT
if(screen==4){
lcd.print(“Drought:”);
lcd.setCursor(0,1);
if(temp>35 && hum<40)
lcd.print(“WARNING”);
else
lcd.print(“NORMAL”);
}

// 6 EARTH WATER
if(screen==5){
lcd.print(“Earth Water”);
lcd.setCursor(0,1);
if(hum>80) lcd.print(“HIGH”);
else if(hum>50) lcd.print(“NORMAL”);
else lcd.print(“LOW”);
}

// 7 MINING
if(screen==6){
lcd.print(“Mining:”);
lcd.setCursor(0,1);
if(temp>36 && hum<35)
lcd.print(“DETECTED”);
else
lcd.print(“NORMAL”);
}

// 8 WIND SPEED
if(screen==7){
float change = abs(pressure-oldPressure);
lcd.print(“Wind Speed”);
lcd.setCursor(0,1);

if(change<0.5)
  lcd.print("CALM");
else if(change<1.5)
  lcd.print("MODERATE");
else
  lcd.print("STRONG");

oldPressure=pressure;

}

// 9 DUST LEVEL
if(screen==8){
lcd.print(“Dust Level”);
lcd.setCursor(0,1);

if(hum>70)
  lcd.print("LOelse if(hum>40)
  lcd.print("MEDIUM");
else
  lcd.print("HIGH");

}

// 10 MAX MIN TEMP
if(screen==9){
lcd.print(“Max:”);
lcd.print(maxTemp);
lcd.setCursor(0,1);
lcd.print(“Min:”);
lcd.print(minTemp);
}

// ALERT SYSTEM
if(temp>35 || hum>80){
digitalWrite(led,HIGH);
tone(buzzer,900);
}
else{
digitalWrite(led,LOW);
noTone(buzzer);
}

delay(500);
}

Principle:- It shows current temperature and humidity of air and also shows quality of air and pressure of it.

Component:- 1.Arduino uno , 2.lcd 16×2. ,3.display module,4.bread board,5.DTH11, and others.

P

1 Like

Add details about working .
and team details.

Approved for stage 2.
Return the arduino and collect ESP.