Arduino Weather Station to measure temperature, pressure and humidity

This is a quick project which uses Arduino and two sensors DHT11 and BMP180 to display humidity, temperature and atmospheric pressure to on a small LCD screen.

I first proofed the setup and code on Arduino Uno and then tried to shift it to a cheap Arduino Nano clone for final setup. But after facing some reliability issues with the buggy clone, switched back to Uno.

COMPONENTS

  • DHT11: It measures temperature from 0°C to 50°C and humidity from 20% to 90%. Accuracy is within ±1%. 3 pins
  • BMP180:  It measures barometric pressure between 300hp to 1100hP and temperature -40°C to 80°C. 4 pins
  • Arduino Uno
  • LCD 16 columns and 2 rows. 16 pins. There are models which have I2C interface making connections easier.
  • Connecting wires, bread board, power supply.

As both sensors have temperature measuring capability, I decided to use both. But later realised that readings provided by both differ by 1-1.5 degrees. I tried calibrating using a potentiometer, but it didn’t work. So left it as it is as it’s not going to be used for something very important or sensitive. Pressure settings for BMP180 came pre-calibrated and it’s possible to finetune it more. But for this project, I’ve left it untouched.

Power to Arduino can be provided via a USB cable attached to a spare phone charger or 9V barrel connector. 5V and GND (Ground) mentioned are the power output of Arduino, not any external supply.

CONNECTIONS

LCDCONNECTION
1. VSSGND
2. VDD5V
3.V0GND (You can add a potentiometer
to control LCD brightness)
4. RS13 Arduino
5.RWGND
6.E12 Arduino
7.D0Disconnected
8.D1Disconnected
9.D2Disconnected
10.D3Disconnected
11.D411 Arduino
12.D510 Arduino
13.D69 Arduino
14.D78 Arduino
15.A5V
16.KGND
LCD to Arduino Connections
BMP180CONNECTION
Vin5V
GNDGND
SCLA0 Arduino
SCAA1 Arduino
BMP180 to Arduino Connections
DHT11CONNECTION
Vcc5V
OP3 Arduino
GNDGND
DHT11 to Arduino Connections

If you face problems like program not starting, blank or garbage display, then short TX1 and RX0 pins of Arduino.

After proofing the design on breadboard, I made a messy job of soldering the sensors and LCD on a perfboard. Didn’t have proper casing and too poor for a 3D printer, so used a transparent plastic box which originally had chocolates inside to house the whole setup. Picture was taken before closing and sealing the box.

The basic code was copied from Arduino site but heavily modified to meet my requirements.

CODE

/*  DHT-11 and BMP180 sensors with Arduino Uno
 for Temperature, Pressure and Humidity sensor

//Libraries
#include <Adafruit_BMP085.h>
#include <Wire.h>
#include <DHT.h>
#include <DHT_U.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);//RS,EN,D4,D5,D6,D7


//DHT11 start
//Constants
#define DHTPIN 3     // what pin we're connected to
#define DHTTYPE DHT11   // DHT 11  (AM2302)
// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);

//Variables
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value
//DHT11 end


//bmp085 start
char PRESSURESHOW[4];// initializing a character of size 4 for showing the result
char TEMPARATURESHOW[4];// initializing a character of size 4 for showing the temparature result
Adafruit_BMP085 bmp;
//bmp085 end

 
void setup()
{
  lcd.begin(16, 2);
  dht.begin();
  lcd.clear();//clear display

 
  Serial.begin(9600);
 if (!bmp.begin())
{
Serial.println("ERROR");///if there is an error in communication
while (1) {}
}
}

void loop()
{
   
//bmp085 start
lcd.print("P="); // print name
String PRESSUREVALUE = String(bmp.readPressure()); // convert the reading to a char array
PRESSUREVALUE.toCharArray(PRESSURESHOW, 4);
lcd.print(PRESSURESHOW);
lcd.print("hPa ");
lcd.setCursor(9, 0);
lcd.print("T1=");// print name
 
String TEMPARATUREVALUE = String(bmp.readTemperature());
// convert the reading to a char array
TEMPARATUREVALUE.toCharArray(TEMPARATURESHOW, 4);
lcd.print(TEMPARATURESHOW);
lcd.print("C ");
lcd.setCursor(8, 0);

//bmp085 end

 //DHT11 start 
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values
    lcd.setCursor(0, 1);
    lcd.print("H:");
    lcd.print(hum);
    lcd.print("%");
    lcd.setCursor(9, 1);
    lcd.print("T:");
    lcd.print(temp);
    lcd.println("C");
//DHT11 end 

    delay(2000); //Delay 2 sec.
}

   

Leave a Reply

Your email address will not be published. Required fields are marked *