Make an Arduino Uno Personal Wireless Weather Station (Wunderground.com)

13,693

146

48

In this Instructable I am going to show you how to build a 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) http://wiki.wunderground.com/index.php/PWS_-_Uplo...

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 ;)

    Share

      Recommendations

      • Make it Glow Contest 2018

        Make it Glow Contest 2018
      • Plastics Contest

        Plastics Contest
      • Optics Contest

        Optics Contest

      48 Discussions

      0
      None
      JeffersonM20

      Question 2 days ago on Step 7

      Should I connect the shiel only to the usb dongle for programming or the shield must be connected to both arduino and usb stick?

      3 more answers
      0
      None
      RimvydasPJeffersonM20

      Answer 2 days ago

      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
      }
      }

      0
      None
      JeffersonM20RimvydasP

      Reply 2 days ago

      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?

      0
      None
      RimvydasPJeffersonM20

      Reply 1 day ago

      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.

      0
      None
      RimvydasPJeffersonM20

      Reply 2 days ago

      Dip switch used for enable or disable ESP-12 wifi modulle. If you want to use ESP-01, turn off dip switch.

      0
      None
      NicoG8

      Question 9 days ago on Step 8

      Kan ik er ook een Wemos Di voor gebruiken.
      In plaats van een ESP8266 ESP12F of ESP8266 ESP 01 ?

      1 more answer
      0
      None
      RimvydasPNicoG8

      Reply 9 days ago

      Yes you can use Wemos. At this moment I am creating another weather station based on ESP8266 as main board. So wait if you can.

      0
      None
      JeffersonM20

      Question 11 days ago

      Hello. I saw another Wifi microboard in the pictures that have all sensors and boards (one board ESP8266 and another ESP8266/ESP12F). Do I need both or only one of them? I saw the first connected in the USB programming slot in one of the pictures and had the doubt. Thanks.

      2 more answers
      0
      None
      RimvydasPJeffersonM20

      Reply 11 days ago

      Hi, you only need one WiFi module. You can use ESP8266 ESP01 or ESP12.

      0
      None
      antippc

      4 weeks ago

      Hello
      I was having issues with WiFi in your project very good work,but WU upload routine in your project is not working
      The exit of the serial port
      DS18B20 = 25.06 C
      BME280 = nan C 77.11 F 0.00 % nan hPa nan inHg
      ML8511 = Solar = 0 W/m^2 UV = 0.00
      WindSpeed = 0.00 mph 0.00 knots 0.00 m/s
      Wind_min = 0.00 mph WindAvg = 0.00 mph WindGustAvg = 0.00 mph WindGust = 0.00 mph
      Wind_Direction = N
      WindStrength = Calm
      Rain Tip Count = 22
      Precip. Rate = 0.44 in
      Precip Accum. Total: 0.44 in
      Connection closed
      The connection to the router is interrupted after the serial output, and you come back again and again if I can static IP (esp8266)
      (the exit of the windshield is zero because I have it in the house for testing)
      Where is the problem and does not send the data, I would appreciate it especially if you could help me (I do not have a lot of programming knowledge)
      Friendly Gregory

      5 replies
      0
      None
      RimvydasPantippc

      Reply 27 days ago

      Hello Gregory,
      Do you have connected your ESP8266 to your router? Code it used a lot of memory. Try disable ,, serial monitor" Debug 0.

      0
      None
      antippcRimvydasP

      Reply 27 days ago

      The esp-01s is connected one after a while it stops resuming to be reconnected
      GPIO0 is High
      #define DEBUG 0 serial is not connected only debug 1 working
      Serial works continuously
      Adduino
      Using Port : COM2
      Using Programmer : arduino
      Overriding Baud Rate : 115200
      AVR Part : ATmega328P
      Chip Erase delay : 9000 us
      PAGEL : PD7
      BS2 : PC2
      RESET disposition : dedicated
      RETRY pulse : SCK
      serial program mode : yes
      parallel program mode : yes
      Timeout : 200
      StabDelay : 100
      CmdexeDelay : 25
      SyncLoops : 32
      ByteDelay : 0
      PollIndex : 3
      PollValue : 0x53
      Memory Detail :
      Block Poll Page Polled
      Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
      ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
      eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
      flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
      lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
      hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
      efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
      lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
      calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
      signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
      Programmer Type : Arduino
      Description : Arduino
      Hardware Version: 3
      Firmware Version: 4.4
      Vtarget : 0.3 V
      Varef : 0.3 V
      Oscillator : 28.800 kHz
      SCK period : 3.3 us

      Reading | ################################################## | 100% 3.51s
      avrdude: verifying ...
      avrdude: 24730 bytes of flash verified

      I'll be crazy (I'm heartbroken) if it's not done I'll keep it, very good work you do
      Gregory

      0
      None
      antippcantippc

      Reply 25 days ago

      Good morning
      Everything is done as you are running smoothly, it only does not send the data to the WU (#DEBUG 0 does not send data to the serial only with #DEBAG 1 sends.
      We have gotten past and I have changed them (as in the photo).
      After an intense search I found this
      (https://projects.raspberrypi.org/en/projects/uploa...),(Take a look so you will understand something)
      I did not of course know if it is at this point the error that does not send the data to the WU.
      I do not want to tire you another last message I'm sending you, thank you for being a unique one, he continued
      Frendly
      Gregory

      Pass.jpgUpdate.jpgWU.jpg
      0
      None
      antippcRimvydasP

      Reply 26 days ago

      Good evening
      The wireless connection is OK, but after 30 minutes it stops and does not connect again, it wants to reset.
      I do not know if it is connected to the modem only when it sends the data, the serial output states that it sent the data continuously.
      LED are not on the esp, only the data LED
      WU says he is not responding(After setup, when will I see my personal forecast?
      It takes about 1 day for our database to update all of our web servers and place your station on your local forecast page. Also, if we don't have current data from your station, then we will remove it automatically from the list until we get the next update)

      Screen Shot 2018-10-24 at 20.18.01.pngScreen Shot 2018-10-24 at 20.54.59.png
      0
      None
      RimvydasPantippc

      Reply 26 days ago

      Hi,
      #define DEBUG 0

      #define DEBUG 1 // I was using only if I want to check sensors data on serial monitor.

      Do you change weather station ID and password ?
      char ID [] = "XXXXXX"; //wunderground weather station ID
      String PASSWORD = "xxxxxx"; // wunderground weather station password

      0
      None
      JeffersonM20

      Question 4 months ago

      Hello! Thanks for sharing this great project. I am currently harvesting the parts and will start it soon. Question: do you have detailed information on how to use a Small Solar Panel + batteries for powering this rig up? That would help a lot. Thanks!

      1 more answer
      1
      None
      RimvydasPJeffersonM20

      Reply 4 months ago

      Hello, so you need solar charge controller, battery 12V or 6V , and solar panel. For example if you have LiPo 2200mAh battery with a load that draws 100mA. 2.2/ 0.1 = it takes 22 hours. So if you have one cloudy day your weather station discharge your battery. You will need add another battery or battery with larger capacity.