Tutorial: Hyper-local Weather Dashboard Using Wunderground + Pi Sense HAT

Updated 03/05/2016 with two new bonus sections – adding a map to your dashboard and adding weather alerts

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 ☀️.

Kit-Wunderground

What you’ll need to take this tutorial:

  1. Raspberry Pi™ 3 Model B Weather Monitor Kit
  2. 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 Wunderground’s API to get the local outside weather in your area
  • learn how to use a Raspberry Pi (http://www.raspberrypi.org) with a Sense HAT (https://www.raspberrypi.org/products/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
  • setup your own weather alerts
  • become a weather badass

This tutorial is part of the new series, “Learning How to Build Real IoT Applications” >>

Go to the Hyper-Local Weather Dashboard tutorial >>

23 comments On Tutorial: Hyper-local Weather Dashboard Using Wunderground + Pi Sense HAT

  • Help

    I get this error

    Traceback (most recent call last):
    File “sensehat_wunderground.py”, line 196, in
    main()
    File “sensehat_wunderground.py”, line 138, in main
    streamer.log(“:house: Location”,conditions[‘current_observation’][‘display_location’][‘full’])
    KeyError: ‘current_observation’

    no idea how to fix it

    • When that error occurs on line 138, that usually means get_conditions() function call on line 135 failed. Make sure the CITY and STATE on lines 11 and 12 are correct (no spaces in the city). Try the CITY and STATE in an API call in your web browser, “http://api.wunderground.com/api/YOUR_API_KEY/conditions/q/THE_DESIRED_STATE/THE_DESIRED_CITY.json”, and make sure you get a valid response returned. Same with the WUNDERGROUND_API_KEY on line 14. Also, make sure your device has an internet connection. If your device cannot establish a connection to wunderground, the script will error out there. Let me know if either of these things help.

  • Pingback: Did You Know? Embed Dashboards for Custom Branding | Initial State ()

  • This is a great example, and really easy to make it work, but i need to make few changes like temperatures (Celcius instead of Farenheit, cause I’m french) and I can’t get your pretty icon work on my dashboard, i only have a 2d shapped icons for cloud or sun, wind direction and moon phase.
    Any idea for this last point ?

    Thanks !!!

    • To change to Celcius, you can simply change the line (173 of sensehat_wunderground.py)
      “streamer.log(CITY + ” Temperature(F)”,conditions[‘current_observation’][‘temp_f’])”
      to
      “streamer.log(CITY + ” Temperature(C)”,conditions[‘current_observation’][‘temp_c’])”
      Same thing for dewpoint (change dewpoint_f to dewpoint_c).

      For your second question, what O/S and browser are you using? The icons used are simply emojis. The actual emoji graphic drawn is dependent on your O/S and browser that you are viewing your dashboard with. For Mac OS + Chrome/Safari/Firefox, the icons will look like the screenshots in the tutorial. For Android, they will look a little different. See http://support.initialstate.com/knowledgebase/articles/800910-tiles-emojis for more details.

  • What would it cost to have one of these built? MY wife is a weatherbug. This would make a great gift for her.

    • There is actually a complete kit that is going to be available in about 1 week from MCM Electronics for this specific project. It will have everything you need. Once that kit is available, I will email you and post a link here (and that will exactly answer your question about price).

  • Any update on the price?

  • We keep getting an error “streamer not defined”.

    • Sounds like the ISStreamer did not get installed. Go to a command prompt and type “pip list”. Do you see ISStreamer listed here? (e.g. ISStreamer (0.1.1))

  • Checking MCM, still nothing for that part number.. Any update?

  • Great tutorial and lots of fun to set up!
    Does anyone have any thoughts for correcting the temperature reading coming from the sensehat? Mine is reading much higher than room temperature, probably due to heat from the raspberry pi itself.
    Not sure if it’s possible to correct this, but any thoughts would be much appreciated.
    Thanks!

    • The heat from the Pi’s microprocessor is skewing the temperature up b/c of how close the HAT is to the Pi itself. You can buy a GPIO stacking header or two (like this one https://www.adafruit.com/products/1979) to create a buffer between the HAT and Pi to reduce the Pi’s effect on temperature to almost zero.

  • Pingback: Pi Weather Station | sh4z ()

Leave a reply:

Your email address will not be published.

Site Footer