Close
0%
0%

Weather Radar!

NWS radar images & weather data, in an old analog meter case!

Public Chat
Similar projects worth following
Merging National Weather Service radar images, Stamen Toner maps, and OpenWeather data, the Weather Radar! is a Raspberry Pi and Blinka powered weather radar viewer… housed in a funky analog meter case I found in the shed.

Overview:

When those summer storms or winter blizzards come rolling in, it can be handy to look at a weather radar to determine their direction and possible intensity. Not wanting to have another open tab on my web browser, I made the Weather Radar as a permeant retro radar viewer for my desk!

Connected to Wifi, the Radar downloads NWS radar images, overlays them on a map, and plays looping animations of the 1-hour precipitation layer. With OpenWeather data, the Radar also shows current weather conditions and the forecast for the next few days. 

A toggle switch and 5-way navigation switch allow switching between modes/pages, while a potentiometer acts as a zoom knob for the map. 

Background

The NWS has a new radar webpage that uses HTML5, an interactive map, and Open Geospatial Consortium (OGC) compliant layers. These layers are especially handy because they can provide us with radar images for a particular area via a simple URL request (using Web Map Service WMS or Web Feature Service WFS protocols).

The NWS helpfully provides a page of the OGC compliant layers they offer, including alerts, warnings, and layers for the 200+ weather radar stations).

Methodology:

For a given latitude and longitude in the USA, the Radar:

  • Obtains the nearest radar station ID (using the Weather API service)
  • Uses the radar station ID (e.g. KJAX) to obtain metadata and times for previous radar layers (e.g. XML GetCapabilities document for the 1 hour precipitation layer for the radar station in Jacksonville).
  • Generates a tiled base map using the GeoTiler library (using a given zoom level, map size, and map centre).
  • Uses all of this information to make a WMS request and download the last 5 - 10 radar images. 
  • For each time frame, combines the base map, radar image, and other layers and annotations using the Pillow imaging library.
  • Displays the combined image for each time frame, to make a looping animation.
  • Uses the latitude and longitude to get OpenWeather data for some extra forecasting jazz.
A) Base map is generated using starting latitude longitude coordinates (example is Seattle with a black and white Stamen Toner map).
B) Radar image is added on top with slight transparency. Also a marker for our starting lat long position.
C) Now combined with labels, annotation, and weather data. A circle overlay is added to make it blend better with the analogue meter case.

Code:

The Weather Radar! is written in Python with Blinka support!

I'm slowly adding example code over on the Weather Radar! github page, and making things more efficient! 

Hardware:

Schematic here!

The Weather Radar! uses a Raspberry Pi Zero W with a 2.4" Adafruit PiTFT HAT. The Pi runs in headless mode, with the HAT as a SPI screen using Blinka and the RGB Display library

An Adafruit PCF8591 gives the Pi ADC support to read the analog voltage from a potentiometer mounted on front, while a toggle switch and a 5 way navigation switch connect to the Pi's GPIO pins.

For an extra bit of jazz, I've also added a Omzlo PiWatcher TB to help monitor the pi and provide the Weather Radar with an on/off switch.

Case:

The case is from an old analog meter I found discarded in my shed 5 years ago. I'm not entirely sure what it measured, because the battery and electronics had mostly crumbled away into toxic dust. The case and screws were still perfect though, and after a thorough clean and a bit of patching with some wood filler, I gave it a nice coat of sky blue paint (… because you know… weather).

A look at the front of the analog case before painting and after clearing away all of crumbling electronics from inside it. Gouges in the front show where one of the original and rusted potentiometers refused to leave.

Inside, the Pi and PiTFT HAT attach to the remnants of the meter gauge housing using a mount I designed and 3D printed. A cheap magnifying lens enlarges the screen a little and gives it a retro...

Read more »

Portable Network Graphics (PNG) - 171.05 kB - 05/05/2021 at 02:31

Preview
Download

View all 6 components

  • Improvements!

    Thornhill!02/13/2021 at 03:34 0 comments

    I've slowly been making improvements over the past few weeks!

    Code

    The code is becoming more refined with every new problem I find (including when my local NWS radar station was down for 5 days for repairs). 

    • The navigation switch is more response, the zoom potentiometer is more zoomy, and things are failing more gracefully than before.

    • There's now example code! For those that would like to see how I'm obtaining and displaying NWS radar images, there's now example code on the project's GitHub page. Currently it doesn't show the button handling or the OpenWeather/NWS forecast stuff, but as soon as I can stop myself from testing out new features, I'll debug everything and add those elements too!

    • In addition to OpenWeather data, I'm now using NWS forecast data to provide a longer, text-based forecast for every forecast period. This is mostly handy for getting nuance from the forecast that OpenWeather doesn't provide (especially snow and ice accumulations!).

      • Depending on the mood of the servers, this can sometimes be temperamental to get. I'm having a lot of fun with Try, Except, and Else statements.

      • The forecast URLs can be easily obtained from the latitude/longitude point file that gets read when the Weather Radar gets the local radar station based on the target latitude and longitude. 
    Examples of the UI for the weather forecast pages.
    Left: Forecast page showing current conditions and conditions for the next few hours at the top. Underneath a short summary for the weather tomorrow. Right: A detailed text-based forecast from NWS that takes up the full screen, with a background colour that's determined by the average temperature for that forecast period (here it's dark blue to indicate a cold night).

    Hardware

    • I'm now using the Omzlo PiWatcher TB to monitor the Raspberry Pi and give me an external on/off button on the rear of the case.

    • Along with the on/off button, I made a cover and put an external micro USB connector on the rear (instead of the hole I had before). This makes everything a lot neater and allows me to easily disconnect the USB cable.

    • I 3D printed a black bezel for the hole for the navigation switch.

    • Inside, there's now a mount for the PCF8591 and the PiWatcher.

    • Because the Weather Radar spends most if it's time on my desk (looking very pretty and spitting out errors I hadn't considered), I've been propping it up to give it a slight angle. Instead of using whatever random thing I had on my desk, I designed and printed a leg to do this for me. 
      Rear of the Weather Radar!
      Rear of the Weather Radar, showing the 3D printed cover that adds an external on/off button and a micro USB connector.
    Looking at the new leg for the Weather Radar.
    The Weather Radar has exactly one leg to stand on and it's this one. Working in the same way as a keyboard leg, this black 3D printed part tilts the Weather Radar at a 20 degree angle, which is perfect for viewing when on my desk. The leg can also fold up to lay flat.

    Also in this picture, the black bezel for the navigation switch!

    Future stuff!

    Mostly a to do list for me:

    • Refine and tidy up more of the code… and release it on Github!
    • Clean up some aspects of the UI. 
    • Incorporate more data! 
      • I've been taking a look at the NWS graphical forecasts and thinking how I can include those images into the Weather Radar too!
      • I'd like to add 511 traffic data for parts of a monthly commute where current road conditions help me to plan which route I'd like to take. Fortunately this looks like it'll be relatively easy to obtain from my state's Department of Transportation!
      • Threading! It would be super handy to download new radar images while also displaying the previous images too. 

View project log

Enjoy this project?

Share

Discussions

Øystein wrote 02/22/2021 at 10:13 point

Very well done! Thank you for taking the time to write an engaging text.

  Are you sure? yes | no

Thornhill! wrote 02/23/2021 at 23:01 point

Thank you :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates