ESP32 Weathercloud Weather Station

17,866

260

29

About: I am an eight grade student and I just love making cool (sometimes maybe even useful) devices.

Last year, I published my biggest Instructable to date called Arduino Weathercloud Weather Station. It was very popular I would say. It was featured on the Instructables homepage, Arduino blog, Wiznet museum, Instructables Instagram, Arduino Instagram and also on Weathercloud Twitter. It even was one of the top 100 Instructables of 2018! And that was a very big deal for a small maker like me. I was pleased to see so many positive reactions and I carefully read through every single comment and tip. For about 8 months I've been working on this new, refined station. I fixed and improved various things. I tried to make it smaller, simpler, smarter, cooler and leave the acceptable cost of 150€ (165$). The station is mounted at a robotic farm near Senec, Slovakia. Here is the current data.

I will try to explain my whole thought process here so if you just want to get right on the build just skip right to step 3.

.

Features:

-measurement of 12 meteorological values

-usage of 8 distinct sensors

-IoT - data is public on cloud

-5V 500mA operation

-communication via Wi-Fi

-completely weatherproof

-looks cool

-it's DIY

.

Thanks very much to Lab Cafe makerspace for providing space and support while building this station. Go check them out!

Photo credit: ME (of course) + Viktor Demčák

Supplies:

.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Design

Designing a weather station is a long and thoughtful process.
You have so many options to choose from. These are the main things you should think about when designing a weather station (or at least I did so):

1) BUDGET. This is pretty self-explanatory.

2) LOCATION. This is very important since it affects the installation as well as the communication technology and the required power source. Remote weather stations need long range transmitters and a self-sustainable power source such as a solar panel.

3) MEASURED VARIABLES. Do you just want to measure temperature or humidity? Then you can put the probe nearly anywhere. But if you want to measure rainfall, wind, solar radiation, UV index or other stuff related to sun or precipitation then the sensors cannot be in a shadow and cannot be blocked neither from upside or from the sides.

4) ACCURACY. Do you want your measurements to be precisely calibrated and comparable to the national weather institute or are rather amateur values enough for you?

.

So by now you should have a pretty good image of what you want. So let's get to the drawing board! Here are some basic rules I did think about:

1) PROTECT THE TEMPERATURE SENSOR. You absolutely need to do this. Heat can travel in so many ways it can radiate and conduct through the structure of the station itself. So try to coat all of the metal parts, and put the temperature sensor in a radiation shield. I know, my radiation station isn't perfect but it helps.

2) PUT THE WIND SENSOR HIGH UP. Wind sensors are supposed to be placed 10m high by the international standards. I don't even have the money to buy a 10m pillar so a 2m pipe above a rooftop is enough for me.

3) CLEAR AREA AROUND AND ABOVE THE STATION. If you want to measure sunlight you cannot have the sensor in a shadow. If you want to measure rainfall you cannot have something blocking the droplets. So make sure that the area around and above the station is cleared.

.

Let's continue. So, for my station I decided I want to measure these variables: Air temperature, ground temperature, relative humidity, atmospheric pressure, heat index, dew point, wind chill, rainfall, solar radiation, UV index, wind speed and wind direction. This is 8 sensors in total from which there are 3 small, PCB-mountable modules and 5 external probes. I will need 2 separate microcontrollers, one for handling just rainfall measurements and the second one for everything else.

I decided to put everything I can on a single PCB. I put the PCB inside a IP65 box with transparent cover, so that sunlight can pass through to the solar radiation and UV index sensors. All of the other sensors will be connected to the main control box with a cable. So that's it for my design.

Step 2: Weathercloud

"ESP32 Weathercloud Weather Station" What is Weatherclud? Weathercloud is a large network of weather stations reporting data in real time from all over the world. It's free and there are more than 10 000 weather stations connected to it. Firstly, I had my own HTML website where all the data were sent but making your own website and graphics is hard and it's much easier to just send all the data to a big cloud platform which has nice graphics and stable servers. I searched how to send data to weathercloud and I found that you can accomplish that easily by a simple GET call. The only problem with Weathercloud is that with a free account it lets you send data only every ten minutes but that shouldn't be a problem for most uses. You'll need to make an Weathercloud account in order to make it work. Then you'll need to create a station profile on their website. When you create your weather station profile on Weathercloud, you are given the a Weathercloud ID and a Weathercloud KEY. Keep these because the Arduino will need them to know where to send data.

Step 3: Parts List

OK so for this project you'll need all the stuff that's neatly listed in my Google Docs BOM right here.

.

ESTIMATED PROJECT COST: 150€/165$

Step 4: Tools

These tools could come in handy (though most of them are absolutely necessary):

Laser cutter

Welder

Steel saw

Wire stripper

Power drill

Battery drill

Soldering iron

Pliers

Screwdrivers

Glue gun

Multimeter

Tree drill bit

Step 5: Control Board Design

I went with a very centralized architecture. This means that everything that can be is not only in one box but on one circuit board. I recently learned how to design PCBs which is a very valuable and useful skill. All of the projects are much neater and more precise and even elegant in a way. It's also very convenient: you just send your files to China and they do all of the wiring work and ship the complete board to you. Then you just solder the components in place and you're done.

The PCB holds both of the microcontrollers in this station: ESP32 (the main control unit) and Arduino NANO (the rainfall processor). It also holds some of the sensors which include: BME280, BHT1750 and the ML8511. Then there's the DS3231 RTC module. Last but not least, there are some resistors and screw connectors.

I designed my board in Autodesk Eagle. Just download the included Gerber file called "ESP32 weather station.zip" and upload it to JLC PCB. Or if you want to edit it, you can download the "ESP32 weather station schematic.sch" and "ESP32 weather station board.brd" files and edit them in Eagle. I strongly advise enrolling the Circuit Board Design Class from Instructables first.

Step 6: Soldering

Okay everyone, you've all probably done this before. This beautiful board that I designed has nice silkscreen footprints printed on it. When you have that, soldering should be a piece of cake because you see exactly where goes what. There are only THT components with the standard 0.1" spacing. So, just go on and solder the board because you are clever and you can do it by yourself! It shouldn't take you more than half an hour.

Step 7: Making the Radiation Shield

When I was building this, I said to myself "Alright, you've already done this two times there is not a chance you will mess it up now." And I didn't.

A solar radiation shield is a very common thing used in weather stations to block direct solar radiation and therefore reduce errors in the measured temperature. It also acts as a holder for the temperature sensor. Radiation shields are very useful but are usually made from steel and they are expensive so I decided to build a shield of my own. I made an Instructable that shows how to make a radiation shield like this.

Step 8: Control Box

The main part of this station is obviously the control box. It holds the primary and secondary microcontrollers, some of the sensors, the RTC and some passive components. All of that in a convenient IP65 package. The box has a translucent cover so sunlight can pass through to the UV and solar radiation sensors.

Before we can mount the PCB, we need to prepare the box for the cables. There are five power and data cables going in to the box. In order to sustain the waterproof properties of the station, we're going to be needing waterproof cable glands. Specifically, one PG7 for the power cable, second PG7 for the wind and rainfall sensors and the third PG11 for both of the temperature sensors. I put the bigger (PG11) gland in the center of one wall of the box and the two smaller (PG7) glands in the opposite wall. So the box altering process is as follows:

1) Mark the center for each hole with a marker.

2) Drill a small hole with a thin drill bit.

3) Slowly increase the size of the hole with a tree drill bit.

4) Clear the holes.

5) Insert and secure a cable gland in each of the holes.

Step 9: PCB Mount

Since I have only the student trial version of Autodesk Eagle, I can't design PCBs bigger than 8cm. Everything fits to this board so that's fine. Only problem is with the control box. The board mounting holes included in the box are 14cm apart. This means that we are going to need a holder for the PCB. This can be a board (wooden/plastic/metal) on which we will mount the PCB. Then we will attach the holder board to the control box. This way the PCB will be secured to the control box.

You can make the holder anyway you want. You can make it manually from a plate of wood or steel, you can laser cut it (as me) or you can even 3D print it. I'm including the dimensions of the board so the choice is yours. If you have access to a laser cutter, then laser cutting it is the simplest option. You can find the laser cutter files here both in .pdf and .svg format.

As you can see I went through multiple variations of the holder. Finally, I went with the acrylic one, because it doesn't get affected by moisture (as wood) and it doesn't attract heat (as steel).

Step 10: Asembly + Wiring

This is going to be a pretty easy one to do, but a pretty tough one to explain because there are many small steps. Let's get right onto it then:

1) Insert all of the cables to their designated hole. Do not secure the cable glands yet.

2) Connect all of the wires from the wind sensors, rainfall sensor and from the power cable according to the included wiring diagram. Do not connect cables from the temperature sensors yet.

3) If mounted, remove the PCB mount. Then flip the PCB so that the cables are going along its bottom side. Secure the PCB mount so that the cables are secured in a sandwich between the PCB and the mount.

4) Insert and screw in the PCB mount with the PCB.

5) Secure the two smaller (PG7) cable glands. Do not secure the bigger one yet.

6) Insert and connect the cables from the temperature sensors according to the included wiring diagram.

7) Put on the top cover and screw it in place.

Step 11: Be Happy

This step is kind of a checkpoint. At this point, you should have made yourself something that looks like what you see on the picture. If that is correct, be happy. Go on, get yourself a snack and rest because this is not just one small step for a man, but a giant leap for mankind. If not, look through the previous steps and locate the problem. If that doesn't help, comment or message me.

So when you're healthy and fit again, you can move forward to the coding and debugging part.

Step 12: Coding and Debugging

Yaaaaay, everyone loves coding! And even if you don't, it doesn't matter because you can just download and use my code.

Firstly, you need to add ESP32 dev module to your boards manager. In order to do this, you'll need to download a JSON package and install it through the boards manager. See this tutorial by Random Nerd Tutorials.

Now you need to download all of the essential libraries. I created the ZIP archive "Libraries.zip" for you to make it simpler. Do not import the archive into Arduino IDE like a classic library. Instead, extract the archive and move all of the files to Documents/Arduino/libraries. Now you can download all four of my programs: "Wi-Fi_Weathercloud_API_test.ino", "System_test.ino", "ESP32_Weathercloud_Weather_Station.ino".

Open up "Wi-Fi_Weathercloud_API_test.ino". You will need to change a couple of things. Firstly, you will need to replace "SSID" and "KEY" with your Wi-Fi network SSID (name) and password. Secondly you will need to replace "WID" and "KEY" with your Weathercloud ID and KEY you should have from Step 2. You will also need to do the same with "ESP32_Weathercloud_Weather_Station.ino". Go on and upload the code to the ESP32. You should see the predefined data coming up on the Weathercloud website. If that is correct, continue.

Upload the "System_test.ino" to the ESP32 and the "I2C_rainfall_sender" to the Arduino NANO. Open the Serial Console of ESP32 at 115200 baud. You should now see sensor data coming in every 15 seconds on your screen. Play with the sensors. Shine a light in the solar radiation sensor, blow into the wind speed sensor, heat the temperature probe... This way you can test if everything works. If you conclude that everything is as it should be, continue.

Upload the "ESP32_Weathercloud_Weather_Station.ino" to the ESP32. If you've done everything correctly, you should see the real data from the station coming in on the Weathercloud page every 10 minutes. If this works it means that your station is now fully operational and the only thing left to do is to install it somewhere nice.

Step 13: Station Mount

So after you have confirmed that your station is working you need to design and make a mount for it. It will have to be strong, durable, compact and last but not least it will have to be nice. Take this step more of a recommendation or inspiration than precise instructions. I don't know how it looks where you're going to mount it. You have to get a little more creative. But if you have a flat roof with a 5cm diameter metal pipe sticking out, go on and do as I did. This station has two boxes. So I decided to put both of them next to each other on a metal panel. It has to be mounted on a metal pipe with the diameter of 5cm. So I put a pipe with 5cm inner diameter on the bottom of the panel. Both of the wind sensors have to be far apart from the rest of the station. So put two 40cm long pipes on each side of the station and two 10cm long pipes on end of each one. The radiation shield should be mounted below the panel to provide extra shadow. For this, I put a 7 by 15 cm L bracket on the thick metal pipe.

Here are all of the needed metal parts one by one [dimensions in mm]:

1x pipe, inner diameter 50, length 300

1x panel, 250 by 300, thickness 3

1x L bracket, 75 and 150 arms

2x pipe, outer diameter 12, length 400

2x pipe, inner diameter 17, length 100

.

When you have all of these metal parts, you can weld them in place according to the 3D model I provided. Then you will need to drill all of the holes for the boxes and for the radiation shield. Then just paint it with paint for metal. I recommend going with white, because it absorbs the least heat from all of the colors. That's it you've got yourselves a station mount that you can mount your station on!

Step 14: Installation

Grab your weather station, your mount and all of your tools because you'll need all of them. Get into a car (or a bus I don't care) and get to the future location of your station. Finally, you can mount the station.

Making your weather station work in your workshop is one thing, but making it work in the real-world harsh conditions is another. The installation procedure depends very much on the building you're mounting your station on. But if you have the holder from the previous step and powerful drill, it should be fine. You just need to stick the thick pipe from the mount onto the slightly thinner pipe on the roof. Then just drill through both of the pipes and secure them with a long screw. Mount all of the boxes and sensors. That's it. Your station is now successfully installed.

We did this on a rainy day. It was very difficult but we had no other option because of the contest deadline.

Step 15: Power, Uplink Setup and Debugging

Your station is physically installed, but it's not online just yet. Let's do that now. You have to power the station somehow. You have to be a little creative here. You can put an adapter inside of the house and pull a cable through the window. You can bury the cable underground. You can power it via a solar panel. All that matters is that there is 5V 500mA on the pins of the power cable coming from the control box. Remember, it all has to be weatherproof! When you have your station powered, you can move on to the uplink setup and debugging.

Uplink Setup is basically getting the ESP32 to connect to your Wi-Fi network. If it's on your house, it should be fine. If it's on a garage or farther apart, you may need a Wi-Fi extender or even a custom Wi-Fi network. Then the debugging phase follows. You can just upload the final code and hope for the best but I really recommend testing each of the sensors one by one just to be sure that everything is functioning properly. Basically the same thing as in step 12. If everything works as it should, you can hit the UPLOAD button unplug the USB cable and close of the control box.

Step 16: Live Happily Ever After

Jeez, this was sooo last minute guys. I noticed the Sensors contest just 10 days before it ended. That same evening, I needed to make like 10 telephone calls to arrange everything required to finalize the station. It was not finished quite yet. The day we were supposed to install the station came a giant storm disrupting our plans. I needed to finalize all of the text before the station was completed. The station was finally installed just today, on the same day I published this Instructable.

There are certainly many things that could have been done better here but there are many useful things you can learn here and use them when building your own station. If you did all steps correctly, you now have a fully operational ESP32 cloud weather station. And that's something! All of the hard work paid off (I hope it did). You can see the data from my station here. If you have some questions or suggestions, I would be happy to hear them in the comment section below.

Yeah and also if you liked this project I would appreciate really much if you voted for me in the Sensors contest. Thanks so much and enjoy!!!

Sensors Contest

First Prize in the
Sensors Contest

Share

    Recommendations

    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    29 Discussions

    0
    None
    RimvydasP

    Question 1 day ago

    If your main board is ESP32, why you need Arduino? Arduino only for rain counter? If EP32 can connect to ntp time server, why you need DS3231 RTC ?

    1 answer
    0
    None
    Jakub_NagyRimvydasP

    Answer 1 day ago

    Right. The Arduino is only for rain counting. The rain sensor outputs data only for about 60ms so if the ESP32 processor is doing anything else for more than 60ms (which is probable) it won't detect it. Sure it could be done with interrupts but there could be some crashes and errors happening. I also experimented with a flip flop circuit but it wasn't perfect.

    You could absolutely do that. I actually coded it and it worked pretty good. But just in case it would not work I designed the PCBs with the RTC. After I got them I just used the RTC. It costs just 1€ so it's fine.

    0
    None
    luisalfahotel

    Question 4 days ago

    Jakub, received the PCB from JLCPCB today! Awesome quality! You comment ..."There have been some issues at the I2C line in my PCB"... The files were corrected? The main PCB pinout identifications of the RTC module is correct? See the attached photo.
    Still waiting for the rest of the sensors, but making progress ! :-)

    thank you.

    20190819_190956.jpg20190817_100146.jpg
    1 answer
    0
    None
    Jakub_Nagyluisalfahotel

    Answer 4 days ago

    Awesome! Yes it should be corrected but I didn't test it. But the I2C part seems flipped compared to mine (which is good). Anyway, mount the RTC with the battery side up, IC side down.

    Awesome mount! I honestly really like your design. Good luck with the project!

    0
    None
    mlesage

    13 days ago

    Got the PCB last week! Can't wait to go on with this project! I was looking forward for something complete like this one! Thanks!!

    1 reply
    0
    None
    Jakub_Nagymlesage

    Reply 12 days ago

    Awesome! Last week? You either live in China or you had very expensive shipping. Either way, I'm really happy to hear that and hope that the project goes well.

    There have been some issues at the I2C line in my PCB. I corrected them but I didn't order and test the corrected PCB so it isn't 100%. Just let me know when something is wrong.

    0
    None
    n4mwd

    22 days ago

    Pretty cool, but the high current draw bugs me. Maybe that can get fixed in version 3.0. A station like that really screams solar panel so it could be 100% wireless. A half amp draw is just too much to be practical for solar considering the size of the weather station. Would it be possible to power the sensors selectively with FETs? So like instead of constantly checking the temp, maybe just power the sensor every 15 minutes just long enough to take a reading? So if you could get the average power draw down to 40mA you could power it with an 18650 for 2 days in the event of cloudy weather preventing the solar panel from working at its rated output. Then it would only take a 2 amp solar panel and one hour of direct sunlight to recharge the battery to its full capacity. Just thinking out loud.

    3 replies
    0
    None
    Jakub_Nagyn4mwd

    Reply 22 days ago

    I'm going to be completely honest with you. From the beginning, I knew that I would have a power outlet on site. That's why I didn't care about the power consumption at all. Half an amp is just an estimate. I didn't test it for with lower current because I don't have a bench power supply. I think it can be as low as a 100mA but I can't really tell.

    Everything you are saying would absolutely be possible. With a TPL5110, I could get it to a 100mA while reading for 10 seconds, and then to 30uA in the sleep mode for 10 minutes. That's 163uA or 0.163mA average current consumption. I know how to optimize really well from my picoballoons, I just knew that this station wouldn't need it.

    100% wireless sounds nice and all, but it isn't such as useful. Wi-Fi has range of around 20 meters. And when there's a Wi-Fi router 20 meters away from the station, there should be a power outlet as well. Solar power is cool but then it would make sense to also change the communication to GSM. Basically what I'm saying in step 1 "Design".

    I have another 3 people which want another 3 stations built so if they'll want it to be solar powered, I can make it solar powered.

    0
    None
    n4mwdJakub_Nagy

    Reply 21 days ago

    Yes, 0.163mA average current consumption would be really awesome. A solar powered unit would be autonomous and would be much easier to install - say at the top of a pole. You would only need gsm if you were installing it in the middle of a field somewhere - for example, a farmer that wants to check the weather conditions of his crops. Where I live, in South Florida, we can have hurricanes that knock out the power and that is when you want weather data the most. But if you only draw less than 1mA, then a simple battery backup would work just as well as solar. A single 18650 would last about a year on a charge.

    0
    None
    Jakub_Nagyn4mwd

    Reply 21 days ago

    I agree with everything. It is something to think about in the next version.

    0
    None
    JDrago

    Question 22 days ago

    Great project. Very well done. Did you purchase or manufacture the anemometer and wind vane? If purchased can you provide a link. If you built them can you explain how you built them?
    Thanks

    1 answer
    0
    None
    GISMapper

    22 days ago

    This looks great. Is there a way to export the data to a spreadsheet without uploading it to the internet?

    2 replies
    0
    None
    GISMapperGISMapper

    Reply 21 days ago

    Thanks for your great reply. This is a great project. You got my vote.

    0
    None
    Jakub_NagyGISMapper

    Reply 22 days ago

    Thanks. Sure there is, but I'm not sure why would you want to do that. Do you want your data to be private? Then I would just setup a premium account. Even if I would be doing it with a spreadsheet, I would choose a cloud one such as Google Spreadsheets. Even though the ESP32 can save files on a SD card, I don't think it can handle writing in a spreadsheet format such as .xslx. So you would have the data in a .txt format which would be OK for climatology logging, but absolutely unnecessary and inconvenient when you want real time data. There is a large advantage to the cloud services that's why everything is IoT now. Oh and also, Weathercloud has a function called "Reports" which can basically make you a spreadsheet from data from your station. You can choose any value and any time period you want.

    0
    None
    Jakub_NagyMarcelS9

    Reply 21 days ago

    Thanks! Oh that's exactly what I've been looking for. I'll add that ASAP to my station and Instructable as well.

    0
    None
    daveyrb

    22 days ago

    This is really neat, a nice project I will defanatly have a go at this. I have voted for you as well.