Portable Weather Station

Published Oct 16, 2018
 7 hours to build
 Beginner

A weather station can be described as an instrument or device, which provides us with the information of the weather in our neighbouring environment. This device basically senses the temperature, pressure, humidity. There are various types of sensors present in the prototype, using which all the aforementioned parameters can be measured. With the help of temperature,humidity & pressure we can calculate other data parameters, such as the dew point,heat index and altitude.

display image

Components Used

DHT11
DHT11 is a single wire digital humidity and temperature sensor, which gives relative humidity in percentage and temperature in degree Celsius.
2
BMP180 Digital Pressure sensor
BMP180 is an ultra low power, high precision barometric pressure sensor with I2C serial interface.
2
LCD 16x2 Display Module
LCD16x2 has two lines with 16 character in each line. LCD16x2 is generally used for printing values and string in embedded application.
1
LCD16x2 Display
LCD16x2 Display
1
Arduino Nano
Arduino Nano
1
5V 2A Power bank
Adafruit Accessories USB Li-Ion Power Bank with 2 x 5V Outputs @ 2.1A - 5000mAh
1
Description

Portable Weather Station

Digital Sensors

1) DHT11 - Temperature and Humidity Sensor :- This sensor makes it really easy to add humidity and temperature data to your DIY electronics projects. It’s perfect for remote weather stations, home environmental control systems, and farm or garden monitoring systems.

Here are the ranges and accuracy of the DHT11:

  • Humidity Range: 20-90% RH
  • Humidity Accuracy: ±5% RH
  • Temperature Range: 0-50 °C
  • Temperature Accuracy: ±2% °C
  • Operating Voltage: 3V to 5.5V

Using DHT 11 we can also calculate parameters such as -

  • Relative Humidity - The DHT11 measures relative humidity. Relative humidity is the amount of water vapor in air vs. the saturation point of water vapor in air.
RH = (\frac{\rho_{w}}{\rho_{s}}) \ x \ 100 \% \\  \\  RH: \ Relative \ Humidity \\  \rho_{w}: \ Density \ of \ water \ vapor\\  \rho_{s}: \ Density \ of \ water \ vapor \ at \ saturation
  • Dew Point- The atmospheric temperature (varying according to pressure and humidity) below which water droplets begin to condense and dew can form.

           gamma = log(humidity/100) + ((17.62*temperature) / (243.5+temperature)); 
           dp = 243.5*gamma / (17.62-gamma);

  • Heat Index -It is a measure of how hot it really feels when relative humidity is factored in with the actual air temperature.

Before you can use the DHT11 on the Arduino, you’ll need to install the DHTLib. It           has all the functions needed to get the humidity and temperature readings from the           sensor.

Connection diagram for DHT11     

Arduino DHT11 Tutorial - 4 Pin DHT11 Wiring Diagram
Circuit connection

2) BMP180 - It is a great sensor that can be used to predict the weather, detect altitude, and measure vertical velocity. It’s perfect for weather stations, remote controlled vehicles, weather balloons, and lots of other projects. It’s an extremely sensitive sensor too. 

 

Arduino Pressure Sensor Tutorial - BMP180 Pin Diagram
How to Set Up a Keypad on an Arduino - Arduino I2C Pins

 

Arduino Barometric Pressure Sensor - BMP180 Wiring Diagram

Before you can use the BMP180 on the Arduino, you’ll need to install the BMP180_Breakout_Arduino_Library-master . It has all the functions needed to get the pressure and temperature readings from the sensor.

3) LCD - LCD stands for Liquid Crystal Display, there are various types of LCD's available in the market. We have made use of 16x2 LCD 

Image result for 16x2 lcd

 

This is the Connection Diagram of LCD with Arduino -

Arduino LCD
  • 4bit Data communication is made used hence pins namely D4,D5,D6,D7 are connected to the Arduino board's Digital pins.
  • The First and the Second pins are Ground and +5V supply respectively.
  • The Third pin is connected to the potentiometer to vary the contrast of the crystals.
  • The Fourth pin is known as Register Select pin, it is connected to the arduino board
  • The Fifth pin is known as Read/Write pin. This pin is connected to ground
  • The Sixth pin is the Enable pin which is cocnnected to the arduino board

 

Output

 

Picture - 1

Stage 1 - LCD displaying Heat Index and Dew Point values

 

 

Picture -2

Stage 2- LCD displaying Pressure and Altitude values

 

 

Picture-3

Stage 3-LCD Displaying Temperature and Humidity values

Coding

The combined code using DHT11, BMP 180 and LCD is given below

#include <LiquidCrystal.h> 
#include "DHT.h" 
#define DHTPIN 7    
#include <Wire.h> 
#include <SFE_BMP180.h> 
#define DHTTYPE DHT11   // DHT 11 

SFE_BMP180 bmp180; 
DHT dht(DHTPIN, DHTTYPE); 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 


void setup() 
{ 
 lcd.begin(16, 2); 
 Serial.begin(9600); 
 Serial.println("DHTxx test!"); 
 dht.begin(); 
 bool success = bmp180.begin(); 
 if (success) 
 { 
   Serial.println("BMP180 init success"); 
 } 
} 

void loop()  
{ 
 // Wait a few seconds between measurements. 
 delay(2000); 
 // Reading temperature or humidity takes about 250 milliseconds! 
 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) 
 float h = dht.readHumidity(); 
 // Read temperature as Celsius (the default) 
 float t = dht.readTemperature(); 
 // Read temperature as Fahrenheit (isFahrenheit = true) 
 float f = dht.readTemperature(true); 
 // Check if any reads failed and exit early (to try again). 
 if (isnan(h) || isnan(t) || isnan(f))  
 { 
   Serial.println("Failed to read from DHT sensor!"); 
   return; 
 } 

 // Compute heat index in Fahrenheit (the default) 
 float hif = dht.computeHeatIndex(f, h); 
 // Compute heat index in Celsius (isFahreheit = false) 
 float hic = dht.computeHeatIndex(t, h, false); 
  
 Serial.print("Humidity: "); 
 Serial.print(h); 
 Serial.print(" %\t"); 
 Serial.print("Temperature: "); 
 Serial.print(t); 
 Serial.print(" *C "); 
 Serial.print(f); 
 Serial.print(" *F\t"); 
 Serial.print("Heat index: "); 
 Serial.print(hic); 
 Serial.print(" *C "); 
 Serial.print(hif); 
 Serial.println(" *F"); 
 double gamma = log(h/100) + ((17.62*t) / (243.5+t)); 
 double dp = 243.5*gamma / (17.62-gamma); 
 Serial.print("Dew point:        "); 
 Serial.print(dp); 
 Serial.print("C"); 
 Serial.println(); 
 delay(1000); 

 lcd.setCursor(0,0);  
 lcd.print("Temp:    "); 
 lcd.print(t); 
 lcd.print((char)223); 
 lcd.print("C"); 
 lcd.setCursor(0,1); 
 lcd.print("Humidity: "); 
 lcd.print(h); 
 lcd.print("%"); 
 delay(1000); 


 lcd.setCursor(0,0); 
 lcd.print("Heat Idx:"); 
 lcd.print(hic); 
 lcd.print("C  "); 
 lcd.setCursor(0,1); 
 lcd.print("Dew Pt: "); 
 lcd.print(dp); 
 lcd.print(" C "); 
 lcd.println(); 
 delay(1000); 
  
  
 char status; 
 double T, P,alt; 
 bool success = false; 
 float Po = 1013.0; 


 status = bmp180.startTemperature(); 

 if (status != 0) { 
   delay(1000); 
   status = bmp180.getTemperature(T); 

   if (status != 0) { 
     status = bmp180.startPressure(3); 

     if (status != 0) { 
       delay(status); 
       status = bmp180.getPressure(P, T); 

       if (status != 0) { 
         lcd.setCursor(0,0); 
         lcd.print("Press: "); 
         lcd.print(P); 
         lcd.println(" hPa"); 
          
         alt = bmp180.altitude(P, Po); 
          
         lcd.setCursor(0,1); 
         lcd.print("Alt: "); 
         lcd.print(alt); 
         lcd.println("M    "); 
          
       } 
     } 
   } 
 } 
  
  
  
} 
 
Comments
Ad