NOTE: This was originally published on my website on February 2019!
I’m not sure exactly when I became interested in building a weather station. It was at least year or two ago… I remember seeing the Project Curacao 2 post on the SwitchDoc Labs page and thinking it would be fun to build something like it, but much more integrated. I’ve also never worked on “outdoor” projects and want to learn more about weatherproofing, solar charging, etc… (What I really want to do eventually, is build an ultrasonic anemometer, but I told myself I won’t start down that rabbit hole until I have a fully working weather station.)
The very first goal was to get a weather station that could measure the following:
- Wind speed and direction
- Rainfall
- Barometric pressure
- Temperature
- Humidity
- Light level
Early on, I looked at using LoRa for radio communications, like the Curacao project. After looking at it for a while, I decided against it at first due to the much higher barrier of entry for getting something working. I might switch to it in the future though!
Since I had been working with BLE devices on other projects, the first board I made used the NRF52, which I was familiar with. The device worked, but it never made it past my workbench. The range wasn’t great (duh!) and I lost interest in the project for some time.
First BLE Boards
Second TryAfter not working on the project for almost a year, I told myself I’d get something working over the winter break. I decided not to over-optimize from the start and just get something working. Outside.
I’m not sure why I decided it had to have GPS initially. Most likely because it’s fun and these projects are really just an excuse to learn new things and I hadn’t done GPS in embedded systems before. Either way, that led me to select the STM32 NUCLEO-L476RG development board to start. It had plenty of UART interfaces(radio, gps, debug) and is fairly low-power. It also has native MBED support, which is another one of those tools I wanted to play with (and would speed up development).
For the radio, I decided to go with Xbee radios since I could survive with what ends up being just a wireless serial port. Again, I’ll probably use something else eventually, but this got me going and making progress.
Nucleo Weather Breakout v0.1After playing with the Nucleo board and getting a mess of cables going, I made a PCB breakout board with the Xbee header and RJ11/14 plugs for the wind and rain sensor assembly, along with some I2C, UART, and analog pins broken out.
Weather Breakout v0.1
This board let me do a great deal of FW work, as well as get a rough idea of the overall power consumption of the device.
First EnclosureSince I wanted to have something outdoors as soon as possible, I ended up getting a huge solar panel with a huge battery and off the shelf charger/regulator. This was pretty close to the least efficient setup possible, but it worked and started measuring data outside.
I found a huge Bud Industries NBF-32026 ABS Case to use as the enclosure and found some cheap cable glands for all the cables. There was no easy way to mount all of the electronics to the box without some sort of mounting plate, which I didn’t have, so I ended up using the side of a box and zip ties.
Inside First Enclosure
I had no idea how to go about drilling huge holes in the case, but I found a video by bigclivedotcom about using step drill bits on plastic, so I decided to give them a try. The step drill bit worked great! I had previously tried using a really wide drill bit and was unsuccessful.
Step Drill Bit
Unfortunately, where I currently live, there’s no direct sunlight in the patio during wintertime. This means that even with the huge panel, I still had to manually recharge the battery every week or so. Either way, it let me do FW and backend development (computer receiving and saving the data).
First Outdoor Setup
After I had most of the FW verified, I decided to do a second breakout board. This one had a built-in low-ish power GPS and antenna, BMP280 pressure sensor, as well as fewer random headers, and a new dual RJ11/14 connector.
Weather Breakout v0.2
Once the second board arrived and was working (It required a few bodge wires to get working as usual), it quickly went outside for longer-term testing. Overall, I think it was outside for a few weeks before being replaced by the new model.
Inside First Enclosure (with breakout v0.2)
After playing around with the breakout boards, I decided it was time to integrate it all in a single board. I named it Chaac.
This is where I ran into issues with MBED. Making the board support package (BSP) for a custom board was not trivial. Another issue was that I couldn’t get the low-power modes working quite right. At the same time, I decided to ditch GPS, since the weather station is unlikely to move without my knowledge. With the new requirements, I ended up switching to an STM32L432KC based board.
On the FW side, I decided to go back to mynewt OS, which I like and have used before. Porting the mynewt BSP was also not trivial, but I was able to do it in a couple of days. Using mynewt also gave me the benefit of using the mcuboot bootloader, which will let me do “simple” FW updates over the xbee link.
This new board has a battery charger and solar panel input (borrowed from Adafruit’s Solar Charger, STM32L432 microcontroller, BMP280, fan driver, and inputs for external temperature/humidity and environmental light sensors.
Chaac v1.0
As with most new designs, I made some silly mistakes with the first version. Not having pull down resistors on the standby pin for the Xbee, having a floating boot0 pin on the STM32, mis-wiring the battery charger, etc. After lots of debugging and some reworks, the board was working well enough and went outside to replace the old setup.
Second EnclosureInside Second Enclosure
Now that the setup was much simpler/smaller, I needed to get a smaller enclosure. I found a great video by ModestMaker on YouTube which has step-by-step assembly instructions and a full parts list for a remote environmental monitoring system (Check out the description of the video for lots more details.) I used the same Bud Industries NBF-32202 Economy Box, McMaster cable glands, conduit, RAM mount for the solar panel, etc…
Second Enclosure Outside
In order to mount the Chaac v1.0 board to the enclosure, I again used a piece of cardboard with holes it. It worked well enough in the short term. On the outside, I used a piece of PVC pipe and a plastic cup to shield the temperature/humidity sensor from the rain and some conformal coating to make the light sensor waterproof.
Applying conformal coating to light sensor
The second revision of the chaac board included fixes for all the bodge wires in the v1.0. I removed the fan driver and gps serial input, since I didn’t think I would ever use them, and moved the light sensor connection to the bottom for simpler wiring.
Another addition was a MOSFET to disconnect the wind direction and light sensor power when not in use. This helps in lowering the power consumption when not taking a measurement. The wind direction sensor is just a resistor (that changes depending on direction, but not quite a potentiometer), so it’s always consuming power unless it’s cut-off.
Chaac v1.1
Since I had one system working outside, I decided to put together a second enclosure. Being the incredibly attentive and detail oriented person that I am, I drilled the holes on the wrong side of the box. Since the solar panel cable is so short, the cable gland needs to be on the top side of the box near the door hinges, not on the bottom… I used some gorilla tape to cover up the bad holes and hoped it would keep out the water. I also tried a new method of mounting the board: a piece of cheap plastic from a disposable food container.
Patched Hole
Plastic Mount
The last revision of the board added solar panel voltage monitoring, a bootloader button, and moved the solar panel and battery connectors to a better location. The solar panel voltage can be used to determine whether or not the battery is being charged and also to get light levels. I wanted to see whether a separate light level sensor is worth it or not.
Chaac v1.2
I put together one last enclosure. This one used a piece of wood for a slightly nicer backplate and had properly aligned holes.
Fourth Enclosure with Wooden Mounting Plate
Why so many enclosures?! You might ask… This one traveled with me to Mexico when I visited my parents. My dad and I installed it on the roof of the house. For the first time, the weather station had a clear view of the sky :D.
Final Setup in Mexico
In order to get the data from the weather station, I set up a Raspberry Pi with an Xbee radio. I wrote a python script to decode the weather data packets and store them in a sqlite database. At first, the only way to view the data was to export it onto a csv file, so I decided to look into writing a web interface to display it instead. Since I have no idea what I’m doing, I had to learn about things like Flask, Bulma, and Plot.ly.
In the end, I came up with something that looks like this:
Web UI Summary
A “summary” page with the latest data as well as a “plots” page with day/week/month data.
Web UI Plots (1/2)
Web UI Plots (2/2)
So far you need to be on the same network as the raspberry pi to view the data, but I do have plans to make it publicly visible at some point.
Next StepsBefore I keep going, I’m going to take a break from the project to work on some other things. Once I do that, here are some of the things I want to improve/make:
- The web UI could use a ton of work to make it look better
- Use a much smaller battery and solar panel (and therefore, enclosure)
- Make a public UI with data from various weather stations (I want to make more!)
- Use a different radio!
- Make an ultrasonic anemometer :P
- So many more things…
This project has many more things I want to share than I wanted to fit in this post, so maybe I’ll write some follow ups. Some topics I learned a lot about and want to share are:
- Doing a wireless firmware update over the xbee link using MCUBoot
- Getting lower and lower power consumption
- How the web ui and database work
- How the sensors work
- How not to make enclosures :P
Let me know if any of these sound interesting and I can try and focus on those first!
More InformationAs with most of my projects, all the source code, schematic/PCB files, etc. can be found on github.
--------------------------------------------------------------------------------------------
NOTE: This section was originally published on my website on July 2020
It’s been over a year since I wrote about my weather station project. A lot of things have happened since, so I figured I would post an update.
Soon after returning from Mexico, I started thinking of the next version of the board. I didn’t want to continue using the XBee radios, so I decided to try out bluetooth again… In order to continue having a working weather station I kept the XBee radio and added Bluetooth support by switching to an NRF52811 microcontroller, which has the new LE coded PHY for Bluetooth, which, in theory, gives you much longer range. Using version 2 of the board, I was able to get Bluetooth working and brought up the new NRF52
The next version Incorporated a few new technologies that I wanted to try out. The main goal was to make the enclosure smaller and the overall system more compact. I decided to split the project into two separate PCBs, which allowed me to use the slightly more expensive 4 layer board on the radio section and the cheaper 2 layer board for the larger base board. This also allowed me to try out double sided surface mount soldering. I had been using stencils and solder paste, but had never done it on a double sided board
The last new feature I wanted to try out was a different RF connector. Previous boards used an RP-SMA connector but I wanted to try something more compact. I decided against using a u.FL connector due to the low number of insertion cycles, and went with the MMCX connector instead. Another interesting topic I learned a bit about was waterproof RF connectors.
In theory, I would have been able to test different versions of the radio / controller board with the same base board, but in reality, this version only made it to a few conferences as a demo unit.
I actually gave a talk about this at the CrowdSupply Teardown Conference in 2019. I covered a few more details than what I’ve written so far, so you should check it out down below. One quick note that was covered in the video that I won’t go over in detail in this post: The weather data is now publicly available on chaac.network! Each Raspberry Pi logs the data locally and has a persistent WireGuard VPN connection to my server. Whenever a request is made in the public server, it forwards the request down to the respective Raspberry Pi. I didn’t want to make it all cloud based, so the data is always stored locally, even when the internet goes down. This also avoids complicated network setups to open ports in firewalls since all the connections go through a public server.
As the year went on, I started thinking of new upgrades to the weather station. I decided to get rid of the two board solution and went back to a single board. This made assembly and conformal coating much simpler. Instead of going with a perfectly sealed enclosure, I started looking at open solar radiation shields, like the Ambient Weather SRS100LX. This would get rid of the external temperature/humidity sensor, which was expensive, and allow to mount all the sensors on the same PCB. I switched from a BMP280 temperature and pressure sensor to a BME280 temperature, humidity, and pressure sensor. Using the radiation shield also gives the benefit of slightly better temperature readings since, as long as there is airflow, it doesn’t heat up nearly as much in the sun.
Since the radiation shield leaves the entire board exposed to the elements, I started looking at conformal coating again. I left the new board operating for a while oudoors before coating it to see how much water it would get during a rainstorm. I think it did actually stop working for a bit and I had to bake it in the reflow oven to get it back. It also became the home for some critters rather quickly…
After cleaning and making sure it was working again, I used the MG chemicals #422B silicone conformal coating. Since the sensors need to be exposed, I masked them off with kapton tape before applying the coating.
Time flies. By this point, an entire year had passed since my last trip to Mexico! Before heading back there, I put together a new kit with the v3.1 board and a radiation shield. Since there was already a station with a rain/wind sensor at my dad’s house, I didn’t bring an extra one. In order to get better temperature/humidity readings, we decided to install the new one in a sort of alleyway next to the house where it is extremely windy and mostly shaded.
After a few days, we noticed significantly lower measured temperatures down below than on the roof, which was not surprising. Another surprising thing was that it was able to get enough power from it’s tiny solar panel even while mostly covered! This new version was much more efficient power wise. Unfortunately, I never actually got the LE coded PHY for Bluetooth implemented, so the radio range wasn’t very good. We had to move the receiver closer to the weather station than before.
While I was visiting my parents, it was also a good time to check out how the old weather station had fared after one year in the sun. It was fairly dirty and had lots of stains in the plastic, but it seemed ok. As in other cases, a few critters seemed to have come and gone, but the sealed enclosure did it’s job beautifully. The main board looked pretty much the same as before. As of this writing, it has been running non-stop for over 505 days!
A month or two ago, there was a tropical storm that went close to my parent’s house. It was extremely windy and rained for days. Unfortunately, the BME280 sensor appears to have taken in some water as it only reports 100% humidity now. The manufacturer had a few recommendations like baking at a particular temperature, then rehydrating, but it didn’t work. The conclusion was that the BME280 shouldn’t be exposed to the elements, which doesn’t really work with an outdoor weather station. I began looking around for alternatives and ended up with the Sensirion SHT31 temperature/humidity sensor. They offer a filter membrane option which is water and dust rated (IP67) and should be able to handle some water droplets. For pressure, I decided to go back to the BMP280, but build a sort of cover around it to protect it from water while allowing for accurate pressure measurements.
With this latest redesign, I made a few more changes. First of all, I decided I would no longer be afraid of LoRa and put in a LoRa radio module. This will, with the right firmware, allow for standalone operation using LoRaWAN and The Things Network. It will also allow for much longer range, with its lower 900MHz frequency, with some slightly higher power consumption. I can continue using it with my Raspberry Pi point-to-point setup as well.
Next change was to get rid of the solar panel and battery charger. From similar projects, I estimate I can get the average power consumption in the low tens-of-microamps range or even single digit microamps. With some alkaline AA batteries or rechargeable AA batteries, the devices should last well over a year. This simplifies the circuit and makes installation much simpler, since no direct sunlight will be required. The final change is to split the pressure and humidity sensors and somehow shield the pressure sensor from the elements. I’ve had a few ideas bouncing around in my head, so I’ll have to try a few and see what works. The AM2315 sensor I used previously has a really nice mesh/membrane that’s supposed to shield it from water while still allowing humidity measurements to be accurate. Turns out that membrane isn’t super cheap, as I had suspected. I’ve also considered using a plastic tube with a very fine mesh to stop water from getting in but still allow for decent pressure measurements.
In the end, I might just dust off my CAD skills and just make a 3D printed enclosure that leaves the temperature/humidity sensor exposed while shielding most of the circuit, along with the pressure sensor.
That’s all I have for now. As always, all the design files are on github. If you have any questions/comments feel free to email me or message me on twitter @alvaroprieto.
Comments