Build a Raspberry Pi SUPER Weather Station




Let's face it, we humans talk about the weather a lot ⛅️. The average person talks about the weather four times a day, for an average of 8 minutes and 21 seconds. Do the math and that totals 10 months of your life that you will spend yapping about the weather. The weather ranks as the #1 go-to topic for conversation starters and uncomfortable silence breakers. If we are going to talk about it that much, we might as well take our weather street cred to a whole new level. This super-fun and easy project will leverage the Internet of Things (IoT) and a Raspberry Pi to do just that.

We are going to build our very own hyper-local weather dashboard, capturing the weather inside and outside our house over time. The next time someone asks you "how about the weather lately?", you will be able to whip out your phone and leave them breathless with your mad weather analysis skillz ☀️.

What you will need to take the course:
1. Raspberry Pi w/ internet connectivity

2. Raspberry Pi SenseHAT

3. A 6" 40-Pin IDE Male to Female Extension Cable (optional for temperature accuracy)

4. An Initial State account

5. That's it!

Project level: Beginner

Approximate time to complete: 20 minutes

Approximate fun factor: Off the charts

In this step-by-step tutorial, you will:
learn how to use Dark Sky's API to get the local outside weather in your area

- Learn how to use a Raspberry Pi with a Sense HAT ( to capture weather data inside your house

- Build your own personal hyper-local weather dashboard that you can access from any web browser on your laptop or mobile device

- Give your meteorologist a run for their money

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Getting Started

We’ve already put in a lot of the leg work for you putting the code together, and organizing the information. We’ll just need you to make a few adjustments along the way.

To retrieve all of the things we’ve prepared for you, you’ll need to clone the repository from GitHub. Github is an awesome service that allows us to store, revise and manage projects like this. To clone the repository all we need to do is go into our Pi’s terminal, or your computers terminal that’s SSH’d into your pi and type this command:

$ git clone

Hit enter and you’ll see this information:

pi@raspberrypi ~ $ git clone

Cloning into 'wunderground-sensehat'...

remote: Counting objects: 28, done.

remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28

Unpacking objects: 100% (28/28), done.

Checking connectivity... done.

Once you see this then congrats, you’ve successfully cloned the Github Repo and have all of the necessary files to build your Super Weather Station. Before we move onto the next step, let’s take some time to explore around this directory and learn a few basic command line commands.

Type in the command below into your terminal:

$ ls

This command lists everything that’s available in the directory that you’re currently in. This list shows that our Github Repo has been successfully cloned into our directory under the name “wunderground-sensehat.” Let’s take a look at what’s in that directory. To change directory’s, all you need to do is type “cd” and then type the name of the directory that you wish to go to.

In this case, we’ll type:

$ cd wunderground-sensehat

Once we hit enter, you’ll see that we’re now in the wunderground-sensehat directory. Let’s type ls again to see what files we’ve installed on our pi.

Here we see the we’ve got our readme document, and a couple different python files. Let’s take a look at Instead of jumping into the file w/ the cd command like we did for directory’s, we’re going to use the nano command. The nano command allows us to open up the nano text editor where we have all of our python code for each segment of this project. Go ahead and type:

$ nano

Here you can see all of the code we’ve prepared for you for this project. We’re not going to make any changes to this document just yet, but feel free to scroll around and see what we’re going to be doing later in this tutorial.

Step 2: How to Use Dark Sky API

Dark Sky ( specializes in weather forecasting and visualization. The really cool aspect of Dark Sky is that they have an API that we can use to retrieve the weather data (pretty much) any where in the world.

Temperature, dew point, wind gust, humidity, precipitation, pressure, UV index, ... all easily available for wherever we want, whenever we want. Let's learn how to use Dark Sky's super-simple API.

In order to use the Dark Sky API, you first need your own API key. Getting an API key is quick and free. “Try for Free”.Register an account and click the link sent to you in a validation email to activate your accountSign inYou get 1,000 API calls per day with your free Dark Sky Developer account. There is no credit card required unless you want to upgrade to an account that will allow you more than 1,000 API calls per day.

Your secret Dark Sky API key will look something like this: 0123456789abcdef9876543210fedcba.

Save it.

You can make an API call to Dark Sky by typing in a URL into your browser in the following format:


for example, to get the weather in Boston, first get the latitude and longitude coordinates (for example from Google Maps):,-71.0589

Let's look at what is returned (you will have to place your Dark Sky API key in the above link):

      "summary":"Mostly Cloudy",
      "summary":"Mostly cloudy for the hour.",

You'll probably have more data than that, but instructables won't let me paste all of it without error. But look at all of that glorious weather data. We just need to make a script to parse it, then ship it to a web-based dashboard. First, let's setup the destination for our data -> Initial State.

Step 3: Initial State

We want to stream all of our weather data to a cloud service and have that service turn our data into a nice dashboard that we can access from our laptop or mobile device. Our data needs a destination. We will use Initial State as that destination.

Step 1: Register for an Initial State account

Go to and create a new account.

Step 2: Install the ISStreamer

Install the Initial State Python module onto your Raspberry Pi: At a command prompt (don’t forget to SSH into your Pi first), run the following command:

$ cd /home/pi/

$ \curl -sSL -o - | sudo bash

Security Note: The above command has some important anatomy that the user should be aware of.

1) There is a preceding \ before curl. This is important to ensure no alias of curl gets run if one was created. This helps mitigate risk of the command doing more than intended.

2) The command is a piped command, so when running, you are piping the output of a script that is being retrieved from into the command sudo bash. This is done to simplify installation, however, it should be noted that https is important here for helping ensure no man-in-the-middle manipulation of the install script, especially since the script is being run with elevated privileges. This is a common way to simplify install and setup, but if you are a little more wary there are some slightly less convenient alternatives: you can break the command out into two steps and investigate the bash script being downloaded from the curl command yourself to insure it's fidelity OR you can follow the pip instructions, you just wont get an automatically generated example script.

Step 3: Make some Automagic

After Step 2 you will see something similar to the following output to the screen:

pi@raspberrypi ~ $ \curl -sSL -o - | sudo bash

Password: Beginning ISStreamer Python Easy Installation!

This may take a couple minutes to install, grab some coffee :)

But don't forget to come back, I'll have questions later!

Found easy_install: setuptools 1.1.6

Found pip: pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6- py2.7.egg (python 2.7)

pip major version: 1

pip minor version: 5

ISStreamer found, updating...

Requirement already up-to-date: ISStreamer in /Library/Python/2.7/site-packages Cleaning up...

Do you want automagically get an example script? [y/N]

(the output may be different and take longer if you have never installed the Initial State Python streaming module before)

When prompted to automatically get an example script, type y.

This will create a test script that we can run to ensure that we can stream data to Initial State from our Pi. You will be prompted:

Where do you want to save the example? [default: ./]:

You can either type a custom local path or hit enter to 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.

Step 4: Access Keys

Let’s take a look at the example script that was created. Type:

$ nano

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 find 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).

Step 5: Run the Example

Run the test script to make sure we can create a data stream to your Initial State account.

Run the following:

$ python

Step 6: Profit

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.

You will want to step through the Waves tutorial to familiarize yourself with how to use this data visualization tool. Next, view the data in Tiles to see this same data in dashboard form.

You are now ready to start streaming real data from Wunderground and more.

Step 4: Dark Sky Dashboard

Now for the fun part. We are ready to start using the Dark Sky API to create a weather dashboard and capture the weather history for wherever we choose. To do this, we are going to use the Python script: This script simply calls the Dark Sky API using your API key and retrieves the weather information on a specified time interval. It also streams that data to your Initial State account, which will allow you to create a Dark Sky weather dashboard.

Dark Sky Dashboard

You can either copy this script to your Pi, or access it through the Github repository that we cloned earlier. You can do this by changing into your wunderground-sensehat directory by typing:

$ cd wunderground-sensehat 

From here, you'll be able to access the python file that we'll run to create our weather dashboard.

Before you run it, you need to set your desired parameters and insert your keys. Nano into the file by typing:

$ nano Then edit the section near the top of the script:

# --------- User Settings ---------
CITY = "Franklin"
GPS_COORDS = "35.9260096,-86.868537"
BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"
BUCKET_KEY = "ds1"
# --------------------------------- 

You need to set the desired GPS coordinates and city name. You also have to insert your Dark Sky API key and your Initial State account access key or your data isn't going to go anywhere. The MINUTES_BETWEEN_READS parameter will set how often your script will poll the Dark Sky API for weather information. 15 minutes provides a nice interval long-term. For the sake of short-term testing, you can set this to 0.5 minutes. The METRIC_UNITS option allows you to choose between Fahrenheit/Celsius, MPH/KPH, etc.

Once you have your parameters set, you are ready to run your script:

$ python 

If you are ssh'ing into your Pi and want to leave this script running uninterrupted for a long time, you can use the nohup command (no hang-up) as follows:

$ nohup python & 

This script is going to do a bit more than just read the weather data and send it to Initial State. This script is going to take advantage of the emoji support built into Initial State's tools to make the dashboard a bit more sexy. You can see the logic used to take the weather status from the currently -> icon and convert it to an emoji token in the weather_icon function. Something similar happens for the moon phase in the moon_icon function and wind direction in the wind_dir_icon function.

Go to your Initial State account and look at your data. The screenshot of the dashboard above was taken after 9 days of data collection running at 15 minute intervals. You can edit your dashboard by changing chart types with the cog icon in the top right corner of each tile and by right-clicking on a tile to resize/move it around.

The next step in this project is to start collecting weather data from our own sensors.

Step 5: Sense HAT

The Sense HAT is an add-on board for the Raspberry Pi that is full of sensors, LEDs, and a tiny joystick. What is so great about this little add-on is that it is incredibly easy to install and use thanks to a fantastic Python library that you can quickly install. For this project, we will use the temperature, humidity, and barometric pressure sensors on the Sense HAT. Let's set it up.

The first step in using the Sense HAT is to physically install it onto your Pi. With the Pi powered down, attached the HAT as shown in the image.

Power on your Pi. We need to install the Python library to make it easy to read the sensor values from the Sense HAT. First, you will need to ensure that everything is up-to-date on your version of Raspbian by typing:

$ sudo apt-get update

Next, install the Sense HAT Python library:

$ sudo apt-get install sense-hat

Reboot your Pi.

We are ready to test the Sense HAT by reading sensor data from it and sending that data to Initial State.

Let's test our Sense HAT to make sure everything is working. We will use the script located at You can copy this script to a file on your Pi or access it from our Github repository that we cloned earlier. Change into your wunderground-sensehat directory and then nano into your file by typing:

$ nano

Notice on the first line that we are importing the SenseHat library into the script. Before you run this script, we need to setup our user parameters.

# --------- User Settings ---------
CITY = "Nashville"

BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"

BUCKET_KEY = "sensehat"

ACCESS_KEY = "Your_Access_Key"



# ---------------------------------

Specifically, you need to set your ACCESS_KEY to your Initial State account access key. Notice how easy it is to read data from the Sense HAT in a single line of Python (e.g. sense.get_temperature()).
At a command prompt on your Pi, run the script:

$ sudo python

Go to your Initial State account and view the new data bucket created by the Sense HAT.

Now, we are ready to put it all together and create our hyper-local weather dashboard!

Step 6: Hyper Local Weather Dashboard

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 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 file by typing:

$ nano

Modify the user section near the top of the file:

# --------- User Settings ---------
CITY = "Franklin"
GPS_COORDS = "35.9260096,-86.868537"
BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"
BUCKET_KEY = "shds1"
# ---------------------------------
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 

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 &

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.

Check out a live hyper local weather dashboard at .

Step 7: Add a Map to Your Dashboard (Bonus)

We can easily add a map tile to our dashboard showing the location of our weather stream. You can learn more about the interactive map view in tiles at We could simply add a new streamer.log statement in our Python script (and I'll explain how you can do that at the end of this section). Instead, we will take this opportunity to show you a different way to send data into your dashboard.

Step 1: Get Your Location's Latitude/Longitude Coordinates

You need to get the latitude/longitude coordinates of your location. One way to do this is to go to Google Maps, search for your location, and zoom in to your exact location. In the URL, you will see your latitude/longitude coordinates. In the example above, my coordinates are 35.925298,-86.8679478.

Copy your coordinates (you will need them in step 2), and make sure you don't accidentally copy any extra characters from the URL.

Step 2: Build a URL to Send Data Into Your Dashboard

Click on the "settings" link under the bucket name in the bucket shelf. This will bring up the screen above. Copy the text in the API Endpoint section and paste it in your favorite text editor. We will use this to build a URL that we can use to send data into our existing bucket and dashboard. In my bucket, the text that I copied looks like: Your URL will have your accessKey and bucketKey. We need to add a stream name and value to the URL parameters to complete the URL.

Add "&MapLocation=YOUR_COORDINATES_FROM_STEP1" to your URL

(insert the coordinates from Step 1, no spaces and don't copy mine!!)

Here's what mine looks like:,-86.8679478

Paste your complete URL to the address bar of your browser and hit enter (or use the 'curl' command at a command prompt) to send your map coordinates to the stream, "MapLocation", in your new bucket.

If you look at your dashboard in Tiles now (you may have to refresh if you get impatient), a new Tile named MapLocation should have appeared zoomed into your current location.

Step 2 Alternative: Modify Your Script

If you really do not like Step 2 above, you can simply add another streamer.log statement to your Python script. Simply add the line


somewhere inside the def main(): function of the script (pay attention to indentation b/c Python requires you to follow strict indentation rules). For example, I added streamer.log("MapLocation","35.925298,-86.8679478") right after line 138.

Step 8: 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 benefit of being a compact solution) or try to calibrate the temperature sensor reading. The CPU is the primary cause of the parasitic heat affecting our temperature sensor, so we need to figure out the correlation. When reviewing the Enviro pHAT for the Pi Zero we came up with an equation to account for the CPU temperature affecting 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 find the factor by recording the actual temperature and solving for it. In order to find the actual temperature in the room, we need a different 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 off by 5-6 degrees Fahrenheit pretty consistently. Adding the CPU temperature into the mix (with this script), first off shows that it is extremely hot, and second off reveals a sort of wave that the Sense HAT measurement mimics.

After recording for about 24 hours, I solved for the factor using six different readings at six different points in time. Averaging the factor values gave a final 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 script.

Step 9: Bonus: Configure Your Own Weather Alerts

Let's create a SMS alert whenever temperature drops below freezing.

We are going to follow the Trigger notification 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.

Select the action (current actions available are notify by SMS or email).

Click the '+' button to add the action. Input any verification code if adding a new phone number or email to complete setup.

Your trigger is now live and will fire when the condition is met. Click done to return to the main screen.


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 


Internet of Things Contest 2016

Second Prize in the
Internet of Things Contest 2016

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

3 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

69 Discussions


20 days ago

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?

2 replies

Reply 1 day ago

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/

sudo nano /etc/rc.local

Add this line to the bottom of the file:
sudo python &

Hit [ctrl]X to Exit
Yes to save the file

3 years ago

Nice project would be much better if it was more DIY instead of a purchased product

5 replies

Reply 3 years ago

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!


Reply 20 days ago

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


Reply 16 days ago

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.


3 years ago

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!

1 reply

Question 4 months ago on Step 8

hello everyone, is there any way to use the rgb leds on the sense hat? for example that displays the temperature based on the recordings. i'm not a python programmer, could you give me an hand?


5 months ago

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?


1 year ago

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!!

2 replies

Reply 7 months ago

Hey George, Initial State just changed their pricing to be much cheaper for people doing these kind of projects.


1 year ago

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 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."

1 reply

Reply 7 months ago

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!


7 months ago

Since Weather Underground no longer provides free api, IT JUST DOESN"T WORK!

1 reply

Reply 7 months ago

Yes, that is why the project has since been updated to use the Dark Sky API, which is free...