Professional Weather Station Using ESP8266 and ESP32 DIY (Please Check the V2.0 Improved Version Link!)

21,272

252

6

Introduction: Professional Weather Station Using ESP8266 and ESP32 DIY (Please Check the V2.0 Improved Version Link!)

About: Passion for Meteorology and I enjoy doing projects to make the weather data the most personalized and professional experience for everyone interested!

PLEASE CHECK THE NEW IMPROVED WEATHER STATION LINEAMETEOSTAZIONE v2.0!

LINK VERSION 2.0 LINEAMETEOSTAZIONE HERE

LineaMeteoStazione is a complete weather station which can be interfaced with professional sensors from Sensirion as well as some Davis Instrument component (Rain Gauge, Anemometer)

The project is aimed as DIY weather station but just requiring the assembly part, because the boards will already be given programmed by me as well as the complete PCB. The code will be shared Opensource for the people who wants to try to do it from the beginning or modify it!

YOU CAN FIND THE WEATHER STATION IN WeatherCloud, Wunderground and LineaMeteo (Italian Weather network!) (Anemometer is not Installed) and here also a Version in THINGSPEAK for the comparation between SHT3x and SHT1x. I'm using the SHT1x at the moment to monitor the temperature inside the weatherproof box, but you can use it also to monitor ground temperature and humidity or other purposes!

Please Note (The links above will go Offline because the weather station will be removed in February 2021 because I'm moving in an apartment)

YOU CAN FIND ALL THE INFO AND CODE UPDATE HERE IN GITHUB

Step 1: List of Components

It works with a combination of ESP8266 and ESP32 development boards and is composed mainly of 3 devices:

1. DEVICE 1: WEMOS D1 MINI PRO(New Version) + designed PCB (Need to be installed OUTSIDE) AND SOLAR PANEL This is the part which will be outside and it consist in one development board and the PCB. It is used to collect the weather data which will be sent to the Firebase of Google. The data is collected in real time from each sensor, but the upload time is selectable in the settings of the weather station which will be explained in the manual after. The maximum and minimum temperature will be collected in real time. Below the photo of the complete unit:

2. DEVICE 2: WEMOS D1 MINI PRO(Old Version) + BMP180 pressure
This is the part that handle all the network communications and it also collect the data from the Firebase of Google. The duties of the board consist in:  Collecting the data  Sharing some data to an IP Address in a format ready to be used to communicate with LineaMeteo weather network.  Send Data to weathercloud  Send Data to wunderground  Send Data to Thingspeak

The case is 3D printed from https://www.thingiverse.com/thing:4081064

3. DEVICE 3: LOLIND32 ESP32 + PCB designed + INK Display + BME680
This is the part that just handle the visualization of the data on the display and it has also a sensor that collects data of air quality, pressure, temperature and humidity. The display used is a 4.2 Inch ink display, can be used a WaweShare or GoodDisplay brands.

The case is 3D printed from:
Box for ePaper + ESP32 Information Display by sidoh10 - Thingiverse

Step 2: DEVICE 2: Interface to Wi-Fi and Firebase Google

**SEE THE MANUAL OF THE WEATHER STATION IN THE LINK OF GITHUB ABOVE FOR MORE SPECIFIC DETAILS**

First of all we need to create a Firebase account. To do that you will need an account Google which you can create if you don’t already have one.

To setup the Firebase account you need to follow the following steps:

1. Go to FIREBASE and click on ‘Get Started’

Sign IN to your Google account

2. Click on ‘Add a project’ ‘Aggiungi progetto’

3. Give a name to your project! Click ‘Continue’ ‘Continua’. Follow the steps and Create the project. Use the default account for Firebase.

4. ‘Go on ‘project overview’ ‘Panoramica del progetto’ on top and select ‘project settings’ ‘Impostazioni progetto’

5. Click on ‘Service Account’ ‘Account di Servizio’ and ‘Create Service Account’ ‘Crea account di servizio’

6. Go back to ‘Project Overview’ and Create Realtime Database ‘Crea database’ and follow the steps and select the nearest location for the database.

7. ALL DONE! Now save your project link that you can find in the real time database and also the secret that you can find ‘Service Account’ ‘Account di servizio’ under ‘Database Secret’ ‘Segreti Database’

You will need just the one highlighted in the picture below and the database secret to program the weather station! To send you the board already programmed I will need those credentials and also for the you to program the board.

Step 3: SETUP WI-FI (SEE MANUAL ON GITHUB FOR IMAGES)

To setup the Wi-Fi connection follow the following steps:

· Plug the USB cable from DEVICE 2 into a USB port (you can use a normal charger for your phone or whatever USB port available, for example on your router(recommended option))

· Once DEVICE 2 is ON you will find it in the Wi-Fi connections available on your smartphone or computer with the name of LineaMeteoStazioneR.

· Try to connect and it will ask a password. PASSWORD: LaMeteo2005

· Click on configure Wi-Fi and select your Wi-Fi network and enter your password and click Save. Now the DEVICE 2 will try to connect and if fails you will be required to start again the procedures followed before.

· After the DEVICE 2 is connected, go back to your Realtime database and you will see that many information have appeared.

Step 4: ​Setup DEVICE 1(Outside)

This is the installation which requires to secure the weather station outside. A solar radiation shield Is required for the ambient temperature and humidity sensor. Is also required a weather proof box for the correct storage of the battery and PCB.

1.Install the board in weather proof box as example below and install the battery (BE CAREFUL + AND – AND BATTERY SHOULD BE 100% CHARGED BEFORE FIRST START):

2. Connect all the available sensor on the board using the RJ12 connectors or the screw terminal, depending on the type of sensor used. (Refer to the list of ‘Compatible sensor and specification) (SENSORS ARE CONNECTED WITH AN ADAPTOR BOARD DESIGNED SPECIFICALLY FOR THE SHT3X AND UV SENSORS AND ALSO ONE FOR THE SHT35 ON TINDIE ) SEE PHOTOS

3. Plug IN the battery connector into the Wemos D1 Mini Pro and setup the Wi-Fi connection same as DEVICE 2. Name of the network will be ‘LineaMeteoStazioneS’

After that plug in also the USB from the solar panel converter. (The photo is just representative of a prototype and the USB converter will be already connected for you, you will just need to connect the solar panel)

Step 5: Configure Weather Station Settings With Firebase

EVERY SETTINGS MADE REQUIRES TO DISCONECT FROM POWER

DEVICE 2 AND RECONNECT TO POWER

After followed the procedures above you will find that your real time database will look like this(if UV index sensor is connected it won’t shows 655):

The database is categorized as following:

· ChangeTime

This option is used to set your TIMEZONE which will be your time (need to modified when day light saving apply) and to set the SendDataTime. It is recommended to don’t upload the data faster than 90 seconds to save the battery life of DEVICE 1

CurrentDay and RESETDATA don’t need to be touched. To reset all data in database enter 0 in RESETDATA.

· Connection

Connection is used to know your current IP address of DEVICE 2 and to monitor the Wi-Fi signal strength of DEVICE 1. Try to keep DEVICE 1 with at least -75 or more of signal strength.

IPAddress can be used to port forwarding the IP in order to setup your devices in the LineaMeteo weather network. (PortForwarding can be done in the router, but every router is different, so you need to know yours. External port should be 4600 and internal port should be 80, example below)

· Pressure

Here is stored the value of the Pressure and also is possible to Calibrate it based on sea level. Refer to some near weather station or looking the current atmospheric pressure on the forecast. Every number means 1Pa

· Rain

Here is stored the value of the rain in 24H and also other values related to the rain. You can use every tipping bucket rain gauge so this means that you will need to calibrate how much every tipping count for. Modify ‘mmGoccia’ to change the tipping count in mm. Default is 0.2mm

· SHT1x

This contain the data of the Sensirion SHT1x or SHT7x series.

· SHT3x

This contain the data of the Sensirion SHT3x series.

· Services

This contain all the services available to use with this weather station.

OPENWEATHER

You can setup your own account on OpenWeather for current condition weather description on DEVICE 3 (find My API Keys and copy in the API in Services, OpenWeather.)

Hemisphere type north if you live in northern hemisphere or south in southern hemisphere to display correct astronomy section on display.

Language ‘en’ or ‘it’ to change from English to Italian on DEVICE 3.

Latitude and longitude to display correct weather condition description on DEVICE 3

If from southern hemisphere it will be a negative number on Latitude.

THINGSPEAK

Create an account on ThingSpeak and find the WriteAPIkey and copy in myWriteAPIKey, to see the difference with graphics between the SHT1x and SHT3x series if connected the 2 sensors or to just monitor the SHT1x

WeatherCloud

You can link the weather station to Weather Cloud network using this option. Go to Settings on your devices and select ‘Link’, it will give you the ID and Key that you can copy in the database.

WunderGround

You can link the weather station to WunderGround using this option.

Find the ID and Key on My Devices and copy it to the database.

· Sleep

By default is set to 1 but can be changed to 0 to enable the sleep mode. In sleep mode the rain gauge and anemometer will not work so they have to be disconnected from PCB

Sleep mode if used on battery will last average of 6 months without recharging the battery with the solar panel.

· UVIndex

This contain the value of the current UVindex.

· Wind

This contain the values of the Wind, like degrees of the Wind Direction and also the Wind Speed and the Gust. It can be adjusted the Offset here, in order to point the right direction of the Wind Direction. 0 degrees or 360 degrees should be point North.

Step 6: Setup DEVICE 3 DISPLAY (MORE PHOTOS AVAILABLE IN GITHUB)

The DEVICE 3 is powered up with one single battery 18650, which can be recharged trough USB as shown in photo (The photo doesn’t represent the final project but just the prototype, inside it will have a proper PCB design.) The little circle shows the BME680 sensor.

The display refresh every 20 minutes automatically and every 1 hour after midnight and until 7AM. But It can be refreshed manually clicking on the button on the right side of the box.

ONCE REFRESHED IT WILL ALSO CHANGE THE LANGUAGE SELECTED IN SETTINGS IN FIREBASE

After the battery has been installed follow the same procedures of DEVICE 2 to connect to Wi-Fi.

Name of the network will be ‘LineaMeteoStazioneVisual’

The battery should be sufficient charged before start.

Step 7: COMPATIBLE SENSORS(MORE INFORMATION ON GITHUB)

Temperature/humidity MAIN: SHT3x series Sensirion. Accuracy refer to datasheet of each

sensor.

 Temperature/humidity SECOND (can be used for soil temperature and moist) : SHT1x and SHT7x series Sensirion. Accuracy refer to datasheet of each sensor.

 Temperature, Humidity, Air quality Indoor: BME680

 Pressure: BMP180

 Rain Gauge: Every tipping bucket rain gauge, adjustable resolution. WHEN ADJUSTED RESOLUTION IT MAY TAKES UP TO 3 HOURS TO CHANGE THE SETTINGS ON DEVICE 1. This is because the device goes to sleep every 3 hours to save energy if no rain is detected. When it wakes up, it will check the settings again. You can also manually reset by clicking the reset button as shown in photo before.

 Anemometer: Davis Anemometer

 UVIndex: SI1145

Step 8: SPECIFICATIONS AND SOLAR PANEL (MORE INFORMATION ON GITHUB IN THE MANUAL)

Consumption:
Device 1 = 19mA in average if upload time is 90 seconds.

Device 3 = 2mA in average if always updated automatically.

Battery DEVICE 1: 3.7V 21700 Battery lithium (Recommended 5000mAh)(Autonomy without sun 8days*)

WARNING: Be careful with lithium battery with high temperature(more than 45C), weatherproof box should be putt in the shade. Furthermore if negative temperature -10C occur often or condition below 0 persist for long or extreme negative temperature occur (example -20C) a specific battery for cold temperature will be required. In this case PCB will need to be modified for a 18650 battery resistant to cold weather -40C with less capacity(2900mAh). Autonomy without sun will be 5 days. *Without sun means completely darkness, a light cloudy day doesn’t means no sun energy at all but it also can’t be counted as sunny day.

 Battery DEVICE 3: 3.7V 18650 Battery lithium (Recommended 3000mAh)(Autonomy without recharging 6 weeks)

 Solar Panel 6-20V (6V strongly recommended)

Watt depending on your location from Global Solar Atlas. With less than 1500 kWh/m2 the weather station can’t work autonomously. If sleep mode is used a smaller solar panel less than the minimum would be enough. (SEE PHOTO) ASK IF YOU REQUIRE THE FORMULA FOR CALCULATION OF SIZE OF SOLAR PANEL.

 Length of cable for SHT3x series should not exceed 3m

 Length of cable for SHT1x and SHT7x series should not exceed 10m

Step 9: TROUBLESHOOTING AND CONTACTS

If one of DEVICES is not working as expected a RESET would be required. Take off the battery connector or remove the battery and restart the device if RESET doesn’t work.

For DEVICE 1, ALWAYS put the battery first and then the solar panel connector.

 If DEVICE 3 shows 100% while recharging, that’s normal for the moment, because the board doesn’t have a specific IC for the state of charge, so it is influenced by the internal resistance of the cell.

 Other questions regarding problems please contact me.

CONTACTS To discuss about ordering the weather station or source of the material please email me Eugenio eugenioiaquinta@outlook.it

LineaMeteo topic forum: Strumenti meteo :: Stazione Meteo Completa WiFi Con ESP8266 E ESP32 E Arduino! (lineameteo.it)

Be the First to Share

    Recommendations

    • Tiny Things Speed Challenge

      Tiny Things Speed Challenge
    • Edible Art Challenge

      Edible Art Challenge
    • Reclaimed Materials Contest

      Reclaimed Materials Contest

    6 Comments

    0
    Lekanjuwon
    Lekanjuwon

    10 months ago

    Just sent a mail to you, from lekanj*********
    Kindly acknowledge it. Thanks.

    0
    jgascon1
    jgascon1

    Question 10 months ago

    Can you share communication code with rain gauge and anemometer?
    Where did you buy them?

    0
    iaquinta.eugenio
    iaquinta.eugenio

    Answer 10 months ago

    Hi! Thanks for your interested in the project.
    The rain gauge and anemometer code you can find in the codes in GitHub
    I publish for you the part of the code you're looking for:

    These are the declaration of variables for rain, rainrate and rain rate max daily.

    ////////////RAIN////////////////
    float mmGoccia; // = 0.2; // tipping bucket count in mm
    unsigned int gocce = 0; // tipping bucket movements
    float mmPioggia = 0.0; // daily rain
    volatile unsigned long time1; // rain rate timing calculation
    unsigned long PluvioStep = 0; // rain rate timing calculation
    unsigned long PluvioOldStep = 0; // rain rate timing calculation
    volatile byte PluvioFlag = 0; // detect interrupt of rain
    volatile unsigned long ContactBounceTimeRain = 0; // Timer to avoid double counting in interrupt
    float rainrate = 0; // real-time rainrate
    float rainrateMax = 0; // daily rainrateMax
    These are the declaration for Wind Speed, Gust and wind direction.

    ////////////WIND/////////////////
    volatile unsigned int Rotations; // cup rotation counter used in interrupt routine
    volatile unsigned long ContactBounceTime = 0; // Timer to avoid contact bounce in interrupt routine
    unsigned long calculation = 0; //millis() for sample time
    const int average = 3000; // sample time for wind speed
    float constant; // formula calculation
    float WindSpeed; // speed km/h
    float Gust = 0; // gust variable
    int VaneValue; // raw analog value from wind vane
    int Direction; // translated 0 - 360 direction
    int CalDirection; // converted value with offset applied
    int Offset; // adjust wind direction value
    byte gustDetected = 0; // write on database the gust if detected

    Then you define the interrupt cycle in this way (REMEMBER ICACHE_RAM_ATTR in front of the ISR):

    ///////////////////////////////INTERRUPT ISR//////////////////////////////////////////////
    void ICACHE_RAM_ATTR ContaGocce()
    {
    if ((millis() - ContactBounceTimeRain) > 250 ) { // debounce the switch contact.
    PluvioFlag = 1;
    time1 = millis();
    ContactBounceTimeRain = millis();
    }
    }
    void ICACHE_RAM_ATTR isr_rotation () {
    if ((millis() - ContactBounceTime) > 15 ) { // debounce the switch contact.
    Rotations++;
    ContactBounceTime = millis();
    }
    }

    After that in the SETUP you initialize the interrupt

    void initPioggia () {
    attachInterrupt(digitalPinToInterrupt(pinInterrupt), ContaGocce, FALLING);// pin interrupt per il pluviometro WS2300-16
    }
    void initVento () {
    pinMode(WindSensorPin, INPUT);
    attachInterrupt(digitalPinToInterrupt(WindSensorPin), isr_rotation, FALLING);
    constant = 2.25 / (average / 1000);
    }

    THESE are the function in the LOOP:

    //RAIN RATE//
    void PluvioDataEngine() {
    if (((PluvioStep - PluvioOldStep) != 0) && (gocce >= 2)) {
    if ((millis() - PluvioStep) > (PluvioStep - PluvioOldStep)) {
    rainrate = 3600 / (((millis() - PluvioStep) / 1000)) * mmGoccia;
    if (rainrate < 1) {
    timecountSleep = millis();
    gocce = 0;
    rainrate = 0;
    }
    } else {
    rainrate = 3600 / (((PluvioStep - PluvioOldStep) / 1000)) * mmGoccia;
    }
    } else {
    rainrate = 0.0;
    }
    }
    //RAIN//
    void readPioggia () {
    if (rainrate >= 0.2 && rainrate <= 0.6)
    {
    timecountSleep = millis();
    rainrate = 0;
    gocce = 0;
    }
    if (PluvioFlag == 1) {
    PluvioFlag = 0;
    PluvioOldStep = PluvioStep;
    PluvioStep = time1;
    timecountSleep = millis();
    gocce++; // incrementa numero basculate
    mmPioggia = mmPioggia + mmGoccia;
    }
    PluvioDataEngine();
    if (rainrate > rainrateMax)
    {
    rainrateMax = rainrate;
    }
    }
    //WIND//
    void readVento () {
    //FORMULA V=P(Rotations)(2.25/T)--->constant
    if (millis() - calculation >= average)
    {
    calculation = millis();
    WindSpeed = (Rotations * constant) * 1.60934;
    Rotations = 0;
    }
    if (WindSpeed > Gust)
    {
    Gust = WindSpeed;
    gustDetected = 1;
    timecountSleep = millis();
    }
    VaneValue = analogRead(A0);
    Direction = map(VaneValue, 0, 1023, 0, 360);
    CalDirection = Direction + Offset;
    if (CalDirection > 360) {
    CalDirection = CalDirection - 360;
    }
    if (CalDirection < 0) {
    CalDirection = CalDirection + 360;
    }
    }

    These are just the part of communication and also some daily extremes as mentioned. In the complete code of course there is also the communication with Firebase.

    Regarding the last question, the rain gauge you can use whatever type of rain gauge as long is a tipping bucket rain gauge.
    I bought a cheap one HERE but you can use also professional one Davis or other brands, just need to be changed the resolution as explained in the Manual.
    Regarding the anemometer you can just use the Davis Instrument Anemometer. It is a professional anemometer, which I tested but I don't have it installed at the moment.

    If you have any other question just ask me!
    Eugenio

    0
    jgascon1
    jgascon1

    Reply 10 months ago

    Thanks a lot. I'll use it in my next project

    0
    randofo
    randofo

    10 months ago

    Is the koala a necessary component for building the project or does the koala help interpret the weather for you? :)

    0
    iaquinta.eugenio
    iaquinta.eugenio

    Reply 10 months ago

    Is just a decoration, my girlfriend did it actually :D