I Built an Arduino-Based Weather Station as a Side Project

Thomas Lewandowski
7 min readOct 29, 2022

--

My introduction to sensors, Arduino, and meteorological observation

The small weather device and the charts in practice. Source: Me

Introduction

For my latest side project, I built a weather station to track the weather right on my apartment’s balcony. Two key benefits to building a weather station myself over buying an off-the-shelf weather station:

  • Extensible to many different sensors and potentially actuators
  • Sync data to the cloud, so I can display, analyze, and share it

This project also satisfies two other personal goals:

  • Learn the Arduino platform and relearn electronics skills (soldering and circuit design) from college. Build confidence for advanced projects.
  • Gather weather data to satisfy my own scientific curiosity.

For more info, see the PRD I wrote for this project:

Supplies

The weather station is actually quite simple, as it’s just some small electronics in a little box on my balcony. Overall budget: $105 USD.

My balcony and the electronics box. Source: Me

Arduino & Sensors

The Arduino microcontroller is the brains of the weather station. I chose the MKR WiFi 1010 for its ease-of-use:

  • Built-in WiFi to upload to the cloud
  • Compatible with the MKR ENV shield for the sensors

The MKR ENV shield is great because it has 4 basic sensors (temperature, humidity, pressure, and luminance) already soldered directly on the board.

I could have gone the other route of buying an Arduino Uno, LM35 temp sensor, breadboard, etc. But I didn’t and here’s why:

  • Don’t have all the equipment yet (ie soldering iron)
  • No need yet to choose one specific type of sensor
  • Keeping it simple for this first Arduino project

You can’t doubt the simplicity. The MKR WiFi board and the MKR Env boards are designed for each other. Just plug the ENV board on top of the WiFi board and you’re done!

I was surprised at how tiny the MKR boards are. I expected them to be like a full-size candy bar, but they’re actually just 2.5" by 1" (ie a small Halloween candy bar). Of course the sizes are on the product listing, but as they’re in metric I didn’t notice lol. They also look much larger in the picture. Small or big though, it’s no big deal.

Enclosure

qBox DIY IOT Enclosure Plus Kit (One SMA). Source: iot-bots.com website (the manufacturer)

The qBox enclosure is great because the PCB (printed circuit board) is specifically designed for the small MKR form factor. It’s also transparent which is good for the luminance sensor.

But it was really hard to choose exactly which qBox to buy. It’s a little clearer on the IOT Bots website than on Amazon. The main differences are:

  • qBox vs qBoxMini: The mini version is smaller in terms of volume. The full version can hold an Arduino Uno. While both can probably work, just to be safe I bought the bigger one.
  • Non-plus vs plus versions: The plus version contains some connectors and converters that might be useful. I got it just for the spare parts.
  • No SMA vs 1 SMA vs 2 SMAs: The SMA is a type of connection you can use for an external antenna. I don’t need an antenna for this project, but I do need an extra opening for the microphone, as I discuss later.
  • DIY vs AFC vs AMC: This refers to the design of the PCB. DIY is general purpose for all boards. AFC is for the Feather form factor, while AMC is for MKR form factor. I bought a DIY one by accident, but it works fine.

I also learned that I had to place the device off-center, ie not as designed in the PCB board. If I did place it in the center, the power cord couldn’t safely bend enough to the side to go through the small cable holes.

Coding

I put my code for this project on Github.

However, the code is embarrassingly easy, as the included libraries did all the heavy lifting for me. Also, I followed an excellent tutorial from the official Arduino website. For an MVP, that’s all I needed.

Graphs & Charts

A key part of the project is uploading the data to the cloud, so it can gather data when I’m busy and while I’m asleep.

Many IoT (internet of things) cloud platforms exist to capture the data and display it in dashboards. Arduino (the official company) has a simple IoT platform, but there are many other good ones like Blynk.

The dashboard I use to show my weather data. Midnight is in the middle. Source: Me.

So far so good with just a day’s worth of data. For the middle chart, you can definitely see the illuminance (brightness) dip at sunset, near 0 at night, and grow at sunrise. I’m curious to see how it varies in the daytime from the shade of the nearby trees or the clothes I hang out to dry.

For temperature and humidity, you can see a clear cliff change at midnight. This was when I realized something was wrong. The temp sensor was too constant and too hot — it said 77F when I knew it was not 77F at midnight.

I quickly realized that the enclosure was holding me back. Even with two air holes, it was holding the air in the box too closely and not connecting it with the outside environment. So I took off the cover so the air can directly touch the sensors, and very soon I saw the temperature vary normally.

You can see this also at yesterday at 12:30pm, when the sun shone directly on the sensor causing spikes on temperature and illuminance, and a weird negative humidity reading. I guess that the clear box caused some sort of mini-greenhouse effect.

While I still like the enclosure, in the future I will use it just for the Arduino board. For the sensors, I will put them closer to the environment or in a controlled space like a Stevenson screen.

Future Directions

Functionality: Noise Pollution

San Diego doesn’t get much rain. Even if we did, my balcony is covered so it wouldn’t capture any. I could mount a water gauge outside, but that would be difficult. So a lot of work for not much data.

What we do get is noise pollution. My apartment complex backs up to a large senior living center with a giant AC unit that runs day and night. On hot days the unit runs even louder. Plus my balcony has a washer and dryer unit that can be very loud.

So I plan to measure ambient noise levels as another kind of environmental variable. I bought a MAX4466 microphone, but it’s taking a really long time for it to ship. We’ll see how it works out.

Functionality: Measure Wind Speed

Connect an anemometer to measure the wind speed. I get a fair breeze inside and around the apartment complex. But at $50, anemometers are more expensive than I thought. It’s also difficult to mount it far enough outside my balcony to capture the wind.

Functionality & Reliability: Build It Again Again at My Dad’s House

While I’m crunched for space at my California apartment, my dad’s house in Texas has a lot of outside space. So I can easily mount a full weather station there with an anemometer, vane, and rain gauge. There’s also more rain in Texas, so a weather station would be more valuable.

Plus, repeating a project is not insignificant, as a new environment is bound to introduce unknown challenges. For example, my dad doesn’t have a home WiFi network so I have to find another way to upload to the cloud.

Functionality: Computer Vision

Finally, one of my original ideas was to measure was cloud formation. Another was to build a bird or a bee detector and then automatically video them when they appear.

However, both computer vision use cases require more processing and memory than an Arduino can handle, so I need a Raspberry Pi instead. Given the current shortage, high scalper prices, and other learning/side-project opportunities elsewhere, I’m delaying that until later.

Did you enjoy this article? If yes, then please clap, comment and follow. Thanks for your support!

--

--

Thomas Lewandowski

Product Manager, Innovator, Entrepreneur. Need advice on your next project? Visit www.tl-consulting.org