Saturday, 18 July 2020

How To Build A Live Raspberry Pi Led Football (Soccer) Scoreboard


Keep an eye on your teams score without having to constantly refresh your mobile by building this live LED Football (Soccer) scoreboard.

Inspired by this post by u/LobsterThief on Reddit.com and special mention to /u/RiffnShred for the original idea
 

Hardware

  • Raspberry Pi Zero WH
  • 64x32 indoor RGB hd p4 indoor led module video wall 1/16 scanning high quality rgb module full color led display screen (buy here affiliate link)
  • Adafruit RGB Matrix Bonnet for Raspberry Pi (buy here affiliate link)
  • 5 amp power supply. (I got one from a local mobile phone shop) 
  • 16 GB MicroSD

Software

  • Raspbian OS Buster Lite
  • Rpi-rgb-led-matrix https://github.com/hzeller/rpi-rgb-led-matrix
  • Rpi-led-scoreboard https://github.com/CodeSingh/rpi-led-scoreboard

Construct and Install Software

Firstly go through points 4 to 6 from Learn how to build your own NHL Game Day Scoreboard using a Raspberry Pi and LED panel!

Keep the micro sd in your computer

Create an empty file called ssh (no extension just ssh) and copy to the sd card

Create a file called wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
    ssid="WiFi SSID"
    psk="WPA/WPA2 passphrase"
    key_mgmt=WPA-PSK
}
Replace WiFi SSID with your wifi network name

Replace WPA/WPA2 passphrase with your wifi network password

Replace GB with your two letter country code if you are not in the UK

Save wpa_supplicant.conf

Copy over wpa_supplicant.conf and ssh files to micro sd card

Insert micro sd card into raspberry pi zero

Leave for a few minutes to let everything start up correctly.

Download Advanced IP Scanner and set it to scan your network for devices.



If everything goes ok then you should see an ip address labelled as Raspbery Pi Foundation

Download and install Putty 

Enter the Raspberry Pi's ip address into the Host Name and open


Log in with the username: pi and password: raspberry when prompted.

Enter the following command to install git
sudo apt-get install git -y
Enter the following command to download scoreboard code and
git clone https://github.com/CodeSingh/rpi-led-scoreboard.git
Enter the following commands to go into the scoreboard directory and make the install file executable.
cd rpi-led-scoreboard
sudo chmod 777 install.sh

Run the install file
sudo ./install.sh
I have used the flicker-free setting by following these instructions as they make the scoreboard display a lot better but it requires a modification on the bonnet. If you don't do the modification then you will need to make the following changes in the display.sh file.

From

#!/bin/bash
/usr/bin/python3 /home/pi/rpi-led-scoreboard/image_viewer.py --led-cols=64 --led-gpio-mapping=adafruit-hat-pwm --led-brightness=40 &


To


#!/bin/bash
/usr/bin/python3 /home/pi/rpi-led-scoreboard/image_viewer.py --led-cols=64 --led-gpio-mapping=adafruit-hat --led-brightness=40 &


Reboot the Raspberry Pi
sudo reboot

 Configure

The default configuration will show Manchester United games in the English Premier League. If they don't have a game today then it will show their up coming games or just the time, depending on what the BBC website is showing today.

In the unlikely event that you want to use the scoreboard to see another teams matches you can change the configuration using the built in web configuration page.

The configuration page can be accessed by browsing to the Raspberry Pi's ip address in your favourite browser.

You will be greeted by a magnificently basic webpage with all scoreboard settings.



The configuration page has following features:

  • Reboot button. Used to restart the scoreboard
  • Status: Used to turn the LED panel off and on
  • Team: This is where you can choose the team to show on the scoreboard. Please note: You can select All to show all todays matches on a 30 second rotation.
  • Live Score Type: Used to choose between English Premier League and English FA Cup
  • Weather API Key: This is an external API key used to retrieve weather information from https://openweathermap.org/. You can obtain a free weather API key using the Get API Key link.
  • Weather API Units: Used to choose centigrade or fahrenheit for the temperature display.
  • Weather Location: If you want to change the city used for the weather information then type in city, country here. 

 Notes

  • Scores and weather information are updated every minute on a cronjob
  • I use flask to create the webpage
  • The weather icon sometimes shows a white background. I'm not sure why this happens.
  • I haven't managed to create a case for this yet.
  • I scrape BBC Sport website so the system may stop working if BBC Sport change their website. To combat this I have tried to make the score scraping system modular, so adding different score scraping sources to the system is possible.
  • If you aren't inclined to make this yourself I can make it for you (for a small fee)
  • If you want any particular customisations then let me know in the comments