Saturday 18 July 2020

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


** UPDATE: You can buy this kit from the CodeSingh shop **

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 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

  • Raspberry Pi OS Lite https://www.raspberrypi.org/software/operating-systems/
  • 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 commands to update the list of install packages and then upgrade all install software.
sudo apt-get update
sudo apt-get upgrade 
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

    Wednesday 10 April 2019

    Hyper-V virtual machines in starting state for a long time (Veeam issue)

    The Issue

    At work we have a two Hyper-V host set up with one live Hyper-V server and one replication server. We run 5 virtual machines on Hyper-V and use Veeam to backup and replicate all the virtual machines.

    The last few times that I restarted the main Hyper-V server for windows updates I noticed that the virtual machines took a long time to start up.

    The host server restarted as normal but all the virtual machines showed as 'starting...' in Hyper-V Manager with no sign of any of the virtual machines starting up.

    After around an hour and a half of waiting all the virtual machines suddenly started up as nothing had happened. When I checked all the virtual machines they were working normally.

    I restarted one of the virtual machines to see if the slow start up happened again. This time there was a slight delay of around thirty seconds but nothing as extreme as the first boot. So it looked like it was only an issue when the host server rebooted.

    I looked through the event viewer but couldn't see anything regarding the slow boot.

    The Fix

    After a few hours of search on the internet I finally found an article that looked like it matched my problem. It was from a Veeam forum thread. I contacted my IT support company to get there opinion on the article and they confirmed that I had the same issue.

    I have to schedule in an update for Veeam Backup and Replication to Version 9 Update 4

    The Problem

    The problem of the slow boot was caused by Veeam Backup and Replication 9 not cleaning up replication points correctly in virtual machine configuration files. Hyper-V configuation files with the extension .vmxc are used by Veeam, to temporarily store replication point information. The information should be deleted soon after the relication has completed but for some reason this clean up doesn't happen correct in this version of Veeam Backup and Replication. The .vmcx files should be quite small but in our example they were around 50 mb each. We ran the script to check how many replication points were stored in the files and found it to be an average of 14000 replication points!

    We haven't updated Veeam yet but hopefully this should fix the issue. I'll update this article to confirm if the fix works or not.

    Wednesday 22 October 2014

    Automate mkdocs html files build process

    At work I needed to find a way of writing a lot of documentation easily and quickly. The system was going to be used by technical and non-technical people.

    For this I am current looking at a great project called mkdocs. This is a python program that allows for all documentation to be created in markdown syntax and then built into a flat html website.

    Markdown is a text to html processor that has an easy to learn syntax . Markdown files can be created in any text editor. So users can be focused on creating documentation rather than getting distracted.

    My idea was to allow all user to create documentation and see the changes instantly on the website. mkdocs has a setting that dynamically shows how your pages will look in a browser while creating the documentation source files.

    This works great but I needed to be able to build flat html files and copy them to a web server.

    Below is the batch file (windows)
    REM Automate the build process of creating a website from mkdocs markdown

    REM Change to source drive
    X:

    REM path to docs site to convert
    cd X:\DocSource\admin

    REM covert to flat html website (this creates a 'site' folder)
    c:\Python27\python.exe c:\Python27\Scripts\mkdocs build

    REM copy site to web server folder
    xcopy site\* c:\inetpub\wwwroot\admin\* /s /e /y
    This can run on a schedule or even could be set up to run when something changes in the document source location.


    Tuesday 8 July 2014

    Using Mozilla Webmaker to create a map of all Gurdwaras (Sikh Temples) in Bradford, UK

    I have created a map of all the Gurdwara Sahibs in Bradford. It uses leaflet.js and openstreetmap for the mapping. It was all created in Mozilla Thimble which allows for easier javascript and html editing through an online editor.

    Monday 7 July 2014

    Geocoding address data in Excel using google Geocoding API

    I had a long list of addresses that I needed to show on a map. I found a great article that showed exactly how to call googles geocoding mapping from Excel.

    The only issue I had was that Googles API doesn't like it if too many requests are made too quickly so I created a function to add the geocoding calculation into a column one cell at a time and waiting one second between calls.

    Below is the function

    Sub Geocoding100()
        Dim I
        For I = 1 To 100
            ActiveCell.FormulaR1C1 = "=GoogleGeocode(RC[-1])"
            ActiveCell.Offset(1, 0).Select
            Application.Wait (Now + TimeValue("00:00:01"))
            Next I
    End Sub
    I can leave this function running in the background to geocode a list of addresses in excel and I am not hammering Google Geocoding API.

    Its a win win situation!