Raspberry Pi Weather Station

As a snowboarder, mountain lover and climate geek, weather is a big deal for me. I'm really interested in tracking local trends and how weather is changing in our village, so I've been looking at getting a NetAtmo smart weather station. Tasty piece of kit, but a bit pricey for my liking.

This winter, I've decided to make time to learn some new things and follow some passions, so I figured this was a great opportunity to combine the two - and build myself a low-cost internet-connected weather station. After a bit of research, I ordered a few bits from Amazon and a smattering of other sites - starting with a Raspberry Pi Zero W (WiFi enabled), a BME280 sensor and a DS18B20 temperature probe.

Breadboard prototype

It's been pretty fun and got my thinking about lots of ideas now. I thought I'd share some of the things I learnt / re-learnt:

  • Pi Zero I've had a Raspberry Pi for ages and am pretty familiar with Raspbian, but needed to learn more about using GPIO and in particular, the newer Pis have 40 pins.
  • Soldering It's been a good 20 or so years since I last soldered in my DT and Electronics GCSE! I had forgotten that it's as much an art as a science :). Had to solder the 40 pin header on to the Pi and several other headers.
  • Electronics communications protocols Turns out that there aren't that many different protocols - Serial Peripheral Interface (SPI), Inter-Integrated Circuit (I2C) and Universal Asynchronous Receiver/Transmitter (UART). The sensors I used work with I2C and SPI.
  • Python I've never used it before and I quite like it now. Pretty straightforward to get to grips with, but powerful and lots of cool modules to use. Learnt to make modules and packages in Python to neaten up the project structure.
  • Linux kernel modules There were some handy kernel modules for communicating with the temperature probe which I had to use - I don't really understand them yet, but get the principle.
  • Google Sheets API I wanted to upload readings somewhere and figured Google Sheets would be a straightforward option. I've used a bit of Google AppScript before, but had to learn how to setup and authenticate in Python and then append new data to a sheet. Future options would be MySQL or JSON hosted locally or on a local webserver. I could also upload to Weather Underground - but I want to get it properly set up, tested and stable before I do that.

It was surprisingly cheap and easy to do (with a bit of prior knowledge and some Googling) - but it struck me that it would be easy to build a load of cheap e.g. rainfall sensors and then explore ways to generate super-local climate data.

It's sparked some ideas which I'm now going to play with and explore a bit further.

Here's the code: https://gitlab.com/yukinosaru/pi_station