A Raspberry Pi 2 as a weather station in 18 steps

By equipping a Raspberry Pi 2 with sensors and placing it in a weatherproof housing, you can build a weather station for just a few bucks. In this article, we'll show you how to create, program, and process your own weather station.

01 Supplies

For our weather station, we need an AM2302 temperature and humidity sensor, as well as a BMP180 air pressure sensor. In addition, some m/f jumperwires and a breadboard. We connect the sensors via the breadboard to the GPIO pins of the Raspberry Pi 2, which reads the values ​​and uploads them to the Weather Underground weather service. For that internet connection we use a TP-LINK TL-WN823N WiFi adapter. We put the whole thing in a weatherproof housing, so that our personal weather station can be outside. All supplies are for sale at Kiwi Electronics.

02 Install Raspbian

We assume that in the basic course on the Raspberry Pi 2 you have installed the operating system Raspbian with the help of NOOBS. If you have installed another operating system with NOOBS, such as OpenELEC, you can easily roll it back. Plug your Raspberry Pi's power supply into a wall outlet and immediately hold down the Shift key to reopen the installer. If there is no operating system on your Pi's microSD card yet, install NOOBS and boot your Pi from it.

03 I2C kernel support

The BMP180 sensor uses the Inter-Integrated Circuit (I2C) protocol to communicate with the Pi. We need to enable support for that in the kernel first. Login to Raspbian with username pi and password raspberry and then run the command sudo raspi-config from. Navigate to Advanced options and press Enter, then do the same with I2C. When asked if you want to enable the I2C interface, go with the arrow key to Yes and press Enter. Confirm that you want to load the kernel module automatically. Then in the main menu of raspi-config press Finish and say you don't want to reboot the Pi just yet.

04 I2C testing

We need to get one more kernel module to load automatically. feed sudo nano /etc/modules and enter a line with i2c-dev up. Close the file and save it with Ctrl+X, key J and press Enter. Restart your Pi with sudo reboot. Then we test whether the I2C support works. First install some tools with sudo apt-get install i2c-tools. Then run the command sudo i2cdetect -y 1 to check which connected devices your Raspberry Pi recognizes on the I2C bus. For now, there aren't any, but it's a handy way to test if the I2C support works. The command must not display an error message.

Recent Posts

$config[zx-auto] not found$config[zx-overlay] not found