Weather station

Ever since I was a child, I have been fascinated by the variability of the local and global weather. It thrilled me even more that humans are able to forecast the weather for the upcoming days. For these reasons, I became interested in atmospheric science, which finally resulted in my Ph.D. As with every other meteorologist, I want to be able to perform my own atmospheric measurements. Therefore, I will describe in this article a very simple weather station that is able to measure temperature, relative humidity and pressure with a temporal resolution of 10 s. Additionally, it uses a camera to take a picture of the sky every minute. Because I developed this weather station for my wind protected balcony, I decided that measurements of wind speed and wind direction are not necessary. Nevertheless, a rain gauge would be a nice accessory for the future.

Selfmade weather station mounted on the balcony.

What do you need?



  • Cover for BME280 sensor module
  • Waterproofed case for electronic parts
  • Pole to mount cover and waterproofed case
  • Extension cord for outdoor use (I picked 10 m)
  • Shrinkable tubing, cable ties


Connecting the electronics

To connect the BME280 sensor module to the Raspberry Pi Zero, you only need four jumper cables. Connect Vin at the BME280 sensor to Pin 1 (3V) and GND to Pin 6 (GND) on the Raspberry Pi Zero. The sensor uses the I2C connection on the Raspberry Pi Zero, which means that you need to connect SDA to Pin 3 and SCL to Pin 5. The benefit of using the I2C connection is that you can use several sensors connected in a row. The picture on the lower left shows a circuit diagram of the connection between the BME280 sensor module and the Raspberry Pi Zero. The other picture shows the Camera, Raspberry Pi Zero and BME280 sensor module next to each other.
Connecting the camera to the CSI port of the Raspberry Pi is very simple. Just keep in mind that you need a smaller ribbon cable than usual because the Raspberry Pi Zero has a smaller port.

The connection between the BME280 sensor module and the Raspberry Pi Zero.
Camera module, Raspberry Pi Zero and BME280 sensor module.


Run the python code

Before you mount everything together, testing the BME280 sensor module might be a good idea. You can find the python code that I used for the Raspberry Pi here. Before you run it on your Raspberry Pi, you need to adjust the folder where you would like to save the recorded data. You do that in line 5. Below this line, you will mainly find the code to read the data from the BME280 sensor module. I got this section from GitHub. At the end of the python code (from line 160 on), you will find the part where the program saves the data. They are stored in daily .csv files with a temporal resolution of 10 seconds.
If you attached a camera to the Raspberry Pi as well, then you need to uncomment line 201 to 204. When you do this, make sure that your power supply is strong enough to keep the power constant. I had some problems with the BME280 sensor module when the camera took a picture. My guess is that my power supply couldn’t handle both the camera and BME280 at the same time. If everything works fine, then your code should give you an output like in the picture below. To keep the code running even if you are logged out, use the command:

nohup python &

That’s it. I hope your sensor works well and shows you the actual temperature, relative humidity, and pressure.

Terminal output when running the python code.

Putting everything together

If you followed the instruction above properly, then you have the electronics working already and you only need to mount everything in a nice case. The picture on the lower right shows you how I fit the cables of the BME280 sensor module through the bottom of the case.

Case (TFA Dostmann Schutzhülle) of the BME280 sensor module in comparison to the Raspberry Pi Zero.
BME280 sensor module connected to the Raspberry Pi Zero. The white circular plate is the bottom of the protection case (see left picture).












I don’t recommend putting the BME280 sensor module together with the Raspberry Pi Zero in the case. I tried it and realized that the Raspberry Pi Zero produces too much heat and distorts the measurements. For this reason, I put the Raspberry Pi Zero together with the power supply and the wireless LAN adapter into the waterproof case. The picture below shows you how easy it is to fit everything inside.
If you would like to add a camera to your weather station, then you need to put it in a housing as well. I used a little plastic box and filled it with some foam to keep the camera module in position. Because the plastic box didn’t seem transparent enough, I drilled a hole into it for the camera objective. To keep the camera module still protected, a very thin layer of transparent plastic is placed above the hole. This plastic layer and the edges of the plastic box are sealed with some hot glue.
When the housings are done, you only need to mount everything onto a pole. To do that you can use some screws or just use a few cable ties.


Raspberry Pi Zero together with power supply and wireless LAN adapter inside the weatherproof case.
Left: Plastic case with a hole for the camera objective. Right: Raspberry Pi camera module on a piece of foam
Finished housing for the camera. Note, the camera objective is covered with a very thin layer of transparent plastic to avoid
moisture inside the housing.












Done! Now you have your own little weather station ready to be mounted on your balcony or somewhere else in your garden. The easiest way to present your measurements is by uploading some plots of your recorded data to a website. This task can be done by the Raspberry Pi itself. You will find an example of such plots on my website.

Thanks for reading!