Arduino WiFi Wireless Weather Station Wunderground

36K17680

Intro: Arduino WiFi Wireless Weather Station Wunderground

In this Instructable I am going to show you how to build personal wireless weather station using Arduino

A Weather station is a device that collects data related to the weather and environment using many different sensors. We can measure many things like:

  • Temperature
  • Humidity
  • Wind
  • Barometric Pressure
  • UV index
  • Rain

Mine inspiration to create this weather station is Greg from www.cactus.io Davis anemometer, wind speed and rain meter Arduino code copyright rights belong to him.

I'm using Arduino Uno as main board.

ESP8266 WiFi module will send data to www.wunderground.com

Weather Underground is a commercial weather service providing real-time weather information via the Internet.

I will use these sensors:

  • Temperature - Dallas DS18B20
  • Humidity, Pressure - BME280
  • UV, Solar - ML8511
  • Anenometer and wind direction - Davis 6410
  • Rain gauge - Ventus W174

STEP 1: Parts

The parts needed in order to build this project are the following:

  1. Arduino Uno
  2. ESP8266 ESP-01 or ESP-12
  3. BME280
  4. ML8511
  5. Davis 6410
  6. Ventus W174

STEP 2: Schematic and Wiring Diagram

STEP 3: PCB Arduino Uno Weather Station Shield

Design printed circuit board (PCB), I was used ,,Sprint-Layout" software. Exported to Gerber files.

To create this Arduino Uno weather station shield you will need:

  1. ML8511 UVB UV Rays Sensor Breakout UV Light Sensor Analog Output for Arduino Ebay
  2. Waterproof Digital Thermal Probe or Sensor DS18B20 Arduino Sensor Ebay
  3. JST-XH Kit 4Pin 2.54mm Terminal Housing PCB Header Wire Connectors Ebay
  4. Atmospheric Pressure Sensor Temperature Humidity Sensor Breakout BME280Ebay
  5. 1x ESP8266 ESP12F Ebay
  6. 1x 1k 0805 resistor
  7. 1x 120R 0805 resistor
  8. 8x 0R 1206 jumper ( resistor)
  9. copper board
  10. 2x 4.7K resistor
  11. 1x 10k resistor
  12. 1x 3mm led
  13. 1x RJ45 socket Ebay
  14. 1x 47uF electrolytic capacitor
  15. 1x 40pins header pins Ebay
  16. 1x Voltage Regulator Sot-223 Ams1117 Ams117-3.3 3.3V 1A Ebay
  17. 1x 2.54mm Pitch Switch DIP 2 Ebay

STEP 4: Arduino Sensors Libraries, Manual and Other Information

1) Arduino weather station project www.cactus.io

2) Davis 6410 anemometer manual http://www.davisnet.com/product_documents/weather...

3) Adafruit BME280 Driver (Barometric Pressure Sensor) library https://github.com/adafruit/Adafruit_BME280_Libra...

4) ML8511 UV Sensor Library https://learn.sparkfun.com/tutorials/ml8511-uv-se...

5) Arduino Library for Maxim Temperature Integrated Circuits DS18B20 DS18S20 - Please note there appears to be an issue with this series. DS1822 DS1820 MAX31820 https://github.com/milesburton/Arduino-Temperatur...

6) Library for Dallas/Maxim 1-Wire Chips https://github.com/PaulStoffregen/OneWire

7) Wunderground (Personal Weather Station Upload Protocol)

https://feedback.weather.com/customer/en/portal/articles/2924682-pws-upload-protocol?b_id=17298&fbclid=IwAR3KTp6uTCxjdVCiXmoIvPpYdJHAtREcrRUaH41NJSM4k-LqnDaybckqxu8

8) NodeMCU weather station http://chynehome.com/web/station-meteo-a-base-de-e...

STEP 5: Soldering PCB

Weather station shield I was ad in to Raspberry Pi case. I think it looks better.

STEP 6: Installing Personal Weather Station

The location weather station is the most important part of
installation. If weather station is located under a tree or an overhang, the rainfall data measured by the station will not be correct. If you place your weather station in an alley, you could very well get a wind tunnel effect on the anemometer, resulting in erroneous wind data. Weather station should have good "fetch", or distance from any other tall object.

The standard wind measurement should be taken at 10 meters above the ground. A roof-top works the best for me.

Weather station is powered from solar panel. So it is autonomous.


The most common error in installing a weather station is associated with misplacing the thermometer sensor. Meteorologists define temperature as the temperature in shade with plenty of ventilation. When placing weather station, make sure:

  • The thermometer sensor never receives direct sunlight.
  • The thermometer receives plenty of ventilation and is not blocked from the wind.
  • If the thermometer is placed on a roof-top, make sure it is at least 1.5 meters above the roof-top.
  • If the thermometer is placed above grass, again, it should be at least 1.5 meters above the grass surface.
  • The thermometer is at least 15 meters from the nearest paved surface.

So I'm using weather shelter. I made it from PVC tube. This way, weather station can be placed in direct sunlight, with the thermometer located inside the shelter.

More information about installing weather station here

STEP 7: ESP8266 AT Commands

First it need prepare ESP8266 wifi modulle. Change CWMODE into 1 = Station mode(Client) and connect ESP8266 to your WiFi router.
I'm using usb to ttl serial adapter. Its need only connect 4 wire ( +3.3V, GND TX,RX)

Or you can use Arduino to send AT comands to ESP8266.

AT commands:

AT

AT+CWMODE?

AT+CWMODE=1

AT+CWJAP="your ssd","password"

more AT commands here

STEP 8: Arduino Code

    1. Before upload code into your Arduino Uno register in wunderground.com to obtain a WU station ID and key/password

    2. Change this ID and key/password into your weather station Arduino code.

    • char ID [] = "xxxxxxxx"; //wunderground weather station ID
    • String PASSWORD = "xxxxxxxx"; // wunderground weather station password

    3. Change altitudepws to get relative pressure meters (m)

    4. #define DEBUG 1 // if you only check sensors data.

    5. I'm using 30 second loop time sending data to Wunderground.com. 25 seconds I will take to measure wind speed. Other time is for read sensor data.


    STEP 9: Result

    It is working and sending sensors data to Wunderground.com. I'm very happy ;)

    STEP 10: IoT Personal NodeMCU ESP12 WiFi Wireless Weather Station V2

    62 Comments

    How do you protect the ML8511 sensor from the elements, I assume this UV sensor is outdoors?
    Hello, friend. My Arduino PWS suddenly started to show High UV count. Even on DEBUG mode and without the sensor connected (with sensor connected it shows 6.xx, 4.xx even when covering the sensor). When connected and sending data it is showing 15 UV in WU. I check all solders in the whole board, checked for shorts under the microscope, etc, etc. Do you have any hints?
    Hello,

    Sorry I didn't correct this line. Find this and change it.
    Well, this is really weird. The problem persists. UV sensor always shows a value, even with the correction above (numbers are smaller now). I tested with a completely new Arduino Uno board, without any sensor connected. Temperature is always -65.80 and UV sensor always has a value. If I connect everything, temperature shows ok, UV still shows weird values even without UV. I noticed that my station never reconnected to WU anymore (probably because of spurious values). I don't know what to do from now, thought of a problem with the libraries (I updated them in january but it was not apparent the error, nor happened immediately). Deleted all of them and loaded only the ones here on the website. Same problem occurs. I'll try to reconnect UV sensor with shorter cables (using 50cm cable, kinda short), last resort, since it is glued under glass. Since the problem arises without any sensors I doubt it's in there.
    That's too bad, everything was working so good.

    Hello. Thanks for your time, friend. I changed and reuploaded. It improved the numbers but the board still is showing UV when there is no sensor connected. I already etched a new one, thicker one and will make another just to make sure. Thank you a lot, Rimvydas, it's been a lot of fun playing with this PWS project.
    I don't know exactly how but WU is working with the old API? I am sending data there until the parts for the V2 arrive. :) Here's my PWS for anyone interested: https://www.wunderground.com/dashboard/pws/ISOJOS3...
    I am still in process of testing the pluviometer so the 73 mm/hour (lol) it's just the testing.
    Hi I have made this project and its now working. I am sending data to thingspeak not wunderground.
    My issue is it it working "too well" as it is sending data every minuite or so and killing the battery pack (a 3s 18650 with a solar panel)
    I am not a coder but I get by modding and merging other code.
    How can I send data less often?

    Fantastic project by the way and thanks for sharing
    // I change send data to Wunderground every 10 minutes.

    //-------------------------------------------------------------------
    // Following function sends sensor data to wunderground.com
    //-------------------------------------------------------------------

    void wunderground(void)
    {
    if (counter == 20){

    String cmd1 = "AT+CIPSTART=\"TCP\",\"";
    cmd1 += "rtupdate.wunderground.com"; // wunderground
    cmd1 += "\",80";
    esp8266Module.println(cmd1);

    if(esp8266Module.find("Error")){
    Serial.println("AT+CIPSTART error");
    return;
    }

    String cmd = "GET /weatherstation/updateweatherstation.php?ID=";
    cmd += ID;
    cmd += "&PASSWORD=";
    cmd += PASSWORD;
    cmd += "&dateutc=now&winddir=";
    cmd += CalDirection;
    cmd += "&windspeedmph=";
    cmd += wind_avg;
    cmd += "&windgustmph=";
    cmd += windgustmph;
    cmd += "&tempf=";
    cmd += tempf;
    cmd += "&dewptf=";
    cmd += dewptf;
    cmd += "&humidity=";
    cmd += humidity;
    cmd += "&baromin=";
    cmd += baromin;
    cmd += "&solarradiation=";
    cmd += solar;
    cmd += "&UV=";
    cmd += UVmax;
    cmd += "&rainin=";
    cmd += rain1h;
    cmd += "&dailyrainin=";
    cmd += rain24h;
    cmd += "&softwaretype=Arduino-ESP8266&action=updateraw&realtime=1&rtfreq=30"; // &softwaretype=Arduino%20UNO%20version1
    cmd += "/ HTTP/1.1\r\nHost: host:port\r\nConnection: close\r\n\r\n";

    cmd1 = "AT+CIPSEND=";
    cmd1 += String(cmd.length());
    esp8266Module.println(cmd1);
    if(esp8266Module.find(">")){
    esp8266Module.print(cmd);
    digitalWrite(GREEN_LED,HIGH); // Green led is turn on then sending data to Wunderground
    Serial.println("Data send OK");
    delay(1000);
    digitalWrite(GREEN_LED,LOW);
    }
    else{
    esp8266Module.println("AT+CIPCLOSE");
    Serial.println("Connection closed");
    Serial.println(" ");
    }
    delay(2500);
    }
    Counter();
    }
    Having trouable using esp01 for upload. What do I need to do to the esp01 to get it to upload data to wunderground?
    Anyone else able to get the esp01 to upload?
    Do you connect your ESP8266 to your WiFi network?
    Debug set to 0. It's not sending the sensor data
    Is the NodeMCU better than this setup? If so how and why?
    It need less energy, rain reset more accurate.
    Should I connect the shiel only to the usb dongle for programming or the shield must be connected to both arduino and usb stick?
    If you didn't have usb serial ttl adapter, you can use Arduino as programmer. You have to use this code.

    #include <SoftwareSerial.h>

    SoftwareSerial esp8266(10,11); // make RX Arduino line is pin 10, make TX Arduino line is pin 11.
    // This means that you need to connect the TX line from the esp to the Arduino's pin 10
    // and the RX line from the esp to the Arduino's pin 11
    void setup()
    {
    Serial.begin(115200);
    esp8266.begin(115200); // your esp's baud rate might be different
    }

    void loop()
    {
    if(esp8266.available()) // check if the esp is sending a message
    {
    while(esp8266.available())
    {
    // The esp has data so display its output to the serial window
    char c = esp8266.read(); // read the next character.
    Serial.write(c);
    }
    }

    if(Serial.available())
    {
    // the following delay is required because otherwise the arduino will read the first letter of the command but not the rest
    // In other words without the delay if you use AT+RST, for example, the Arduino will read the letter A send it, then read the rest and send it
    // but we want to send everything at the same time.
    delay(1000);

    String command="";

    while(Serial.available()) // read the command character by character
    {
    // read one character
    command+=(char)Serial.read();
    }
    esp8266.println(command); // send the read character to the esp8266
    }
    }
    I might have expressed myself wrong. I already have this usb dongle: https://www.banggood.com/USB-To-ESP8266-WIFI-Modul...
    The doubt is: My ESP8266 is already soldered into the shield board. To program it, should I connect the shield to the USB dongle only? Or should I have the shield connected to arduino and then also connect the USB dongle for programming it?
    Also, doesthat dongle is compatibe?
    There are two ways to program ESP8266 . Usb dongle connect to ESP8266 and send AT commands via serial monitor or Arduino Uno connect to ESP8266. and send AT commands via serial monitor. Usb dongle is compatible.
    Hello. What is the Dip Switch used for?
    More Comments