instructables
Build a Raspberry Pi SUPER Weather Station
by JeffreyLoucks
Let's face it, we humans talk about the weather a lot Approxim a t e t im e t o co m ple t e : 20 minutes
. The average person talks about the weather four
times a day, for an average of 8 minutes and 21 Approxim a t e f un f a ct o r: O the charts
seconds. Do the math and that totals 10 months of
your life that you will spend yapping about the In t his s t e p- by - s t e p t ut o ria l, y o u w ill:
weather. The weather ranks as the #1 go-to topic for learn how to use the Weatherstack API integration on
conversation starters and uncomfortable silence Initial State to get the local outside weather in your
breakers. If we are going to talk about it that much, area
we might as well take our weather street cred to a
whole new level. This super-fun and easy project will - Learn how to use a Raspberry Pi with a Sense HAT
leverage the Internet of Things (IoT) and a Raspberry (https://www.raspberrypi.org/products/sense-hat/) to
capture weather data inside your house
Build a Raspberry Pi SUPER Weather Station: Page 1
capture weather data inside your house
Pi to do just that.
- Build your own personal hyper-local weather
We are going to build our very own hyper-local dashboard that you can access from any web browser
weather IoT dashboard, capturing the weather inside on your laptop or mobile device
and outside our house over time. The next time
someone asks you "how about the weather lately?", - Give your meteorologist a run for their money
you will be able to whip out your phone and leave
them breathless with your mad weather analysis skillz Supplies:
.
What you will need to take the course:
W ha t y o u w ill ne e d t o t a ke t he co urs e :
1. Raspberry Pi w/ internet connectivity 1. Raspberry Pi w/ internet connectivity
2. Raspberry Pi SenseHAT 2. Raspberry Pi SenseHAT
3. A 6" 40-Pin IDE Male to Female Extension Cable 3. A 6" 40-Pin IDE Male to Female Extension Cable
(optional for temperature accuracy) (optional for temperature accuracy)
4. An Initial State account 4. An Initial State account
5. That's it! 5. That's it!
Pro je ct le v e l: B e g inne r
https://www.youtube.com/watch?v=n-Dx6FE0VnQ
Step 1: Getting Started
Build a Raspberry Pi SUPER Weather Station: Page 2
We’ve already put in a lot of the leg work for you Ty pe in t he co m m a nd be lo w int o y o ur
putting the code together, and organizing the t e rm ina l:
information. We’ll just need you to make a few
adjustments along the way. $ ls
To retrieve all of the things we’ve prepared for you, This command lists everything that’s available in the
you’ll need to clone the repository from GitHub. directory that you’re currently in. This list shows that
Github is an awesome service that allows us to store, our Github Repo has been successfully cloned into
revise and manage projects like this. To clone the our directory under the name “wunderground-
repository all we need to do is go into our Pi’s sensehat.” Let’s take a look at what’s in that directory.
terminal, or your computers terminal that’s SSH’d into To change directory’s, all you need to do is type “cd”
your pi and t y pe t his co m m a nd: and then type the name of the directory that you wish
to go to.
In this case, we’ll type:
$ git clone $ cd wunderground-sensehat
https://github.com/InitialState/wunderground-
sensehat.git Once we hit enter, you’ll see that we’re now in the
wunderground-sensehat directory. Let’s type ls again
Hit e nt e r a nd y o u’ ll s e e t his inf o rm a t io n: to see what les we’ve installed on our pi.
pi@raspberrypi ~ $ git clone README.md sensehat.py sensehat_wunderground.py
https://github.com/InitialState/wunderground- wunderground.py
sensehat.git
Here we see the we’ve got our readme document, and
Cloning into 'wunderground-sensehat'... a couple di erent python les. Let’s take a look at
sensehat.py. Instead of jumping into the le w/ the cd
remote: Counting objects: 28, done. command like we did for directory’s, we’re going to
use the nano command. The nano command allows us
remote: Total 28 (delta 0), reused 0 (delta 0), pack- to open up the nano text editor where we have all of
reused 28 our python code for each segment of this project. G o
a he a d a nd t y pe :
Unpacking objects: 100% (28/28), done.
$ nano sensehat.py
Checking connectivity... done.
Here you can see all of the code we’ve prepared for
Once you see this then congrats, you’ve successfully you for this project. We’re not going to make any
cloned the Github Repo and have all of the necessary changes to this document just yet, but feel free to
les to build your Super Weather Station. Before we scroll around and see what we’re going to be doing
move onto the next step, let’s take some time to later in this tutorial.
explore around this directory and learn a few basic
command line commands.
Step 2: Initial State
Build a Raspberry Pi SUPER Weather Station: Page 3
We want to stream all of our weather data to a cloud script.
service and have that service turn our data into a nice
dashboard that we can access from our laptop or S t e p 3 : Ma k e s o me A ut o ma g i c
mobile device. Our data needs a destination. We will After Step 2 you will see something similar to the
use Initial State as that destination. following output to the screen:
pi@raspberrypi ~ $ \curl -sSL
S t e p 1 : R e g i s t e r f o r a n In i t i a l S t a t e a c c o un t https://get.initialstate.com/python -o - | sudo bash
Go to https://www.initialstate.com/app#/register/ and
create a new account. Password: Beginning ISStreamer Python Easy
Installation!
S t e p 2 : In s t a l l t he I S S t r e a me r
This may take a couple minutes to install, grab some
Install the Initial State Python module onto your
co ee :)
Raspberry Pi: At a command prompt (don’t forget to
SSH into your Pi rst), run the following command:
But don't forget to come back, I'll have questions
later!
$ cd /home/pi/
Found easy_install: setuptools 1.1.6
$ \curl -sSL https://get.initialstate.com/python -o - |
sudo bash
Found pip: pip 1.5.6 from /Library/Python/2.7/site-
packages/pip-1.5.6- py2.7.egg (python 2.7)
Security Note: The above command has some important
anatomy that the user should be aware of.
pip major version: 1
1) There is a preceding \ before curl. This is important to
pip minor version: 5
ensure no alias of curl gets run if one was created. This
helps mitigate risk of the command doing more than
ISStreamer found, updating...
intended.
Requirement already up-to-date: ISStreamer in
2) The command is a piped command, so when running,
/Library/Python/2.7/site-packages Cleaning up...
you are piping the output of a script that is being retrieved
from https://get.initialstate.com/python into the
Do you want automagically get an example script?
command sudo bash. This is done to simplify installation,
[y/N]
however, it should be noted that https is important here
for helping ensure no man-in-the-middle manipulation of
(the output may be di erent and take longer if you have
the install script, especially since the script is being run
never installed the Initial State Python streaming module
with elevated privileges. This is a common way to simplify
before)
install and setup, but if you are a little more wary there are
some slightly less convenient alternatives: you can break
When prompted to automatically get an example
the command out into two steps and investigate the bash
script, t y pe y.
script being downloaded from the curl command yourself
to insure it's delity OR you can follow the pip instructions,
This will create a test script that we can run to ensure
you just wont get an automatically generated example
Build a Raspberry Pi SUPER Weather Station: Page 4
that we can stream data to Initial State from our Pi. You will want to step through the Waves tutorial to
You will be prompted: familiarize yourself with how to use this data
visualization tool. Next, view the data in Tiles to see
Where do you want to save the example? [default: this same data in dashboard form.
./is_example.py]:
You are now ready to start streaming real data from
You can either type a custom local path or hit enter to Wunderground and more.
accept the default. You will be prompted for your
username and password that you just created when
you registered your Initial State account. Enter both
and the installation will complete.
S t e p 4 : A c c e s s K e ys
Let’s take a look at the example script that was
created. Ty pe :
$ nano is_example.py
On line 15, you will see a line that starts with streamer
= Streamer(bucket_ .... This lines creates a new data
bucket named “Python Stream Example” and is
associated with your account. This association
happens because of the access_key=”...” parameter on
that same line. That long series of letters and numbers
is your Initial State account access key. If you go to
your Initial State account in your web browser, click
on your username in the top right, then go to “my
account”, you will nd that same access key at the
bottom of the page under “Streaming Access Keys”.
Every time you create a data stream, that access key
will direct that data stream to your account (so don’t
share your key with anyone).
S t e p 5 : R un t he Exa mp l e
Run the test script to make sure we can create a data
stream to your Initial State account.
Run t he f o llo w ing :
$ python is_example.py
St ep 6 : Pro t
Go back to your Initial State account in your web
browser. A new data bucket called “Python Stream
Example” should have shown up on the left in your
log shelf (you may have to refresh the page). Click on
this bucket and then click on the Waves icon to view
the test data.
Build a Raspberry Pi SUPER Weather Station: Page 5
Step 3: Sense HAT
Build a Raspberry Pi SUPER Weather Station: Page 6
The Sense HAT is an add-on board for the Raspberry Pi wunderground-sensehat directory and then nano
that is full of sensors, LEDs, and a tiny joystick. What is into your sensehat.py le by typing:
so great about this little add-on is that it is incredibly
easy to install and use thanks to a fantastic Python $ nano sensehat.py
library that you can quickly install. For this project, we
will use the temperature, humidity, and barometric Notice on the rst line that we are importing the
pressure sensors on the Sense HAT. Let's set it up. SenseHat library into the script. Before you run this
script, we need to setup our user parameters.
The rst step in using the Sense HAT is to physically
install it onto your Pi. With the Pi powered down, # --------- User Settings ---------
attached the HAT as shown in the image. CITY = "Nashville"
Power on your Pi. We need to install the Python library BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"
to make it easy to read the sensor values from the
Sense HAT. First, you will need to e ns ure t ha t BUCKET_KEY = "sensehat"
e v e ry t hing is up- t o - da t e o n y o ur v e rs io n o f
Ra s pbia n by t y ping : ACCESS_KEY = "Your_Access_Key"
$ sudo apt-get update SENSOR_LOCATION_NAME = "O ce"
Next, ins t a ll t he S e ns e HAT Py t ho n libra ry : MINUTES_BETWEEN_SENSEHAT_READS = 0.1
$ sudo apt-get install sense-hat # ---------------------------------
Re bo o t y o ur Pi. Speci cally, you need to set your ACCESS_KEY to your
Initial State account access key. Notice how easy it is to
We are ready to test the Sense HAT by reading sensor read data from the Sense HAT in a single line of
data from it and sending that data to Initial State. Python (e.g. sense.get_temperature()).
At a command prompt on your Pi, run the script:
Let's test our Sense HAT to make sure everything is
working. We will use the script located $ sudo python sensehat.py
athttps://github.com/InitialState/wunderground-
sensehat/blob/master/sensehat.py. You can copy this Go to your Initial State account and view the new data
script to a le on your Pi or access it from our Github bucket created by the Sense HAT.
repository that we cloned earlier. Change into your
Now, we are ready to put it all together and create our hyper-local weather dashboard!
Build a Raspberry Pi SUPER Weather Station: Page 7
Step 4: Hyper Local Weather Dashboard
The nal step in this project is simply combining our weather alerts, but I'll quickly list out how to get
Weather Data and our Sense HAT script into a single started below.
Dashboard. To do this, we will be using the Initial
State Integration with Weatherstack to add weather Us i n g T he W e a t he r s t a c k In t e g r a t i o n
data into our Sensehat dashboard we created in the 1. Log into your Initial State account
last step.
2. Click the details button on the Weatherstack box on
Using the Weatherstack API is super simple. In the the integrations page. This page will tell you all of the
past on this tutorial, we had you create and run a basic information about the integration and what’s
script to pull data from a weather data api, but since required to use it. In this case, you’ll just need a zip
the inception of this tutorial Initial State has a created code (or latitude & longitude) of a location that you’ll
the Data Integration Marketplace. The Data want to monitor the weather for, and you’ll have to
Integration Marketplace gives you the power to know what units you’ll want to see that data in
access and stream API's to an Initial State dashboard (metric, scienti c or US imperial).
with no code. It's literally just a few mouse clicks and
BAM: weather data. 3. Click the Begin Setup button and you’ll see a modal
On Medium, I've written a more in-depth tutorial on pop up from the right side of your screen. There are
how to use the Weatherstack integration and create just a few easy steps to take before we can start
Build a Raspberry Pi SUPER Weather Station: Page 8
watching that weather data roll in: a new bucket, we’ve set you up with a template to get
you started. However, you should make it your own!
4. Give your new dashboard a name. I named mine Press the down arrow in the top center of your
Nashville Weather.Pro tip: I like to use emoji’s in my dashboard to bring down the timeline, click Edit Tiles,
dashboards names to give them a little more oomph. move some tiles around, resize them and change the
A quick way to pull up emojis on a Mac is background. Make the dashboard the way you want it
Ctrl+Command+Space bar. For Windows hold the so that it’s easy for you to ingest the data you want to
Windows button and either the period (.) or semicolon collect. You can also use other Weatherstack
(;). 2 5.Type in your location. I use the Zip Code of the templates that we’ve created for you here. To add a
area I want to track, but you can also put Latitude and little more context to your dashboard, you can also
Longitude to be more speci c. It’s easy to nd the add a map that shows the location of where you’re
latitude and longitude of your area just by going to monitoring the weather. Your dashboard might look a
google maps, searching for a place and then copying little bare at rst, but give it some time and it will ll
the latitude & longitude out of the browser and up with beautiful historical weather data.
pasting it into the form. Only US, UK and Canada
locations can be used at this time.
6. Choose your units. I chose US/Imperial because I
lived in the United States.
7. Choose to create a new bucket or send your
Weatherstack data to an existing bucket.In this
tutorial, if you've already set up your Sense Hat to
stream to Initial State (in the last step) then just send
the Weatherstack data to that bucket.
8. Choose whether you want all the data that
Weatherstack sends or if you want just speci c
weather data to send to your dashboard. You can
always send all the data and take a few tiles out later.
9. Choose how often you want your dashboard to
update with weather conditions. You can choose
between every 15 minutes or hour by hour. Keep in
mind that sending data every 15 minutes costs an
extra token compared to sending it every hour. So, if
you’re wanting to use other integrations in the
marketplace at the same time then you may want to
just poll every hour. You can always stop sending data
from the integration and start it again, or change the
frequency at which you send data later. However, if
you do stop it and start again then there will be gaps
in your data.
10. Click Start Integration. Now you’re streaming data
from Weatherstack! Click the “View in the IoT App”
button to see the rst data points roll in.
11. Customize your dashboard. If you’re streaming to
Build a Raspberry Pi SUPER Weather Station: Page 9
Step 5: Add a Map to Your Dashboard (Bonus)
Build a Raspberry Pi SUPER Weather Station: Page 10
We can easily add a map tile to our dashboard https://groker.initialstate.com/api/events?
showing the location of our weather stream. You can accessKey=bqHk4F0Jj4j4M4CrhJxEWv6ck3nfZ79o&bu
learn more about the interactive map view in tiles cketKey=shwu1 Your URL will have your accessKey and
athttp://support.initialstate.com/knowledgebase/artic bucketKey. We need to add a stream name and value
les/800232-tiles-map-view. We could simply add a new to the URL parameters to complete the URL.
streamer.log statement in our Python script (and I'll
explain how you can do that at the end of this Add
section). Instead, we will take this opportunity to show "&MapLocation=YOUR_COORDINATES_FROM_STEP1"
you a di erent way to send data into your dashboard. to your URL
S t e p 1 : G e t Yo ur Lo c a t i o n ' s La t i t ud e / Lo n g i t ud e (ins e rt t he co o rdina t e s f ro m St e p 1, no
Coordinat es
s pa ce s a nd do n' t co py m ine !!)
You need to get the latitude/longitude coordinates of
your location. One way to do this is to go to Google
He re ' s w ha t m ine lo o ks like :
Maps, search for your location, and zoom in to your
https://groker.initialstate.com/api/events?
exact location. In the URL, you will see your
accessKey=bqHk4F0Jj4j4M4CrhJxEWv6ck3nfZ79o&bu
latitude/longitude coordinates. In the example above,
cketKey=shwu1&MapLocation=35.925298,-
my coordinates are 35.925298,-86.8679478.
86.8679478
Copy your coordinates (you will need them in step 2),
Paste your complete URL to the address bar of your
and make sure you don't accidentally copy any extra
browser and hit enter (or use the 'curl' command at a
characters from the URL.
command prompt) to send your map coordinates to
the stream, "MapLocation", in your new bucket.
S t e p 2 : B ui l d a U R L t o S e n d D a t a In t o Yo ur
D a s hb o a r d
Click on the "settings" link under the bucket name in If you look at your dashboard in Tiles now (you may
the bucket shelf. This will bring up the screen above. have to refresh if you get impatient), a new Tile
Copy the text in the API Endpoint section and paste it named MapLocation should have appeared zoomed
in your favorite text editor. We will use this to build a into your current location.
URL that we can use to send data into our existing
S t e p 2 A l t e r n a t i v e : Mo d i f y Yo ur S c r i p t
bucket and dashboard. In my bucket, the text that I
If you really do not like Step 2 above, you can simply
copied looks like:
add another streamer.log statement to your Python
script. Simply add the line sensehat_wunderground.py script (pay attention to
indentation b/c Python requires you to follow strict
streamer.log("MapLocation","YOUR_COORDINATES_FR indentation rules). For example, I added
OM_STEP1") streamer.log("MapLocation","35.925298,-86.8679478")
right after line 138.
somewhere inside the def main(): function of the
Build a Raspberry Pi SUPER Weather Station: Page 11
Step 6: Fixing the Sense Hat Temperature Reading
You may notice that your Sense HAT's temperature readings seem a bit high - that's because they are. The culprit is
the heat generated from the Pi’s CPU heating up the air around the Sense HAT when it is sitting on top of the Pi.
To make the temperature sensor useful, we need to either get the HAT away from the Pi (which would eliminate the
important bene t of being a compact solution) or try to calibrate the temperature sensor reading. The CPU is the
primary cause of the parasitic heat a ecting our temperature sensor, so we need to gure out the correlation. When
reviewing the Enviro pHAT for the Pi Zero we came up with an equation to account for the CPU temperature
a ecting a hat's temperature reading. We just need the CPU temperature and a scaling factor to calculate the
calibrated temperature:
temp_calibrated = temp - ((cpu_temp - temp)/FACTOR)
We can nd the factor by recording the actual temperature and solving for it. In order to nd the actual
temperature in the room, we need a di erent temperature sensor setup. Using a DHT22 sensor (setup instructions
here and script here), we can record and visualize both temperatures simultaneously:
The result reveals that the Sense HAT's reading is o by 5-6 degrees Fahrenheit pretty consistently. Adding the CPU
temperature into the mix (with this script), rst o shows that it is extremely hot, and second o reveals a sort of
wave that the Sense HAT measurement mimics.
After recording for about 24 hours, I solved for the factor using six di erent readings at six di erent points in time.
Averaging the factor values gave a nal factor value of 5.466. Applying the equation
temp_calibrated = temp - ((cpu_temp - temp)/5.466)
the calibrated temperature came to within one degree of the actual temperature reading:
You can run this calibration correction on the Pi itself, inside of the wunderground_sensehat.py script.
Build a Raspberry Pi SUPER Weather Station: Page 12
Step 7: Bonus: Configure Your Own Weather Alerts
Let's create a SMS alert whenever temperature drops below freezing.
We are going to follow the Trigger noti cation setup process outlined on the support page.
Make sure your weather data bucket is loaded.
Click on the bucket's settings in the data shelf (under its name).
Click on the Triggers tab.
Select the data stream to trigger on (you can use the drop-down list to select from existing streams once a data
bucket has loaded or you can type in the stream name/key manually; *note Safari does not support HTML5
dropdown lists). In my example screenshot above, I selected Temperature(F).
Select the conditional operator, in this case '<'.
Select the Trigger value that will trigger an action (manually type in the desired value). In this case, type in 32 as
shown above.
Click the '+' button to add the Trigger condition.
Build a Raspberry Pi SUPER Weather Station: Page 13
Select the action (current actions available are notify by SMS or email).
Click the '+' button to add the action. Input any veri cation code if adding a new phone number or email to
complete setup.
Your trigger is now live and will re when the condition is met. Click done to return to the main screen.
PIR SMS
Whenever temperature drops below 32, you will get a text message. You set alerts on anything in your weather data
bucket (*note that you need to use emoji tokens, not the actual emojis).
For example, whenever it is raining
:cloud: Weather Conditions = :umbrella:
Whenever it is windy
:dash: Wind Speed(MPH) > 20
etc.
Step 8:
He has only projects with Initial State ! ;-) Why ?
Maybe because they charge montly subscription fees?
1. Because Initial State is awesome! 2. Because I work there and put this piece of content up here
to show y'all how awesome it is. 3. Initial State does charge a monthly fee after a free trial, but is
completely free for students. Gotta pay the bills y'all.
I was hoping for a local weather station. I am finding the information obtained from third party local
stations is incorrect, or dated.
The link for DHT22 is broken
How do I make it report Celcius instead of F?
Also, how do I make it start feeding data across to DarkSky automatically after the Pi boots up?
Build a Raspberry Pi SUPER Weather Station: Page 14
Hey there! You can convert to celcius using the instructions here:
https://support.initialstate.com/hc/en-us/articles/360003171991-Unit-Conversion
I'm not sure how to make it start feeding data across DarkSky automatically after the pi boots up. I
can look into that for you.
I haven't built this yet but this is how you would do it. Adding to a file called "rc.local" which runs at
startup (You may have to put the full path to the script (/directory/sensehat_darksky.py):
sudo nano /etc/rc.local
Add this line to the bottom of the file:
sudo python sensehat_darksky.py &
Hit [ctrl]X to Exit
Yes to save the file
Nice project would be much better if it was more DIY instead of a purchased product
Yeah, this is somewhat disappointing. This isn't really an instrucatble more a "buy this kit".
Well, you can buy all of the stuff individually if it makes you feel better. I just thought it'd be easier
to use a kit that everything in it!
I have no complaints about buying the sense hat. I really object to this project using sites with trial
subscriptions etc. Just nonsense. Make it free and open, or nothing
The service is free if you're a student with a .edu account. It makes sense that you would have to
pay for the services because people work for those companies and they would like to buy sense
hats too.
It's a great article.
I recently hooked up pressure/temperature/humidity sensors to my Pi on a breadboard (adding the
sensors cost about $6) - I'm looking forward to using the info in your post to present it more neatly -
great instructable, thanks!
How did you go?
I really wanted to make this, but I want to pull data from my own sensor. I bought a BMP280, a
DHT11, MCP3008 (to take analog signals from anemometer, rain gauge, etc. to digital for RPI)... is
it possible to incorporate my own readings into the display instead of pulling from dark sky?
I also have a makerfocus camera kit for the RPI and was hoping to take snapshots of my yard at
intervals and store them for data logging. Is this not the right project for that?
I was all excited to build this, it looked so good and easy to install. Then I found initialstate was
going to cost $99/mth after a 2 week free trial!!
Hey George, Initial State just changed their pricing to be much cheaper for people doing these kind
of projects.
Thanks, I'll have another look into it.
From the Weather Underground website, this Pi project seems to have come to an irrecoverable
demise:
"Get access to the world's most accurate, precise and trusted weather data
Weather Underground as part of The Weather Company, an IBM business, now offers a series of
Data Packages that tap into the breadth and depth of weather data to provide current and forecast
Build a Raspberry Pi SUPER Weather Station: Page 15
conditions, seasonal and sub-seasonal forecasts, lifestyle indices, severe weather and historical
weather data.
With The Weather Company, you can take advantage of these packages quickly and easily,
accessing weather data APIs via the Cloud. The packages are curated to give you only what you
need in the format you need it. You can Incorporate weather data into your applications or combine
business data with weather data such as alerts and notifications, forecast data, and weather
imagery, then apply advanced analytics to build the foundation for informed enterprise decision-
making.
To improve our services and enhance our relationship with our users, we will no longer provide
free weather API keys as part of our program. If you have been directed to download our Weather
Underground free API key by a third party provider, please contact your vendor for resolution."
Hey there! I didn't see your comment before, sorry about that! The project has since been updated
to use the Dark Sky API... Which is free!
Since Weather Underground no longer provides free api, IT JUST DOESN"T WORK!
Yes, that is why the project has since been updated to use the Dark Sky API, which is free...
Thank you so much for this tutorial, it was very easy to follow. I have a question: How can I get the
Python script to auto-run the Initial State feed as soon as Raspian boots up?
Hello everyone! I am having trouble getting the sensehat data and the local weather data on the
same bucket! I know it is odd, but I still have two different sets of data. Is it working properly? Or do
I need to adjust some bucket setting in order for the both sets to be on the same page in intial
state? Thank you!
I keep getting an error saying "inconsistent use of tabs and spaces in indentation". I've tried
deleting, unifying the tab region, and taking all the tabs out. I still keep getting the error.
Hi, I was just doing this on an inset day and in the first step the ':' colon isn't needed, or at least
gave me a headache for sometime. Other then that it looks really good.
That was a typo! Sorry about that! Fixed now.
why is it not recognizing the first command?
pi@raspberrypi:~ $ git clone: https://github.com/InitialState/wunderground-sens...
git: 'clone:' is not a git command. See 'git --help'.
Did you mean this?
clone
edit: I removed the ":" and it worked...
Whoops! That was a typo. Fixed it. Thanks for letting me know!
Build a Raspberry Pi SUPER Weather Station: Page 16
Do I HAVE to use the sense hat? I don't have one, and don't want one. I just want to have the
dashboard on a TV screen.
Not particularly. You can just use the Wunderground API to get outside data if you're not
concerned with having inside data. You can even just run the script from your laptop if you don't
have a pi.
Although, you can connect nearly everything to an Initial State Dashboard. Here's a link to their
tutorials page where you can see a ton of projects to put on your TV screen:
www.initialstate.com/learn
This was the easiest Instructable to follow that I've ever done...thanks! Very well written,
comprehensive, and explanatory. And, for those who think you need to buy the kit, you don't. As
long as you have a Pi and SenseHAT, which I just happened to have, then you have everything
you need.
I will say that I'm struggling with how to incorporate the CPU temperature adjustment into the
wunderground_sensehat.py script. If anybody has an example of how that works, I'd appreciate it
very much!
Awesome Instructable!
Hey there! I added a step the other day that should help calibrate the temperature taking CPU
temp into consideration.
Hi Jeffrey - thanks for the response! Are you talking about Step 8? I read through that, but am not
sure how to modify the wunderground_sensehat.py script to take that all into account.
We originally intended to merge the scripts, but we went ahead and did it for you here. You can
replace your script with this one: https://github.com/initialstate/wunderground-
sensehat/blob/master/sensehat_wunderground_calibrated.py
Very cool! Thank you very much! I'll be giving this a run when I get home tonight. Thanks!
Interesting Article. Everything worked as expected, but the code you provided does not take into
account the Sense Hat temperature sensors picking up the temerature of the CPU causing the
temp reading to be incorrect. (Mine was about 15 -20 degrees to high.) In the attached images I put
the code that I used to compensate for this. I found this code on the AstroPI website in the
watchdog repository:
https://astro-pi.org/principia/winners/#watchdog
Thanks,
Bob M
Great article! I have a quick question, if you have time. I work at a
school in the middle east and we are using this to notify our nurses if
the temperature goes above 38C I want it to show a red flag icon if it
is and a white check if it isn't. I have the following code
redflagcheck=int(conditions['current_observation']['temp_c'])
if redflagcheck >=38:
redflag=True
else:
redflag=False
and then
Build a Raspberry Pi SUPER Weather Station: Page 17
if redflag == True:
streamer.log(":triangular_flag_on_post: " + "Red Flag", ":triangular_flag_on_post:")
else:
streamer.log(":white_check_mark: " + "Red Flag", ":white_check_mark:")
The
problem is when it changes value, it doesn't get rid of the old tile on
initial state and shows both. Is there a way to only show one icon or
the other? Thanks ahead of time for any help.
Bob
I think it's just because your stream name is different - it needs to be the same over both. So “Red
Flag” instead of “:flag: Red Flag” or “:check: Red Flag"
When I run the python command, the cursor goes to the next line, and stays there (locked up?). I
used Ctrl+C to break out and get this:
^CTraceback (most recent call last):
File "wunderground.py", line 191, in <module>
time.sleep(60*MINUTES_BETWEEN_READS)
and no new bucket at initialstate.com
I get the same thing. Did you resolve this?
The cursor stays there for me. It might just be indicating that the script is running. Let it sit for a
minute, and then check Initial State. If that doesn't work then let me know.
It's the same. I had the time update interval set to 0.5 as indicated in the instruction. I let it sit for
over 5 minutes. Other folks have gotten it to work so it must be something on my system possibly. I
used the Pi3 and PiB+.
Hmmm... Only thing I can think of off the top of my head is that there could be a typo in your
access key or somewhere else in that section. I always make sure copy and paste those things to
make sure something doesn't get lost in translation. Or, it could be something else.
I checked both the WU and InitialState access codes. But, I'll triple check again. But, thanks for
your input. If you think of anything else....much appreciated.
Ok. You were correct. I looked in my account and there was another 'key' there for some reason. I
used that second key and it worked. I'm still puzzled about the second key.
I forgot to mention....Great project.
Thanks for you input.
You can have multiple keys on Initial State, so you just have to make sure you're using the right
one! I do that all the time. Check out some of the other instructables I've posted using them! Lots o'
fun.
Build a Raspberry Pi SUPER Weather Station: Page 18