The MagPi - July 2018

(Steven Felgate) #1

(^72) July 2018 raspberrypi.org/magpi
Feature BUILD A WEATHER STATION
TURN YOUR RASPBERRY
PI INTO A HEAT AND
HUMIDITY MACHINE
USING A BME280 SENSOR
The BME280 sensor is a digital sensor
that can measure temperature,
humidity, and atmospheric pressure.
It is available in a number of breakout
boards from popular manufacturers such
as Adafruit and SparkFun. This guide
assumes you have the Adafruit package
(magpi.cc/lFGBDk), but the instructions
should be applicable to most versions.
One thing to check is that the I^2 C
address is correct: for the Adafruit
models it is 0x77 (as shown in the
bme280_sensor.py code), but other
versions can have different addresses
(0x76 is a common alternative, as shown
in bme280_sensor_2.py).
Wire up your BME280
as shown in the table
below. The BME280 is
connected to the GPIO
pins on the Raspberry
Pi. Some other breakout
boards may have other
pins (such as SDO or
CSB), but those are not
generally needed
The anemometer triggers a
reed switch (with a magnet)
when it rotates with the wind.
This is used to trigger the
connected GPIO pin on the
Raspberry Pi
Pi GPIO BME280
17 (3V3) Vin
6 (GND) GND
3 (SDA) SDA (SDI)
5 (SCL) SCL (SCK)
The DS18B20 thermal
probe is stuck into the
soil in order to get an
extra temperature
measurement
A bucket gathers water until it
is full, then tips out the water
and triggers a GPIO pin on the
Raspberry Pi
Figure 1 How to
wire up the sensors
to the Raspberry Pi

Free download pdf