Raspberry Pi Weather Station – Part 1

In this tutorial we are going to go in a little bit of a different direction – this will be a project tutorial, which when followed, will result in a working Raspberry Pi based Weather Station that streams data to the ThingSpeak Data service. We will break this down into four components: A board overview and assembly guide, collecting the data using python, sending the data to ThingSpeak, and finally a section looking at installation outdoors. The tutorial is focused on our Raspberry Pi Weather Board, designed and manufactured here at BC Robotics.

About the Board:

The Pi Weather Board was designed to make the often messy task of connecting a bunch of different sensors to the Pi as organized as possible without compromising on choice of sensors. The board also addresses the Pi’s inability to read analog inputs with a built in 4 channel 12-bit Analog to Digital Converter.

So what parameters does it measure? The board itself doesn’t have any sensors on it, so this is going to depend on which sensors you choose to go with. Following this tutorial with the suggested parts will result in a weather station monitoring Wind Speed, Wind Direction, Rainfall, Temperature, Air Pressure, and Humidity. Going forwards, additional sensors could be added without much trouble.

Step 1 – A Quick Overview of the assembly steps Most of the difficult tasks have already been taken care of by the Weather Board so assembly wont be too bad! We are going to start by soldering the stacking header to the Pi Weather HAT. Once that is completed, we will solder Adafruit BME280 breakout board, add the DS18B20 Temperature Sensor, and plug all of the sensors in.

Step 2 – Soldering the header First we need to solder the header that allows this board to plug into the Raspberry Pi. We recommend using this header, but any compatible Raspberry PI GPIO header will work. If you haven’t soldered before, or want a quick refresher course, have a look at this awesome comic: Soldering Is Easy! https://mightyohm.com/…/FullSolderComic_EN.pdf Start by Tacking two opposite corners of the connector in place and checking the connector alignment. We do this to ensure the connector is sitting correctly before soldering all 40 pins; once these have all been soldered, it is very difficult to adjust the alignment.

Step 3 – Soldering the header (continued) Once the connector is aligned to the board, and you are happy with the alignment, solder the remaining pins. It should look something like the attached photo when you are finished!

Step 4 – BME280 Part 1

The BME280 is an awesome little Temperature / Humidity / Pressure sensor and it works great with the Pi! Raspberry Pi 3:

If you are using the Raspberry Pi 3, simply attach as shown. There are no special instructions for this one! Raspberry Pi 3+:

If you are using the Raspberry Pi 3+ there are a few things to consider. The Pi3+ has an extra 4 pin header for Power over Ethernet (POE) capabilities. This connector will likely contact the pins on the bottom of the BME280 if it is installed in the normal position on the Weather Board. There are two ways this can be avoided: Remove the POE header (since it can be easily re-installed later) or install the BME280 in the alternate pin location as shown in the attached image. Once you have sorted out where it will be located, solder in the chunk of breakaway header to the Pi Weather Board. This breakaway header is normally included with the BME280.

Step 5 – BME280 Part 2 Flip the board back over, and place the Adafruit BME280 on the pins, matching the orientation to that of the board footprint. Tack one of the corners to set the board in place, and once you are happy with the position, solder the remaining pins.

Step 6 – DS18B20 Next we are going to install a screw terminal to connect the DS18B20 Temperature Sensor. The DS18B20 is weatherproof, so the probe will actually be mounted outside of the box, with the wires running into the board, so having them removable will make the installation into a box much easier going forwards. If you prefer, you could also solder the wires direct to board. We went with a screw terminal on this one, but any standard 3 pin 2.54mm pitch connector would work. Just like all the other connectors, tack one pin in place, check the alignment, and solder the remaining pins.

Step 7 – DS18B20 Continued The DS18B20 can ship with two different sets of wire colors – these are often seen with Red, Black and White or Red, Black, and Yellow. Normally Red will be power, Black will be Ground, and White / Yellow will be the Data pin. Be sure to check the pinout, we list it on our product page for the DS18B20. A 4.7K Ohm Resistor is normally needed to between the 5V and Data Pin when using the sensor; this is taken care of by the Raspberry Pi Weather Board – so no need to wire one in! Connect your DS18B20 according to the color code of your sensor.

Step 8 – Rain and Wind Speed The Wind Speed, and Rain Gauge are both basic digital sensors. The Anemometer (Wind Speed) is measured by counting how fast it spins in a given amount of time while the Rain Gauge measures how many times the gauge tips a precise amount of water over a given period of time. There is no soldering for these ones – they will just plug in along with Wind Direction. More information on the sensors and how they work can be found on their data sheet.

Step 9 – Wind Direction Wind Direction is a bit more difficult with the Pi – Wind Direction sensors are often analog, and this one is no exception. So why are the difficult? Well, the Raspberry Pi doesn’t have an Analog to Digital Converter. But no worry – the Weather Board also handles this problem. We have included a 4 Channel Analog to Digital Converter. All we have to do is plug it in!

Step 10 – Connecting the Wind & Rain Sensors Connecting these sensors is quite straight forward – if you look carefully, one of the two RJ11 plugs at the end of their cables has 4 wires in it, while the other has two. Plug the 4 wire line into the “Wind” plug on the Weather Board, plug the 2 wire line into the “Rain” plug.

Step 11 – Double Check Your Work! Before we power anything up, it is always a good idea to go through and make sure there are no issues with the work that has been done. Make sure all the solder joints are clean, with no un-intended bridging. Check to make sure all the sensors are plugged in correctly, add the two standoffs as shown, and connect the board to the Raspberry Pi. If using the Raspberry Pi 3+ be sure to check the POE header (located near the USB ports) is not contacting the header from the BME280 header between the Pi and the Pi Weather Board. In the next section of this tutorial we will be getting the Raspberry Pi set up with the Raspbian operating system, installing software libraries for each sensor, and writing some basic Python code to read the sensor outputs. Ready to tackle it? Head over to Part 2!