Group Abstract Group Abstract

Message Boards Message Boards

Checking the weather with the Wolfram Language + Raspberry Pi

GROUPS:
This post shows how to use a weather station module with the Wolfram Language on a Raspberry Pi.
To recreate this experiment you will need the following hardware (in addition to the Raspberry Pi itself):




First configure your Raspberry Pi for I2C interface support as described in the ReadMe.pdf from the manufacturer.
Next turn off your Raspberry Pi and connect the Weather Station board to the 26 pin interface. Turn your Pi back on and check that the device is detected:
 
 > sudo i2cdetect -y 1
      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 4e --
 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --


The Weather Station requires root privilege for access so the Wolfram Language or Mathematica needs to be started as root for this experiment.
In a terminal start the Wolfram Language using the following command (as root):
> sudo wolfram
Wolfram Language (Raspberry Pi Pilot Release)
Copyright 1988-2013 Wolfram Research
Information & help: wolfram.com/raspi
In[1]:=

First we open the device:
In[1]:= obj = DeviceOpen["RaspberryPiWeatherStation"]
Out[1]= DeviceObject[{RaspberryPiWeatherStation, 1}]

Next we can read the current temperature as measured by the board:
In[2]:= DeviceRead[obj, "Temperature"]
Out[2]= 25 degrees Celsius

Or the relative humidity:
In[3]:= DeviceRead[obj, "Humidity"]
Out[3]= 30 percent

And also the barometric pressure:
In[4]:= DeviceRead[obj, "Pressure"]
Out[4]= 993 hectopascals
POSTED BY: Arnoud Buzing
Answer
11 months ago