Building a weather station
Once upon a time I built a weather station. I don't have any photos lying around, but I could ask Anna if she has any.
I named the project Weatherbox, after a song by Mission of Burma (see here).
By built, I don't mean I bought one. I mean I literally built it myself, from raw components.
I'll tell you how you can, too, along with some things I will do differently in the future.
Components
Full disclosure: I am an Amazon Associate and I may earn commission on these links; you won't be charged extra for this. I know it sounds scummy or that I'm selling out, but I need the money. Please consider using the links below to buy the materials in question!
Here are some of the things I used. I wouldn't necessarily use all these components now, but they worked at the time:
Electrical components
- Some stripboard; I never got around to designing a PCB
- An Arduino 33 IoT (though I might use an ESP32 nowadays, or even one of Arduino's MKR boards)
- These RJ11 connectors
- A BME680, which does temp, humidity, air pressure, and air quality, all in one
- A DS3231 breakout for accurate time-stamping, although a GPS module might work too
- Although I used a different UV sensor, I'd probably use a S12SD nowadays
- This wind vane, anemometer, and rain gauge; they use RJ11 connectors, hence the above; these days, I'd probably use something a bit more sturdy and less fiddly
- A Raspberry Pi Zero for data collection
Mounting hardware
- This mount, although I'd probably consider a different one, this one I know works
- This junction box, I drilled some holes in the side and used some O-rings to keep water out
- I modified this LaCrosse temperature sensor housing as a housing for the BME680 and such by sawing off the internal mount and enlarging the holes for wires; but there are better options
- U-bolts I got from Lowe's, it isn't worth it to buy them online, I used them to mount the junction box to the pole
- Hose clamps to attach the mount to my railing at my apartment, although you don't have to
Prototyping and assembly equipment
- 22 AWG wire
- If you don't have a soldering station, the X-Tronic 3020-XTS is good value for money, although I found the helping hands of questionable value, the rest is great
- Jumper wire for prototyping
- Decent breadboards; Elegoo's are okay
- A long MicroUSB cable; I never got around to adding a solar panel, my apartment area was too shaded
- Some 1% tolerance or better resistors, these “BOJACK” ones (whatever that means) are okay; 0.25 watt resistors are fine, although 0.5 watt is fine too, it doesn't really matter, we aren't putting that much current through them
- Heat shrink, I used this and it was fine
- A stripboard track cutter, similar to this although perhaps you may not want to get it off Amazon because there don't seem to be many and the one I could find had bad reviews; I don't remember where I got mine, it wasn't Amazon though
- Some pin headers, any will do, for breakout boards that don't have them, although you can also just use wire
- A lighter for the heat shrink
Miscellaneous components
- A UV transparent conformal coating, such as acrylic; I used MG Chemicals's 419D
Assembly
I didn't keep photos of the assembly process, though I wish I had. It took me a lot of trial and error to get it right and settle on a design I was happy with.
In the end, I settled on a design where my Arduino 33 IoT would connect to the network, and my Raspberry Pi Zero would poll it for data and upload it to my site.
Layout
The Arduino itself lived in the junction box. All the ports were on the bottom of the box, with grommets to prevent water ingress. I added some extra grommets to ensure at least some airflow.
I broke out the BME680 onto its own daughter board, and put it in the aforementioned LaCrosse housing. I found the junction box could get quite warm and would cause inaccurate readings, plus we want plenty of airflow anyway for the air quality measurement.
The UV sensor was covered in the aforementioned conformal coating and attached with epoxy to the top of the junction box. I just used some wires and wired it to the Arduino in the box. I added a drip loop to the wire to ensure it wouldn't cause issues.
For the anemometer and rain gauge, I used pull-up resistors (2K resistors worked best I found, but you could probably get away with a 5K or even 10K resistor) and a 2pF capacitor in series for filtering. I did most of my debouncing in software, however. I just hooked up the connectors to little pieces of stripboard I cut out for the purpose to mount the resistors and capacitors.
The wind vane was trickiest. Here is the datasheet. As the PDF says, “it has eight switches, each connected to a different resistor.” I used a 10K ohm resistor like it suggested to create a voltage divider, which I hooked up to the ADC on the Arduino. I ran a binary search to find the correct voltage value. I find that the “in-between” measurements are fiddly and only work in certain directions. One should expect to have 8 indicated positions total and no more, and anything else is a bonus. This is fine for a hobbyist project, but do keep that in mind. I would definitely experiment and see how your wind vane reacts. This is the point where good tolerance resistors are helpful.
Most of the discrete breakout board components speak I2C, so I just hooked them all up to the I2C line. You may want to add I2C buffers if you're getting lots of interference or too much capacitance. Something like this may help.
Prototyping
I cannot emphasise this enough, you must prototype, prototype, prototype. Do everything on breadboards before you put it on stripboard. They have their limitations, but they'll help you get a feel for how the components work. I found the fiddliest part was not the I2C bus, but the weather vane/anemometer/rain gauge. It took me ages to figure out I needed a pull-up on them, and even longer to debug the circuit for the wind vane.
Source
I have some code here that you can adapt to this project or just use. You'll want to swap out the Si1145 UV sensor code if you use the S12SD. It gives a simple analog reading, documented here.
What I'd do different
I did mention a few things I'd change, like swapping out the Si1145 for the S12SD and maybe a different mount.
I think a big change I'd make, perhaps the biggest of all, would be to swap out the anemometer, wind vane, and rain gauge, for discrete components that didn't all just come together in a kit. Something far more professional would be in order. This will require fabricating some mounts, but I think that's within my abilities. I plan to do that for the second iteration of this project.
I would definitely spend more time on the breadboard working things out than I would otherwise.
I found the WiFi fiddly and annoying. I would probably switch to LoRa communications instead of WiFi, this would also enable me to use the cheaper Arduino 33 BLE. I'd just have to get it working with the Pi Zero.
I had a lot of stuck I2C bus problems, likely due to capacitance issues. I would definitely use a buffer as aforementioned, and perhaps a simple transistor to fully shut down all devices on the bus and restart all devices.
In the future, I would like to make this solar powered. I'll need to find a cooling/heating solution for the battery, however, to keep it within temperature ranges (especially as the PNW gets hotter and with our sometimes cold winters).
Notes
I didn't need any 5V components for this project. 3.3V is increasingly the standard for breakouts and sensors. Not even the anemometer, wind vane, or rain gauge needed 5V. If you use an Arduino 33 Nano series board and want to use 5V components, you'll have to bridge the 5V connector to enable the 5V regulator. You'll likely want logic level converters to avoid damaging the Arduino, or voltage dividers, as it can't take more than 3.3V on its pins except ground.
— Elizabeth Ashford (Elizafox) Fedi (elsewhere): @Elizafox@social.treehouse.systems Tip jar: PayPal || CashApp || LiberaPay