DIY Smart Home Weather Station – Wind, Rain, Temperature, Pressure, Humidity, Light
I set up a DIY weather station in my garden that’s connected to Home Assistant and logs everything from wind speed and direction to rainfall and temperature. Why, you might ask? Well partly because I’m a nerd that loves collecting data, and partly because I kind of want a vertical wind turbine but I want to see if it’s actually worth installing in my garden before I drop a hefty chunk of change on one. So, here’s how you can do this too – although to be perfectly transparent, I can’t recommend this kit. You’ll see why.
But, this is the kit I bought. It’s from the good ship Pimoroni, and it’s their Enviro Weather kit. Now to be clear you can just buy the weather station sensors yourself, the wind speed, wind direction and rain level sensors along with their mounting arms and a poll, all for the same price as most standalone weather stations. Of course, they won’t actually do anything on their own, you’ll have to hook them up to something – I’d guess an ESP32 running ESPHome would be the easiest, but that’s up to you. Naturally, if you’d rather not build a data capture device yourself, their Enviro Weather board seems like the perfect fit. Not only does it let you use all three sensors, but it comes with a BME280 pressure, temperature and humidity sensor and an LTR559 light sensor too. That’s all connected to the world via its backpacked Raspberry Pi Pico W, and it’s powered by a little dual AAA battery holder. Pimoroni claims with the right settings this can get 6 months of battery life with two AA batteries!
Since this is also kind of a review of this kit, let me explain a little about how this lot actually works. First off, on the hardware side, it looks like the wind speed sensor is basically a rotary encoder or switch which effectively sends a pulse after completing a rotation. If you know the size of the cups, and how many pulses you get in a second, you can work out how fast the cups are moving and therefore how fast the wind speed is. The wind direction I think is the same, but with a number more positions it can report. The rain sensor is pretty clever, it basically has a see-saw mechanism where – at least according to their open source firmware – it takes 0.2794mm of rain to get it to tip from one side to the other. It counts how many ticks it sees over a given time period, then can add that up to give you the total rainfall amount.
To set up the kit, you’ll obviously want to mount the hardware sensors to their mounts, then the whole thing to something outside as securely as you can. The RJ11 cable from the wind speed sensor plugs into a passthrough port on the direction sensor, then both RJ11 cables from the direction and rain sensors will need to plug into the board. The kit also includes an enclosure – but you’ll need to drill a hole in the bottom of it to fit the cables in. Plugging the battery pack into the board, along with the rain and wind sensor cables, and switching the battery pack on, you’ll be greeted to a rapidly blinking white LED. That’s your signal to fire up your phone and connect to its WiFi hotspot to provision it. The setup menu looks great, if pretty buggy, and basically asks you to give it a name, connect to your WiFi network, then tell it where you want it to send its data to. You can just have it store the data locally and you come and manually retrieve the readings, or you can have it pulse data to a web socket, Influx, MQTT or AdafruitIO. I’m already using MQTT for my solar charge controller bridge and it’s generally the best way to send data to Home Assistant.
One of the most important settings for battery life is how often it takes readings, and how often it publishes those results to your chosen output method. The default settings are new readings every 15 minutes, and upload after 5 readings are taken. They “recommend” every 10 readings though, so I’m not sure why 5 is the default. Still, basically this kind of queueing results helps save the battery life as connecting to the network is a fairly power hungry task, so doing one burst every 2 and a half hours makes sense.
Unfortunately, on the firmware version that ships with these boards, that feature seems to be broken, at least for MQTT. It will only ever transmit the most recent result, despite taking 2 and a half hours between results. What’s even more frustrating – although this isn’t Pimoroni’s fault – is that Home Assistant seems to use time of arrival to know when new data is from, rather than a timestamp built into the result. That means even if the feature did work, all 10 results would show up as one time slot, rather than backfill, making the data pretty useless. Now the former can be fixed by updating the firmware, and technically the latter can be fixed by just uploading one result at a time, but that degrades battery life considerably.
You’ll want to get comfortable upgrading the firmware on these boards though, as the “Alpha” tag they list is very much accurate. This is painfully buggy, and the documentation is both dense and sparse. I’m someone who is clearly very comfortable with tech, programming, microcontrollers and electronics. I designed and hand manufactured the Open Source Response Time Tool, so I have some idea what I’m doing when it comes to hobbyist electronics like this. Still, I don’t have any experience with the RP2040 chip this is based on, and that meant I had no idea how to “backup my config.py file” or “check logs.txt” as their documentation recommends. Plugging the board into your PC in its standard device mode – much like any microcontroller – only shows up as a serial port, not a USB device. I followed the instructions for upgrading the firmware – which is to hold the boot select button in the Pico down as you press the reset button – then the board showed up as a removable USB stick. Except no filesystem showed up, only space to drop the .uf2 firmware file. It took a lot of forum posts and watching youtube videos to find out I needed a third party tool called Thonny, then to click this not-a-button at the bottom right to select the Pico’s COM port, then it finally showed up – although make sure it’s not in the bootloader mode, ie connected as a USB stick. None of this is in their documentation, so anyone who isn’t already very proficient in RP2040 development would have no idea where to even begin.
Something else that isn’t supported is Home Assistant, at least natively. Using MQTT, Home Assistant needs the device to basically register itself with the MQTT Broker – in Home Assistant that’s normally the Mosquitto addon. This lets Home Assistant know to create entities and to listen out for new updates from the board. These Enviro boards don’t support that. It’s something I think I know how to do, so I might give it a go adding it in, but until I (or anyone else) does, that isn’t supported. You’ll need to edit your configuration.yaml file (using the File Editor Addon) to add each value it reports as its own entity. I’ll leave a link in the description to my post on Pimoroni’s Github repo which contains all the code you’ll need to get the Weather board setup on Home Assistant.
Now remember how I said this is a buggy mess? Well, after realising that Home Assistant wouldn’t accept multi-packet bursts properly, I set it to take a new reading every 30 minutes and upload after every reading. That is five times faster than the recommended settings, but I can deal with it burning through batteries once a month or so, especially if I use some rechargeables. Sadly, after just 12 hours of somewhat useless readings, the data just stopped. No new packets were being sent… Wonderful. I brought it inside, worked out how to connect to it, found it was storing all the data, but the logs just showed it flat out stopped. That’s when I upgraded the firmware, set it back up again, then stuck it outside. I woke up the next day to find it was dead. No new data. Wonderful. Turns out the batteries were dead. Yep. TWO WHOLE DAYS OF BATTERY LIFE.
It was right around then that I gave up and just hardwired it. I have a solar battery bank in the shed already, I have a waterproof enclosure providing power to my terrible rowing machine, and the wind station is literally strapped to the frame for my solar panels. So I ran a 5 metre USB cable and set the board to pump out new results every 5 minutes – and it’s been so much more useful! Wind often isn’t all that consistent, so before I was getting a lot of flat lines at 0 m/s, but now I’m seeing much more of the peaks and troughs. It’s much more granular, and I have no problems with it needing new batteries. Beautiful.
So it should be pretty clear why I can’t recommend this kit right now. In a few months when some of the bugs have been worked out, I can see this being a great choice for the data-curious. Still, having data on how windy it is out there is going to be very useful data for me in assessing whether a wind turbine is a worthwhile investment for me – and of course that’ll be at least one if not multiple videos on the channel so make sure you are subscribed so you don’t miss that.
