Adding a mini display to show METAR information to the METAR map

Recently I decided to add a new functionality to my METAR map to support a small display that shows the METAR information for the various airports on the chat.

I decided I wanted to keep it compact, so I bought this small 128 x 64 pixel display from Amazon to embed into my METAR Map. It’s about 2.5 x 1.5 mm (1 x 0.5 in) in size, so it takes up very little space.

Mini LED display using SSD1306 chip

This particular one has the text in Yellow for the top 16 pixels and then blue for the bottom 48, but there are also many others available that are just normal black and white. As long as they use the SSD1306 chip and are I2C, they should likely work just the same.

First thing is wiring them up, they use the SDA and SCL pins on the Raspberry Pi and a 5V and Ground pin. Below is a picture how I wired them up. You can refer to Raspberry Pi GPIO Pinout for a graphic of the pins.

Pin setup for the display

With the wiring done, I’ve set up the software functionality for the Raspberry Pi to be able to communicate with the display.

The detailed steps for that are on the Github page for the METAR map.

With the wiring and the software completed, I made a small cutout in my chart to embed the display, here’s the final picture:

Final display integrated in my METAR map

Like the Project? I always appreciate a cup of coffee/tea!

Some of the above links to Amazon may earn me a small commission to keep the site running.

42 thoughts on “Adding a mini display to show METAR information to the METAR map

  1. Anthony Varga

    Phil, a great add. What would I do to keep the display static on one airfield ? I would like to mount it by my home field and only report on that field.

    Reply
    1. Philip Rueker Post author

      Hey,

      In the metar.py file, instead of looping through the airports towards the bottom of the file (there’s a comment “Rotate through airports METAR on external display”)
      Remove the indented code under:
      if disp is not None:
      and replace it with this (replace “KPAE” for whatever airport you want to show it for, just make sure that airport is present in the airports file for the LEDs):
      displaymetar.outputMetar(disp, "KPAE", conditionDict.get("KPAE", None))

      Reply
      1. Lynol Amero

        Philip,
        I thought I saw some place where a separate file of airports was used for showing up on the mini display. It was a truncated list of the ‘airports’ file that is cycled through of only the important airports that you wanted to display the data. Will you point to the what code changes and files are required to add this functionality?

        Reply
        1. Philip Rueker Post author

          Hey,
          you just need to create a new file called “displayairport” and put it in the same folder.
          The code already looks for this file and if it’s there will use it automatically, if not it uses the normal list from the “airports” file.

          Reply
          1. Wallis McMath

            Philip,
            First, I want to say your code is fantastic and has been a fun project. Thanks for all the great documentation.
            I have everything working except having the external display only showing a list of airports from the “displayairport”. I added this file with three airports which are all listed in the “airports” file. The display show all airports, not just the three listed in “displayairport”

            I searched both metar.py and display metar.py and I do not see any reference to “displayairport”.

            I got both files from GitHub. Could I possibly have an old version without the update for using “displayairport”?

          2. Philip Rueker Post author

            The metar.py script looks for the file called displayairports (under "/home/pi/displayairports" in line 136). If that file is found, it will print a message “Using subset airports for LED display” or if it doesn’t find the file, it will print “Rotating through all airports on LED display”.
            Make sure the file is in the correct location, and that it doesn’t have any file extensions and is readable by the script (check for permissions).

  2. Anthony Varga

    Philip, I had left a comment about not being able to load one of the libraries (libjpeg-dev) needed for the display so if you see that please disregard as I resolved with a sudo apt-get update then it installed.

    Reply
  3. Kyle Lacey

    this is a great project I made one and then decided to make another with a friend. during his we ran into a couple problems during the led test they all light up for 2 second then they go out but the last 9 of the string of 50 stay lit. any ideas on why. I am ordering another light string to see if this one is faulty.

    Reply
    1. Philip Rueker Post author

      The most common explanation I’ve seen for unexpected behavior around LEDs not quite working is often related to power, so could be a too weak power supply being used, but yes it could also just be a faulty string of lights, so I guess you can see if it happens on the replacement too and if so, try to maybe use a different power supply.

      Reply
  4. K4DQP

    Philip, one question on wiring. Since I already have the PI ZERO wired up and operating the LEDs, do I just wire in the display to the same PI ZERO (according to your picture in the article)?

    Reply
    1. Philip Rueker Post author

      Hi, yes you wire it to the same PI Zero.
      The LED string and the display use different pins.

      Reply
  5. Lynol Amero

    Hi Philip,
    I’ve added the mini display to the project. I’ve found that when there are gusty winds, the LEDs blink (like they are supposed to), but the display also flashes another station back or forth from the current station being displayed to the next station. I can send a video of the issue if needed (please advise where to send it.)
    Thanks for the great project!

    Reply
    1. Justin Miner

      I’m having the same issue. It appears that when I give the execute permissions to the refresh.sh and lightsoff.sh files, that’s when this issue occurs. If I remove those permissions and run the script manually, everything works fine for the blink period in the metar.py script. Lynol, did you ever figure out what your issue was?

      Reply
    1. Paul

      Hi Lynol,
      For those of us without printers could we buy one from you?
      Also the light pipes could we buy from you?
      Happy to pay and shipping

      If not, which prusaprinter do we need to print ourselves?

      Reply
  6. Paul

    Hi Phil,

    Got the main map display working fine!

    Installed all software for the mini display.
    When I run the i2cdetect -y 1 it does run that script but doesn’t appear to detect anything.
    I’ve enabled in Interface Options etc.

    Do you think this is also a Power issue since I couldn’t seem to run the main map on the board alone (used external power supply)???

    If so, can I run a lead from the light back to the mini-display or do I need to run from the mini-display to the external power itself and tie in with the map lead???

    Can the external power supplies power the two devices ok?

    Reply
    1. Philip Rueker Post author

      Could be, you could also first try to unplug the LEDS to just get the display working and then re-plug the LEDS once you have the display working.

      But yes, you should probably be able to run the external display off the external power too, you’ll just have to splice the power wire into both the LEDS and the display.

      Reply
  7. Paul

    Hi Philip,

    Got everything running it seems.
    Two things:
    1) I’ve noticed since I hooked up the mini-display that in the morning, the mini display is off and maybe some of the lights. If I connect into the pi unit and do ./refresh.sh it seems to “reset” everything and it might continue fine until say the next morning. Any ideas? I have the mini-display set to every 5 seconds as you indicated in the directions.

    2) All works fine with the extra power adapter but it seems as though most people can run a 50 light strand on just the pi. Any idea what I might be missing? maybe how I’m wiring it up?

    Reply
    1. Philip Rueker Post author

      1) It should run fine continuously with using the refresh.sh script via the crontab.

      2) Not quite sure, as you mentioned it works fine for myself (I have about 30 LEDs) and others directly from the Pi, but sometimes these electronics are a bit finicky, so if it works okay with the external power supply for you, then that’s fine too.

      Reply
  8. Paul

    Hi Phil,
    Great project. The script seems to “time out” regularly. Not sure if it is related to the addition of the mini-display.
    In the morning, the mini-display is off and sometimes some of the lights and when I go into the VNC Viewer I see that there’s a message that reads “done”. If I hit enter I get the raspberrypi prompt and I can execute the ./refersh.sh command and it starts up fresh.

    https://ibb.co/TMcCCVM

    Any ideas?

    Reply
    1. Philip Rueker Post author

      Hey,

      The script runs for however long you set it, the default I have it running for is 5 minutes.
      After which it gets triggered again using the crontab so it gets the latest weather.

      So if you haven’t set up the crontab to trigger the script automatically, that’s why it stops running.

      Reply
      1. Paul

        I’m starting to learn more python-is there a line of code I could add somewhere to show last pull time at the top of each cycle?

        Reply
        1. Philip Rueker Post author

          The script will already print the last run time at the start “Running metar.py at” which prints the last date/time it ran, which is basically the last time it pulled the new data.

          Reply
  9. John C

    Hi Phillip,
    Is there any console status display via the metarmap application using the Pi console HDMI port (or SSH)… or say maybe something that shows the execution and/or updates as it cycles? My goal is to hook a monitor to it below the mount location that could display console application output or better yet a status page that could be displayed (and automatically updated as it cycles). Thoughts? Thanks for your time and input.

    Reply
    1. Philip Rueker Post author

      By default the script runs via cronjob in the background, so it doesn’t actually print anything to the console.

      You could change it so that the script will output the console log into a file and then display that file on a monitor with automatic scrolling.
      Beyond that you would need to create your own script additions to write the outputs to a script page.

      Reply
  10. Jeff Wingo

    I thought I would add a comment on what I did when creating mine. I downloaded the pdf of the sectional that I wanted to use. Actually it was two sectionals and I stitched them together in Photoshop and trimmed it down to the 16 x 20 proportionate area that I wanted to use. I saved the file out as a jpeg. I went up to the Richmond Camera website and uploaded the file to be printed on glossy paper and mounted to foam core at the lab. Once I got the print, I identified the locations for the METARS and one by one poked a push pin into the location on the front and marked the identifier on the back at the pin hole. Once I created all of the location points, I carefully used increasing size nails to enlarge the holes from the front of the print. then I used a Phillips head screwdriver and finally a Number 2 Pencil to make the holes the same size as the LEDs specified in the instructions. Then I went through the process of mapping out the course of my LEDs on the back of the print, numbering the order as I went, including any NULLs that had to be included between long runs. I ended up with 45 airports and 5 NULLs covering most of Virginia and parts of Maryland and West Virginia. I have a few pictures up at https://www.jwingo.com/metar/

    Reply
  11. Chris

    Thank you again for this awesome project. I’m trying to add the display and can’t seem to install the last two required libraries.
    sudo apt-get install libopenjp2-7 -y
    sudo apt-get install libtiff5 -y

    I get this:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following NEW packages will be installed:
    libopenjp2-7
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 138 kB of archives.
    After this operation, 381 kB of additional disk space will be used.
    Err:1 http://raspbian.raspberrypi.org/raspbian buster/main armhf libopenjp2-7 armhf 2.3.0-2+deb10u1
    404 Not Found [IP: 93.93.128.193 80]
    E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/o/openjpeg2/libopenjp2-7_2.3.0-2+deb10u1_armhf.deb 404 Not Found [IP: 93.93.128.193 80]
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

    I’ve looked online for answers and hate to bug you. Or perhaps someone else has fixed this problem. I’m just really not a coder. I’ve done:
    apt-get update
    –fix-missing
    apt-get upgrade
    Changed nameservers

    Help?

    Reply
  12. Chris

    So I figured I’d do a full install to get the latest and now two new packages won’t install.
    *`sudo apt-get install ttf-dejavu` (I assume just font dejavu)
    Gives me `E: Unable to locate package ttf-dejavu`
    *`sudo apt-get install liblcms1-dev -y`
    Package liblcms1-dev is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    None of my other fixes for apt-get worked. I hope to post a fix later.

    Reply
    1. Chris

      Picked up some larger displays but they have a 1309 chip and a lot more connections. Anyone who has done this code, please post in github

      Reply
    2. Sean T.

      Found a fix for the font issue when I had to re-build a corrupted SD card.

      Use ‘sudo apt-get install fonts-dejavu’ instead and it should work without issue.

      Good luck.

      Reply
  13. Dave M.

    Hey Philip,
    About to start my METAR Map build, I’ve had the components sitting in a box the last 2 years because, frankly, I’m a wire guy, and know nothing about code..

    My biggest question is, can I connect a photocell to the Raspberry Pi to dim the LEDs when the room is dark?

    Wish me luck!

    Thanks,
    Dave

    Reply
  14. troy

    I’m new to this and trying to follow the instructions for the coding instructions on the following page and it says “copy new file displaymetar.py into the same folder as metar.py” — how do I manually get and copy the displaymetar.py file and put it into the metar.py folder while I’m on the raspberry pi?

    Reply
    1. Sarah Rueker Post author

      If you are used to windows, then the easiest way is to connect to it using a file transfer tool like WinSCP where you can drag and drop the files over to the raspberry pi.

      Reply
  15. Julius G

    I am finally getting around to installing the package again after the failure due to the change in weather location. I downloaded all of the files from Github again. I am running into some roadblocks. The lights work when I manually test them. But nothing yet on the display and I get the following messages when manually running metar.py.

    Are you able to help?

    Thanks,

    pi@METARPi:~/METARMap $ python3 metar.py
    Can’t open /dev/mem: Permission denied
    Traceback (most recent call last):
    File “/home/pi/METARMap/metar.py”, line 257, in
    pixels.show()
    File “/usr/local/lib/python3.9/dist-packages/adafruit_pixelbuf.py”, line 204, in show
    return self._transmit(self._post_brightness_buffer)
    File “/usr/local/lib/python3.9/dist-packages/neopixel.py”, line 180, in _transmit
    neopixel_write(self.pin, buffer)
    File “/usr/local/lib/python3.9/dist-packages/neopixel_write.py”, line 42, in neopixel_write
    return _neopixel.neopixel_write(gpio, buf)
    File “/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/bcm283x/neopixel.py”, line 78, in neopixel_write
    raise RuntimeError(
    RuntimeError: NeoPixel support requires running with sudo, please try again!
    swig/python detected a memory leak of type ‘ws2811_t *’, no destructor found.

    Reply
    1. Julius G

      Sarah
      I installed the rpi_ws281x… icecream pytz again. I am down to the error below. I am using the airports file with new format and displayairports file. The led count has been set in know locations (50). Does this new format work. If so, what are the parameters for?
      “KEZF”: {
      “text”: 24,
      “display”: true,
      “visits”: 0
      },
      “KRMN”: {
      “text”: 25,
      “display”: false,
      “visits”: 3
      },

      pi@METARPi:~/METARMap $ sudo python3 metar.py
      Traceback (most recent call last):
      File “/home/pi/METARMap/metar.py”, line 267, in
      displaymetar.outputMetar1(disp, displayList[displayAirportCounter], conditionDict.get(displayList[displayAirportCounter][0], None))
      AttributeError: module ‘displaymetar’ has no attribute ‘outputMetar1’

      Thank you

      Julius

      Reply
  16. Mike

    Hello, I uploaded the most recent metar.py code, however, airports KC62, KMCX, and KPLD do not result in working LEDs. According to Aviationweather.gov, METAR data is presently available for these locations. Any suggestions? Thanks very much.

    Reply
  17. Mike

    Airport METAR data for KC62, KMCX, and KPLD made available by making a change to line 153 of metar.py file. Specifically “contraint” changed to “postfilter”.

    Thanks.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.