Raspberry Pi weather map covers Scotland


Nice. We know from the site stats that Scottish stories are popular, as are Raspberry Pi stories. All this needs is a magnet angle and it would be the Mother lode!

The Gadget Master in question is Sebastian Raubach, and you can find the code, init files, licence and readme files on GitHub.

Where is he getting his weather data from? The answer is openweathermap.org with a button letting you switch between the weather properties displayed.


Hardware

The Pi involved is a Raspberry Pi 3b+. Sebastian notes that other Pis could be used but the Pi Zero was not powerful enough, resulting in a lot of flickering on the display.

Talking of which, he uses an Adafruit RGB Matrix Bonnet for Raspberry Pi together with an LED matrix panel 32×64 4mm pitch.

There’s also the 5V 4A power supply and a non-latching squid button.

Weather software

For the script to work, he explains, it works as follows (I quote, from GitHub):

  • For each pixel, determine its latitude and longitude. This is done by dividing the horizontal and vertical axes into sections and using the center point for each cell.
  • For each pixel, determine whether it’s inside the shape/polygon that should be displayed. This may be a country or any other region. Store the lookup in a file for faster loading times.
  • On regular intervals, get weather data for the grid.
    To reduce the number of API calls, run an initial call for each 25 square degree (limitation of the API) square inside the area of interest. This will return all cities in that area.
  • For each pixel, determine the closest city. If the distance is below a threshold, use that city’s data. Otherwise, send an individual API request for the specific location.
  • Display the weather information on the grid using the color gradient and a normalization step to map the value to the corresponding color.

Openweather

To get the map setup, as well as getting an API key from Openweather, a shapefile defines the boundaries of your area of interest. Scotland-shaped in this case.

Examples are available online, flags Sebastian, and apparently he has already created an equivalent weather map for Germany.

Excellent, whatever the weather may be.

As one of the twitter commenters says, it reminds you of Ceefax!





Source link

We will be happy to hear your thoughts

Hinterlasse einen Kommentar

Enable registration in settings - general
Compare items
  • Total (0)
Compare
0