An emulated LED scoreboard for Major League Baseball ⚾

Overview

mlb-led-scoreboard-emulated

An LED scoreboard for Major League Baseball. Displays a live scoreboard for your team's game on that day.

Be sure to check out the original repo, mlb-led-scoreboard, if you'd like to run this on a Rasperry Pi LED panel!

Currently supported boards:

  • 32x32
  • 64x32
  • 64x64
  • 128x32
  • 128x64

If you'd like to see support for another set of board dimensions, file an issue!

Table of Contents

Screenshots

screenshot

Installation

Requirements

You need Git for cloning this repo and PIP for installing the scoreboard software.

sudo apt-get update
sudo apt-get install git python-pip

Installing the scoreboard software

# Windows
./install.sh

# Mac/Linux
sh ./install.sh

It will also install the following python libraries that are required for certain parts of the scoreboard to function.

  • pytz, tzlocal: Timezone libraries. These allow the scoreboard to convert times to your local timezone
  • feedparser: Used to fetch and parse RSS feeds. The scoreboard uses this to show news headlines.
  • pyowm: OpenWeatherMap API interactions. We use this to get the local weather for display on the offday screen. For more information on how to finish setting up the weather, visit the weather section of this README.
  • mlbgame: The main library that fetches and parses all of the actual MLB data being displayed.
  • RGBMatrixEmulator, a drop-in replacement for rpi-rgb-led-matrix which is normally used to drive LED displays on Raspberry Pi.

Updating

  • Re-run the install file. Run the above install command again. Any additional dependencies that were added with the update will be installed this way. If you are moving to a new major release version, answer "Y" to have it make you a new config file.
  • Check your custom layout/color files if you made any. There's a good chance some new keys were added to the layout and color files. These changes should just merge right in with the customized .json file you have but you might want to look at the new .json.example files and see if there's anything new you want to customize.

That should be it! Your latest version should now be working with whatever new fangled features were just added.

Usage

python main.py

See the Flags section below for more flags you can optionally provide.

Configuration

There are two config files associated with the scoreboard.

The first (config.json) controls the scoreboard option. A default config.json.example file is included for reference. Copy this file to config.json and modify the values as needed.

"preferred":                           Options for team and division preference
  "teams"                      Array   Pass an array of preferred teams. The first team in the list will be used as your 'favorite' team. Example: ["Cubs", "Brewers"]
  "divisions"                  Array   Pass an array of preferred divisions that will be rotated through in the order they are entered. Example: ["NL Central", "AL Central"]

"news_ticker":                         Options for displaying a nice clock/weather/news ticker screen
  "always_display"             Bool    Display the news ticker screen at all times (supercedes the standings setting)
  "team_offday"                Bool    Display the news ticker when your prefered team is on an offday
  "preferred_teams"            Bool    Include headlines from your list of preferred teams. Will only use the first 3 teams listed in your preferred teams
  "traderumors"                Bool    Include headlines from mlbtraderumors.com for your list of preferred teams. Will only use the first 3 teams listed in your preferred teams
  "mlb_news"                   Bool    Include MLB's frontpage news
  "countdowns"                 Bool    Include various countdowns in the ticker.
  "date"                       Bool    Display today's date to start the ticker. This will always be enabled if no other ticker options are.
  "date_format"                String  Display the date with a given format. You can check all of the date formatting options at [strftime.org](strftime.org)

"standings":                           Options for displaying standings for a division
  "always_display"             Bool    Display standings for the provided preferred_divisions.
  "mlb_offday"                 Bool    Display standings for the provided preferred_divisions when there are no games on the current day.
  "team_offday"                Bool    Display standings for the provided preferred_divisions when the preferred_teams is not playing on the current day.

"rotation":                            Options for rotation through the day's games
  "enabled"                    Bool    Rotate through each game of the day every 15 seconds.
  "scroll_until_finished"      Bool    If scrolling text takes longer than the rotation rate, wait to rotate until scrolling is done.
  "only_preferred"             Bool    Only rotate through games in your preferred_teams list.
  "rates"                      Dict    Dictionary of Floats. Each type of screen can use a different rotation rate. Valid types: "live", "pregame", "final".
                               Float   A Float can be used to set all screen types to the same rotate rate.

  "while_preferred_team_live":         Options for rotating while your chosen preferred_teams is live
    "enabled"                  Bool    Rotation is enabled while your configured preferred_teams game is live.
    "during_inning_breaks"     Bool    Rotation is enabled while your configured preferred_teams game is live during an inning break.

"weather":                             Options for retrieving the weather
  "apikey"                     String  An API key is requires to use the weather service. You can get one for free at [Open Weather Map](https://home.openweathermap.org/users/sign_up).
  "zipcode"                    String  The zipcode/postcode for the location you wish to receive weather data
  "country"                    String  The ISO 3166 country code associated with the zipcode
  "metric_units"               Bool    Set true for celsius and meters/s. Set false for fahrenheit and miles per hour.

"time_format"                  String  Sets the preferred hour format for displaying time. Accepted values are "12h" or "24h" depending on which you prefer.
"end_of_day"                   String  A 24-hour time you wish to consider the end of the previous day before starting to display the current day's games. Uses local time from your pi.
"full_team_names"              Bool    If true and on a 64-wide board, displays the full team name on the scoreboard instead of their abbreviation. This config option is ignored on 32-wide boards. Defaults to true when on a 64-wide board.
"scrolling_speed"              Integer Supports an integer between 0 and 4. Sets how fast the scrolling text scrolls.
"debug"                        Bool    Game and other debug data is written to your console.
"demo_date"                    String  A date in the format YYYY-MM-DD from which to pull data to demonstrate the scoreboard. A value of `false` will disable demo mode.

You may also configure the emulator options via emulator_config.json (an example file is included as reference).

"pixel_size"                   Integer The size of the LED pixel in screen pixels (default: 10)
"pixel_style"                  String  The style of the LED pixel, can be either "square" or "circle" (default: "circle")

Flags

You can configure your LED matrix with the same flags used in the rpi-rgb-led-matrix library. More information on these arguments can be found in the library documentation.

--led-rows                Display rows. 16 for 16x32, 32 for 32x32. (Default: 32)
--led-cols                Panel columns. Typically 32 or 64. (Default: 32)
--led-chain               Daisy-chained boards. (Default: 1)
--led-parallel            For Plus-models or RPi2: parallel chains. 1..3. (Default: 1)
--led-pwm-bits            Bits used for PWM. Range 1..11. (Default: 11)
--led-brightness          Sets brightness level. Range: 1..100. (Default: 100)
--led-gpio-mapping        Hardware Mapping: regular, adafruit-hat, adafruit-hat-pwm
--led-scan-mode           Progressive or interlaced scan. 0 = Progressive, 1 = Interlaced. (Default: 1)
--led-pwm-lsb-nanosecond  Base time-unit for the on-time in the lowest significant bit in nanoseconds. (Default: 130)
--led-show-refresh        Shows the current refresh rate of the LED panel.
--led-slowdown-gpio       Slow down writing to GPIO. Range: 0..4. (Default: 1)
--led-no-hardware-pulse   Don't use hardware pin-pulse generation.
--led-rgb-sequence        Switch if your matrix has led colors swapped. (Default: RGB)
--led-pixel-mapper        Apply pixel mappers. e.g Rotate:90, U-mapper
--led-row-addr-type       0 = default; 1 = AB-addressed panels. (Default: 0)
--led-multiplexing        Multiplexing type: 0 = direct; 1 = strip; 2 = checker; 3 = spiral; 4 = Z-strip; 5 = ZnMirrorZStripe; 6 = coreman; 7 = Kaler2Scan; 8 = ZStripeUneven. (Default: 0)

Personalization

If you're feeling adventurous (and we highly encourage it!), the sections below outline how you can truly personalize your scoreboard and make it your own!

Custom Board Layout

You have the ability to customize the way things are placed on the board (maybe you would prefer to see scrolling text for a pregame a bit higher or lower). See the ledcoords/ directory for more information.

Custom Colors

You have the ability to customize the colors of everything on the board. See the ledcolors/ directory for more information.

Weather

This scoreboard will use a weather API to gather weather information at various times. This information is displayed on your teams offdays for your area and also displayed during each game's pregame information. The weather API we use is from OpenWeatherMaps. OpenWeatherMaps API requires an API key to fetch this data so you will need to take a quick minute to sign up for an account and copy your own API key into your config.json.

You can find the signup page for OpenWeatherMaps at https://home.openweathermap.org/users/sign_up. Once logged in, you'll find an API keys tab where you'll find a default key was already created for you. You can copy this key and paste it into the conig.json under "weather", "apikey".

You can change the location used by entering your city, state, and country code separated by commas. If you wish to use metric measurments, set the "metric" option to true.

Sources

This project relies on two libraries: MLBGame is the Python library used for retrieving live game data. RGBMatrixEmulator, a drop-in replacement for rpi-rgb-led-matrix which is normally used to drive LED displays on Raspberry Pi.

Accuracy Disclaimer

The scoreboard is dependent on MLB having their data correct and up to date. If you see any weird data such as wrong pitches or scores or whatever else, MLB is drunk.

Help and Contributing

If you run into any issues and have steps to reproduce, open an issue. If you have a feature request, open an issue. If you want to contribute a small to medium sized change, open a pull request. If you want to contribute a new feature, open an issue first before opening a PR.

Latest Features

The scoreboard follows semantic versioning, for what makes sense for a project like this (it has no consumable API or anything like that). The master branch is always kept clean and never updated except for releases. If you want to contribute, make sure your pull request is pointed to dev.

Licensing

This fork is released under the original author's license:

This project as of v1.1.0 uses the GNU Public License. If you intend to sell these, the code must remain open source.

https://github.com/MLB-LED-Scoreboard/mlb-led-scoreboard#licensing

You might also like...
league-connection is a python package to communicate to riot client and league client

league-connection is a python package to communicate to riot client and league client.

Discord bot built using Python. through this you can get information about the upcoming matches, scoreboard, live score
Discord bot built using Python. through this you can get information about the upcoming matches, scoreboard, live score

IPL-bot This is a Discord bot built using Python. through this you can get information about the upcoming matches, scoreboard, live score, and many mo

Enabling dynamic analysis of Legacy Embedded Systems in full emulated environment

PENecro This project is based on "Enabling dynamic analysis of Legacy Embedded Systems in full emulated environment", published on hardwear.io USA 202

⚾🤖⚾ Automatic baseball pitching overlay in realtime
⚾🤖⚾ Automatic baseball pitching overlay in realtime

⚾ Automatically overlaying pitch motion and trajectory with machine learning! This project takes your baseball pitching clips and automatically genera

We have a dataset of user performances. The project is to develop a machine learning model that will predict the salaries of baseball players.
We have a dataset of user performances. The project is to develop a machine learning model that will predict the salaries of baseball players.

Salary-Prediction-with-Machine-Learning 1. Business Problem Can a machine learning project be implemented to estimate the salaries of baseball players

Can a machine learning project be implemented to estimate the salaries of baseball players whose salary information and career statistics for 1986 are shared?

END TO END MACHINE LEARNING PROJECT ON HITTERS DATASET Can a machine learning project be implemented to estimate the salaries of baseball players whos

The repo for mlbtradetrees.com. Analyze any trade in baseball history!
The repo for mlbtradetrees.com. Analyze any trade in baseball history!

The repo for mlbtradetrees.com. Analyze any trade in baseball history!

Baseball Discord bot that can post up-to-date scores, lineups, and home runs.
Baseball Discord bot that can post up-to-date scores, lineups, and home runs.

Sunny Day Discord Bot Baseball Discord bot that can post up-to-date scores, lineups, and home runs. Uses webscraping techniques to scrape baseball dat

Predicting Baseball Metric Clusters: Clustering Application in Python Using scikit-learn
Predicting Baseball Metric Clusters: Clustering Application in Python Using scikit-learn

Clustering Clustering Application in Python Using scikit-learn This repository contains the prediction of baseball metric clusters using MLB Statcast

CLI utility to search and download torrents from major torrent sites
CLI utility to search and download torrents from major torrent sites

CLI Torrent Downloader About CLI Torrent Downloader provides convenient and quick way to search torrent magnet links (and to run associated torrent cl

A website for courses of Major Computer Science, NKU

A website for courses of Major Computer Science, NKU

Retrieve annotated intron sequences and classify them as minor (U12-type) or major (U2-type)
Retrieve annotated intron sequences and classify them as minor (U12-type) or major (U2-type)

(intron I nterrogator and C lassifier) intronIC is a program that can be used to classify intron sequences as minor (U12-type) or major (U2-type), usi

Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.
Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files.

WindowsBuildFromISO Extract the windows major and minor build numbers from an ISO file, and automatically sort the iso files. Features Parse multiple

Set of scripts & tools for converting between numbers and major system encoded words.
Set of scripts & tools for converting between numbers and major system encoded words.

major-system-converter Set of scripts & tools for converting between numbers and major system encoded words. Uses phonetics instead of letters to conv

The Official Twilio SendGrid Led, Community Driven Python API Library
The Official Twilio SendGrid Led, Community Driven Python API Library

The default branch name for this repository has been changed to main as of 07/27/2020. This library allows you to quickly and easily use the SendGrid

My 500 LED xmas tree

xmastree2020 This repository contains the code used for Matt's Christmas tree, as featured in "I wired my tree with 500 LED lights and calculated thei

LedFx is a network based LED effect controller with support for advanced real-time audio effects
LedFx is a network based LED effect controller with support for advanced real-time audio effects

Welcome to LedFx ✨ -Making music come alive! LedFx website: https://ledfx.app/ What is LedFx? What LedFx offers is the ability to take audio input, an

Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

Comments
  • Many unhandled exceptions after running main.py

    Many unhandled exceptions after running main.py

    I plugged in Athletics as my team, and AL West as the division, add my OMW API key and changed the city for weather, and left everything else the same in the config JSON file. Not sure if I did something wrong or not.

    The entire thing errors out with this:

    C:\Users\Yoshi24517\mlb-led-scoreboard-emulated>main.py
    pygame 1.9.6
    Hello from the pygame community. https://www.pygame.org/contribute.html
    INFO (20:55:38): MLB LED Scoreboard Emulated - v1.0.0 (32x32)
    C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\site-packages\bdfparser\bdfparser.py:347
    bdfparser warning: The glyph count next to 'CHARS' keyword is 203, which does not match the actual glyph count 204
    ERROR (08:55:38): Value Error while refreshing live game status of Athletics. 5 retries remaining.
    Traceback (most recent call last):
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\site-packages\mlbgame\data.py", line 70, in get_raw_box_score
        'rawboxscore.xml'))
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 531, in open
        response = meth(req, response)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 569, in error
        return self._call_chain(*args)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
        result = func(*args)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 404: Not Found
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 233, in __game_index_for
        team_index = next((i for i in team_idxs if Status.is_live(mlbgame.overview(self.games[i].game_id))), team_idxs[0])
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 233, in <genexpr>
        team_index = next((i for i in team_idxs if Status.is_live(mlbgame.overview(self.games[i].game_id))), team_idxs[0])
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\site-packages\mlbgame\__init__.py", line 198, in overview
        return mlbgame.game.Overview(mlbgame.game.overview(game_id))
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\site-packages\mlbgame\game.py", line 325, in overview
        raw_box_score = mlbgame.data.get_raw_box_score(game_id)
      File "C:\Users\Yoshi24517\AppData\Local\Programs\Python\Python37\lib\site-packages\mlbgame\data.py", line 72, in get_raw_box_score
        raise ValueError('Could not find a game with that id.')
    ValueError: Could not find a game with that id.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\main.py", line 34, in <module>
        data = Data(config)
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 45, in __init__
        self.current_game_index = self.game_index_for_preferred_team()
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 219, in game_index_for_preferred_team
        return self.__game_index_for(self.config.preferred_teams[0])
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 245, in __game_index_for
        debug.error("ValueError: Failed to refresh overview for {}".format(self.current_game().game_id))
      File "C:\Users\Yoshi24517\mlb-led-scoreboard-emulated\data\data.py", line 200, in current_game
        return self.games[self.current_game_index]
    AttributeError: 'Data' object has no attribute 'current_game_index'
    
    opened by Yoshi24517 1
Owner
Tyler Porter
Rails Developer | Raspberry Pi Enthusiast | Human Person
Tyler Porter
LedFx is a network based LED effect controller with support for advanced real-time audio effects

Welcome to LedFx ✨ -Making music come alive! LedFx website: https://ledfx.app/ What is LedFx? What LedFx offers is the ability to take audio input, an

null 786 Jan 2, 2023
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

The example shows using local self-hosted runners on-premises by making use of a runner on a Raspberry Pi with LED's attached to it

Martin Woodward 6 Nov 13, 2021
LED effects plugin for klipper

This plugin allows Klipper to run effects and animations on addressable LEDs, such as Neopixels, WS2812 or SK6812.

Julian Schill 238 Jan 4, 2023
Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;)

TMorse Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;) Compatible with python3.9+. No third-party library is required

Mahyar 2 Jul 11, 2022
A simple program to make MSI Modern 15 speaker and microphone mute led work.

MSI Modern 15 sound led fixup for linux A simple program to fix the MSI Modern 15 speaker and microphone mute LEDs. Installation Requirements pulsectl

Seyed Danial Movahed 4 Oct 18, 2022
SPI driven CircuitPython driver for PCA9745B constant current LED driver.

Introduction THIS IS VERY MUCH ALPHA AND IN ACTIVE DEVELOPMENT. THINGS WILL BREAK! THIS MAY ALSO BREAK YOUR THINGS! SPI driven CircuitPython driver fo

Andrew Ferguson 1 Jan 14, 2022
This is an incredible led matrix simulation using the ultimate mosaik co-simulation framework.

This project uses the mosaik co-simulation framework, developed by the brilliant developers at the high-ranked Offis institue for computer science, Oldenburg, Germany, to simulate multidimensional LED matrices.

Felix 1 Jan 28, 2022
Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment

Code and build instructions for Snap, a simple Raspberry Pi and LED machine to show you how expensive the electricyty is at the moment. On row of LEDs shows the cost of the hour, the other row the cost of the day.

Johan Jonk Stenström 3 Sep 8, 2022
Anti-league-discordbot - Harrasses imbeciles for playing league of legends

anti-league-discordbot harrasses imbeciles for playing league of legends Running

Chris Clem 2 Feb 12, 2022