{"id":24922861,"url":"https://github.com/liddiard/weather-subway-board","last_synced_at":"2025-04-09T19:15:53.048Z","repository":{"id":44725650,"uuid":"512959982","full_name":"liddiard/weather-subway-board","owner":"liddiard","description":"🌦 🚇 Display current weather, hourly forecast, and NYC subway train departures on an LED matrix.","archived":false,"fork":false,"pushed_at":"2025-03-02T19:58:51.000Z","size":17125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T19:15:46.828Z","etag":null,"topics":["forecast","led-matrix","nyc","public-transport","raspberry-pi","subway","trains","weather"],"latest_commit_sha":null,"homepage":"https://harrisonliddiard.com/project/weather-subway-board/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liddiard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-12T01:32:36.000Z","updated_at":"2025-03-02T19:58:55.000Z","dependencies_parsed_at":"2023-12-25T22:37:11.033Z","dependency_job_id":"16811440-3c7d-4a75-9ee4-e1e9b7c3adab","html_url":"https://github.com/liddiard/weather-subway-board","commit_stats":{"total_commits":270,"total_committers":3,"mean_commits":90.0,"dds":"0.44074074074074077","last_synced_commit":"de1e324f2ea3dbe7e4c9fbead94fc9b112a1a60e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liddiard%2Fweather-subway-board","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liddiard%2Fweather-subway-board/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liddiard%2Fweather-subway-board/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liddiard%2Fweather-subway-board/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liddiard","download_url":"https://codeload.github.com/liddiard/weather-subway-board/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248094987,"owners_count":21046770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forecast","led-matrix","nyc","public-transport","raspberry-pi","subway","trains","weather"],"created_at":"2025-02-02T11:33:56.756Z","updated_at":"2025-04-09T19:15:53.030Z","avatar_url":"https://github.com/liddiard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Current weather, forecast, and NYC subway train visualization board\n\nDisplay information you may want to know when leaving the house on a fancy fridge magnet, a.k.a. an LED matrix. Powered by [weather.gov](https://www.weather.gov/documentation/services-web-api) and [MTA realtime data](https://api.mta.info/#/landing) APIs.\n\n![LED matrix board mounted on a refrigerator door](graphics/readme/board_photo.jpg)\n\nWondering what everything on this display means? [Jump down to the explanation](#explanation-of-board-layout)!\n\n## Hardware\n\n### Components used\n\n- [Raspberry Pi Zero W](https://www.raspberrypi.com/products/raspberry-pi-zero-w/)\n- [64x32 LED matrix, 5mm pitch](https://smile.amazon.com/gp/product/B07SDMWX9R/) – can get cheaper from Aliexpress, but longer shipping time\n- [Adafruit RGB Matrix Bonnet](https://www.adafruit.com/product/3211)\n- [Power supply, 5V 8A](https://smile.amazon.com/dp/B078RZBL8X/)\n- [Mounting tape](https://smile.amazon.com/gp/product/B00347A8GC/) – (optional) attach Pi to matrix\n- [Cable concealer](https://smile.amazon.com/gp/product/B07D8WVJWF/) – (optional) for power supply cord\n\n### Build process\n\nThe hardware build is pretty straightforward and mostly involves plugging things in to the right places, unless you want to add an on/off button to the matrix. For Pis without a header, you will need to solder one on. Consider a Raspberry Pi Zero W (or the Zero 2 W) for a smaller form factor. The software commands will take a while to start up vs. newer/faster models, but once they get going I haven't faced any issues.\n\nI followed [this tutorial](https://howchoo.com/pi/raspberry-pi-led-matrix-panel) and watched the associated [YouTube video](https://www.youtube.com/watch?v=EPZawKPC73k) for most of the guidance I needed. (The video displays something different in software, but the hardware setup is the same.)\n\nI did make the mod described in the [Adafruit RGB Matrix Bonnet documentation](http://https://cdn-learn.adafruit.com/downloads/pdf/adafruit-rgb-matrix-bonnet-for-raspberry-pi.pdf) under Step 6 to eliminate matrix flicker: soldering a short wire to the bonnet between pins GPIO4 and GPIO18. After making this hardware mod, you need to disable sound on the Pi by following [these steps](https://github.com/hzeller/rpi-rgb-led-matrix#bad-interaction-with-sound). I didn't bother digging into why this was only an issue with the hardware mod; it doesn't really matter because this project does not involve audio.\n\n## Software installation\n\nTested running:\n\n- macOS on Apple Silicon (with web-based viewer for development)\n- Raspberry Pi OS Lite on ARMv6, running on a Raspberry Pi Zero W (with LED matrix connection)\n\n1. `npm install`\n2. (on Pi only) `./scripts/build_rpi-rgb-led-matrix.sh`\n\nNote: Package `node-canvas` is kept at version 2.x because version 3.x fails to build on ARMv6.\n\n## Running\n\n### Generate board image\n\n```shell\nnpm start\n```\n\nYou can also `npm run dev` with your API key prepended for an auto-reloading server.\n\n### Display board on LED matrix (Pi only)\n\n```shell\nnpm run display\n```\n\n### Web-based board viewer (for development)\n\n```shell\nnpm run web-viewer\n```\n\nView the board at http://localhost:8000/viewer.html\n\n## Explanation of board layout\n\nClick image to enlarge.\n\n[![Explanation of LED matrix board layout](graphics/readme/board_explanation.png)](https://github.com/liddiard/nyc-subway-board/blob/main/graphics/readme/board_explanation.png?raw=true)\n\nMatrix images like this can be displayed with the web-based board viewer mentioned above.\n\nThe board only shows trains going in one direction because most of the time I only go downtown from my stop. Not needing to show both directions freed up more space for the weather/forecast visualization.\n\nThere are earlier branches of this repo that only display subway departures without weather information:\n\n- [`subway-only`](https://github.com/liddiard/nyc-subway-board/tree/subway-only): Cycles through upcoming train departures in large green letters in one direction only, plus a departure timeline like the one on the right of this branch's board.\n- [`no-timeline`](https://github.com/liddiard/nyc-subway-board/tree/no-timeline): Similar to the above, but displays departures in both directions and includes an uptown/downtown arrow. The tradeoff with this branch, as the name implies, is that there was no room for the departure timeline.\n\n## Project structure\n\n### [`src/`](src/)\n\n- [`index.js`](index.js): Main entry point for Node.js app that calls the MTA and weather.gov APIs, generates a board image using the JavaScript `canvas` API, and writes it to disk. It runs in an infinite loop and updates every 30 seconds.\n- [`fetch/`](src/fetch/): Calling APIs and enriching/transforming responses to the desired formats\n- [`display/`](src/display/): All the display logic for what to draw where\n  - `board.png`: Image of the board to display. Generated the by Node.js app and not in version control. View it on the web viewer or the LED matrix as detailed above under [Running](#Running).\n- [constants.js](src/constants.js): Constants. `STATION_ID` is the subway station from which the departures are shown.\n\n---\n\n[`image-viewer.py`](image-viewer.py): Script that recurringly reads the board image file from disk and displays it on the LED matrix using the [Python bindings](https://github.com/hzeller/rpi-rgb-led-matrix/tree/master/bindings/python) of [rpi-rgb-led-matrix](https://github.com/hzeller/rpi-rgb-led-matrix). Used Python rather than the faster C++ library because it was more developer friendly (to me) and because the display refresh rate doesn't need to be fast since it only shows a new frame every 30 seconds.\n\n[`graphics/`](graphics/): Sprite images used on the board, positioned and composited by the Node.js app\n\n[`scripts/`](scripts/) One-time bash scripts used for dependency installation:\n\n- `install_canvas_dependencies.sh` automatically runs before `npm install` to install the required `canvas` package dependencies. `npm install` will fail without doing this first.\n- `build_rpi-rgb-led-matrix.sh` builds the binaries for `rpi-rgb-led-matrix` on Linux OSs with `apt-get` only. This library displays the board image file on the LED matrix.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliddiard%2Fweather-subway-board","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliddiard%2Fweather-subway-board","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliddiard%2Fweather-subway-board/lists"}