Skip to content

Part 3. Hyper Local Weather Dashboard

jrbail01 edited this page Jan 15, 2019 · 13 revisions

IMAGE ALT TEXT HERE

The final step in this project is simply combining our Dark Sky script and our Sense HAT script into a single Python script. We will be using https://github.com/InitialState/wunderground-sensehat/blob/master/sensehat_darksky.py for this last step. Copy this file to your Pi or access it via the Github repository that we cloned earlier in this tutorial. Change into your wunderground-sensehat directory, and then nano into the sensehat_darksky.py file by typing:

$ nano sensehat_darksky.py

Modify the user section near the top of the file:

# --------- User Settings ---------
CITY = "Franklin"
GPS_COORDS = "35.9260096,-86.868537"
SENSOR_LOCATION_NAME = "Office"
DARKSKY_API_KEY = "PLACE YOUR DARK SKY API KEY HERE"
BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"
BUCKET_KEY = "shds1"
ACCESS_KEY = "PLACE YOUR INITIAL STATE ACCESS KEY HERE"
MINUTES_BETWEEN_READS = 15
METRIC_UNITS = False
# ---------------------------------

Make sure you put your Dark Sky API key, Initial State account access key, and desired GPS Coordinates / city name in this section. Specify the name of the location that your Sense HAT will be collecting environmental data in the SENSOR_LOCATION_NAME variable.

Run the script on your Pi:

$ sudo python sensehat_darksky.py

If you are ssh'ing into your Pi and want this script to run uninterrupted for a long time, run the script using the nohup (no hang-up) command:

$ nohup sudo python sensehat_darksky.py &

After a couple of days, it is interesting to compare the temperature changes in your room versus the temperature changes outside. Same with humidity. If you want to add more sensors to the same dashboard, simply send the data to the same BUCKET_KEY specified in the User Settings (along with the same ACCESS_KEY). These additional sensors can be on any device and located anywhere and still send data to the same bucket. For example, you could have 10 different temperature sensors connected to 10 different types of single-board computers (Pi, Arduino, BeagleBone, Edison) and have them all streaming data into your one hyper-local weather dashboard.

Dark Sky Dashboard

If you want to use the dashboard layout above as your dashboard, you can import this layout into your data bucket by following the instructions at https://init.st/gp9dt8h .

The public share URL for this dashboard is https://go.init.st/0hw08py .

<< Part 2: A Sense HAT Dashboard - Part 3: Sense HAT Temperature Correction >>