0% found this document useful (0 votes)
25 views9 pages

Weather Station

Uploaded by

Rohan Ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

Weather Station

Uploaded by

Rohan Ashish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

It is a system that involves in acquiring weather and environment data using

advanced electronic sensors and sending them to a web server

Components used in this project


Hardware components

Arduino UNO × 1

Espressif ESP8266 ESP-01 × 1


DHT11 Temperature & Humidity Sensor (4 pins) × 1

MQ 135 × 1

12c Adapter × 1

RGB LCD Shield Kit, 16x2 Character Display × 1

23
Solderless Breadboard Half Size × 1 /.23
.

Jumper wires (generic) × 1

Software apps and online services

ThingSpeak API

Abstract
In this post we are going to construct an IoT based weather monitor system
using Arduino which can report us weather status like atmospheric pressure,
temperature, humidity, air quality, light intensity etc. of our locality in real time
and the data from the sensors are logged to an IoT cloud service called
Thingspeak for monitoring and analysis.

An IoT based weather monitoring system using ThingSpeak is a project that


involves collecting and analyzing data from various sensors deployed in
different geographical locations. The data is transmitted over the internet and
stored in the ThingSpeak cloud platform, where it can be visualized and
analyzed in real-time.

Here's how the system works:

 Hardware Setup: The system comprises of a microcontroller, such as an


Arduino or Raspberry Pi, connected to various sensors that measure
environmental parameters such as temperature, humidity, air pressure, wind
speed, and rainfall. These sensors are placed in different locations to collect
data from various geographical areas.
 Data Collection: The sensors continuously measure the environmental
parameters and send the data to the microcontroller, which then transmits
the data to the ThingSpeak cloud platform using Wi-Fi or Ethernet
connectivity.

 Data Storage: The ThingSpeak platform stores the data received from the
sensors in its cloud database. The platform can store up to 8 fields of data
per channel, and each channel can store up to 8,192 messages. ThingSpeak
also provides the ability to store and visualize historical data.

 Data Analysis: ThingSpeak provides various built-in MATLAB functions that


can be used to analyze the data in real-time. The platform also supports
third-party services like MATLAB Analysis and Visualizations, which can be
used to perform complex data analysis.

 Data Visualization: ThingSpeak provides various visualization tools that can


be used to create charts, graphs, and maps to display the collected data.
These tools help in visualizing the data in an easy-to-understand format,
making it easier for end-users to interpret the data.
1/8

Schematics
Code

#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
#include <dht.h>
#include <Wire.h>
#include <BMP180.h>
dht DHT;
LiquidCrystal_I2C lcd(0x27, 16, 2);
SoftwareSerial mySerial(10, 11);
BMP180 myBMP(BMP180_ULTRAHIGHRES);
#define DHT11_PIN A0
#define mq135_pin A2
#define LDR A1
void ReadDHT(void);
void ReadBMP(void);
void ReadAir(void);
void send_data(void);
bool BMP_flag = 0;
bool DHT_flag = 0;

void setup()
{
mySerial.begin(115200);
pinMode(mq135_pin, INPUT);
pinMode(LDR, INPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" IoT Weather ");
lcd.setCursor(0, 1);
lcd.print("Monitor System");
delay(1500);
}

void loop()
{
ReadDHT();
ReadBMP();
ReadAir();
Readlight();
send_data();
}

void ReadDHT(void)
{
lcd.clear();
int chk = DHT.read11(DHT11_PIN);
switch (chk)
{
case DHTLIB_OK:
DHT_flag = 1;
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(DHT.temperature, 1);
lcd.print(" *C");
lcd.setCursor(0, 1);
lcd.print("Humi: ");
lcd.print(DHT.humidity, 1);
lcd.print(" %");
break;
case DHTLIB_ERROR_CONNECT:
lcd.setCursor(0, 0);
lcd.print("NO DHT11 SENSOR");
lcd.setCursor(0, 1);
lcd.print(" FOUND! ");
break;
case DHTLIB_ERROR_CHECKSUM:
case DHTLIB_ERROR_TIMEOUT:
case DHTLIB_ERROR_ACK_L:
case DHTLIB_ERROR_ACK_H:
default:
DHT_flag = 0;
lcd.setCursor(0, 0);
lcd.print(" DHT11 SENSOR ");
lcd.setCursor(0, 1);
lcd.print(" ERROR ");
break;
}
delay(2000);
}

void ReadBMP(void)
{
lcd.clear();
if (myBMP.begin() != true)
{
lcd.setCursor(0, 0);
lcd.print(" BMP180 SENSOR ");
lcd.setCursor(0, 1);
lcd.print(" NOT FOUND ");
BMP_flag = 0;
delay(2000);
}
else
{
BMP_flag = 1;
lcd.setCursor(0, 0);
lcd.print("Pa(Grnd):");
lcd.print(myBMP.getPressure());
lcd.setCursor(0, 1);
lcd.print("Pa(sea) :");
lcd.print(myBMP.getSeaLevelPressure(115));
}
delay(2000);
}

void ReadAir(void)
{
int airqlty = 0;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("AIR QUALITY:");
airqlty = analogRead(mq135_pin);
lcd.print(map(analogRead(mq135_pin), 0, 1024, 99, 0));
lcd.print("%");
lcd.setCursor(0, 1);
if (airqlty <= 180)
lcd.print("GOOD!");
else if (airqlty > 180 && airqlty <= 225)
lcd.print("POOR");
else if (airqlty > 225 && airqlty <= 300)
lcd.print("VERY BAD");
else
lcd.print("TOXIC");
delay(2000);
}

void Readlight(void)
{
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("LIGHT :");
lcd.print(map(analogRead(LDR), 0, 1024, 0, 99));
lcd.print("%");
lcd.setCursor(0, 1);
lcd.print("****************");
delay(2000);
}

void send_data()
{
mySerial.print('*'); // Starting char
if (DHT_flag == 1)
{
mySerial.print(DHT.temperature, 0); //2 digit data
mySerial.print(DHT.humidity, 0); //2 digit data
}
else
{
mySerial.print("0000"); // Send dummy data
}
if (BMP_flag == 1)
{
mySerial.print(myBMP.getPressure()); //5 digit data
}
else
{
mySerial.print("00000");// Send dummy data
}
mySerial.print(map(analogRead(LDR), 0, 1024, 0, 99)); //2 digit data
mySerial.print(map(analogRead(mq135_pin), 0, 1024, 99, 0)); //2 digit data
mySerial.println('#'); // Ending char
}

You might also like