How to Build An Arduino Weather Station

By Manas Manohar and Ajay Narayanan

 

Arduino weather station

 

How cool would it be to have your own Arduino weather station right in your backyard? Sounds fun? Geeky? Having your own weather station means that you don’t need any more inaccurate results from the weather channel! You can even log the data and play around with it. Set mood lighting according to the weather? Why not? This tutorial will get you kick-started with your own DIY Weather Box to chart out local weather. What are you waiting for? Let’s get started!

Bill of Materials

Arduino weather station components

  1. Arduino Uno
  2. DHT11 (Temperature and Humidity Sensor)
  3. 16*2 character LCD display
  4. Potentiometer
  5. Jumper Wires (Male to Female(MF) and Female to Female(FF))
  6. Header Pins
  7. Glue gun

How Does it Work?

So we’ve got this ultra-low-cost sensor called the DHT11. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the data pin. Since the output data isn’t analog, it requires some coding to get the data, but don’t sweat it. It’s got its own library that takes care of the hard parts. It’s fairly simple to use but requires careful timing to grab data. You can only get new data from it once every 2 seconds, but that’s more than enough for our Arduino weather station.

dht11 sensor

Connecting the Headers for the Arduino Weather Station

Since you’re going to be using an LCD display for your Arduino weather station, you’ll need to solder the pin headers onto the LCD. The best way to do this is to affix header pins onto the Arduino and use jumpers to connect it to the LCD display.

  1. Place the header pins onto the ports of the Arduino, and make sure that there’s contact and that the header pins are not loose.
  2. Carefully, using a glue gun, glue the header pins onto the Arduino, keeping sure that it doesn’t get loose while you’re doing it.
    Arduino weather station

    Image courtesy: MIYmakers.com

  1. Now solder the LCD display onto the header pins after aligning it on top of the LCD display.

 

Arduino weather station LCD

Wiring the Circuit for the Arduino Weather Station

Connect the Arduino, LCD display, DHT11 sensor, and potentiometer as shown in the connection diagram below.

 

Arduino weather station Connection diagram                                                                             Image courtesy: MIYmakers.com

 

LCD connections

LCD D7 ­–>DIGITAL PIN 2
LCD D6 –> 3
LCD D5 –> 4
LCD D4 –> 5
LCD E – > 11
LCD RS –> 12
LCD VDD –> (+) RAIL BREADBOARD
LCD A –> (+) RAIL BREADBOARD

LCD VSS –> (-­)RAIL BREADBOARD
LCD K –>(­-)RAIL BREADBOARD
LCD RW –> (-­)RAIL BREADBOARD
LCD VO –> Potentiometer Middle Pin

Installing the DHT11 Library for Arduino

Download the Arduino DHT11 library.

Next, open Arduino IDE, Go to Sketch –> Include Library –> Add Zip File and then close the Arduino IDE and open it again. After doing this, you will find the library included.

For more info on how to add libraries, visit the Arduino website.

Uploading the Code for the Arduino Weather Station

Copy and paste the code below into your Arduino IDE and save the sketch. Next, upload the code to your Arduino.

 

#include 
#include 

//led blink tutorial!
//Get more tutorials on --> --> -->
//"MIYMAKERS" https://miymakers.wordpress.com/

#define dht_dpin A1 //no ; here. Set equal to channel sensor is on
dht DHT;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
 
  ;lcd.begin(16, 2);
  lcd.print("TEMP HUMIDITY");
  Serial.begin(57600); 
}
void loop(){
  lcd.setCursor(1,3);
  DHT.read11(dht_dpin);
  
  //lcd.print(abs(moisture)); 
  //Serial.println(moisture);
  lcd.print(round(DHT.temperature));
  lcd.print("C  "); 
  lcd.print(round(DHT.humidity));
  lcd.print("%   "); 
}


Finding an Enclosure for Your Arduino Weather Station

  1. Take an old plastic box or container. Since we are going to place it outside, don’t use stuff like thermocol that easily wears out.
  2. Cut holes for the LCD Screen and the DHT11 sensor carefully using a paper knife. If you are using a battery to power the Arduino, make sure there’s space for that. If you’re going to use an adapter, cut a hole for the wire as well
  3. Place the Arduino circuit inside the Box and make sure nothing obstructs the display and DHT11 sensor
  4. After going outside, calibrate the contrast of the display so that you can easily see the output

That’s it! Your very own Arduino weather station is ready for use!

 

Arduino weather station                                                                      Image courtesy: MIYmakers.com

Recommended Posts
Showing 12 comments
  • Ben
    Reply

    code wasnt working for me had to change to the below

    #include “DHT.h”
    #include

    #define dht_dpin A1
    #define dht_type DHT11

    DHT dht(dht_dpin, dht_type);
    LiquidCrystal lcd(13, 11, 5, 4, 3, 2);

    void setup(){

    lcd.begin(16, 2);
    lcd.print(“TEMP HUMID”);
    }

    void loop(){
    lcd.setCursor(1,3);

    int myTemp = dht.readTemperature();
    lcd.print(round(myTemp));
    lcd.print(“C “);

    int myHum = dht.readHumidity();
    lcd.print(round(myHum));
    lcd.print(“% “);

    }

  • Ojay
    Reply

    Your first and second lines of codes are not having header file names…#include…?

  • skjdbf
    Reply

    You shouldn’t use DHT11, it’s really not reliable, worst case scenario maybe DHT22. A better choice is DS18B20 for temperature, also waterproof, and a separate capacitive for humidity.

  • vat
    Reply

    vat de fak

  • Internet of Things
    Reply

    You shouldn’t use DHT11, it’s really not reliable, worst case scenario maybe DHT22. A better choice is DS18B20 for temperature, also waterproof, and a separate capacitive for humidity.

    • Amer AlKinani
      Reply

      I’ve compared the DHT11 to a regular thermometer and it seems to be pretty accurate.
      The DS18B20 would be better but wouldn’t make a drastic difference

  • Linear Servo
    Reply

    Great Project, Thanks!

  • Kevin
    Reply

    Yo, Code isn’t working? Got any tips. Copy/Pasted the code and it says: #include expects “FILENAME” or

  • Nath
    Reply

    What Potentiometer do? and What size Potentiometer ?

  • Nathan Crout
    Reply

    my computer is having trouble verifying the code is there any simplified version of the code?

  • pet shop
    Reply

    That is very interesting, You’re a very skilled blogger.
    I’ve joined your feed and sit up for looking for extra of your wonderful
    post. Additionally, I have shared your web site in my social networks!

    • Manas Manohar
      Reply

      Thanks Buddy!
      Follow me on fb :www.facebok.com/miymakers

Leave a Comment

+ 69 = 73

Start typing and press Enter to search