Built for Elmley Castle Cricket Club by Ian Woodford for the 2021 season.

The scoreboard was built following a request by the committee for an electronic scorebord that could be controlled by the scorer using a tablet. Although other cricket clubs had built their own systems, I couldn't understand how they'd done it from their write-up's, so I decided to start from scratch and build to my own specification.

The scorer's web page that controls the scoreboard.

The general design

The scorebord itself comprises a Raspberry Pi microcomputer and a series of 480 indivual LED lights that are arranged in the shape of 15 digits. Each digit has 32 LEDs in the shape of a number 8 and to create any number from 0 to 9 within that digit a different series of the 32 LEDs are lit up. A computer program controls which LEDs are lit. The Pi is connected to the WiFi in the pavilion, so the scoreboard has to be kept within WiFi range, but other than that it can be positioned to suit the requirements of the day (E.g. the position of the wicket being used, the angle of the sun, etc.)

The Python program runs as soon as the scoreboard is switched on, so the user simply has to plug the scoreboard into a power socket on the outside of the pavilion and it starts to work.

The tablet is also connected to WiFi and the scorer starts a browser and goes to a particular website where the scoreboard is controlled from. All the scorer has to do is enter the score by clicking on buttons. There are buttons to control each digit individually, and there are some buttons that have a little intelligence built-in. For example, clicking on the '+6' button underneath one of the batter's score will add six to their score as well as adding 6 to the Total score. These special buttons are coloured green to distinguish them from the simple buttons which only increase the individual digit's number. The simple buttons are coloured grey. There are also two grey buttons that reset the batters' scores to zero and a red button used to reset the scoreboard at the change of innings.

There is another web page that can be used by the general public to view the scores. This is at www.red-goose.uk. The web page automatically refreshes every 5 seconds so the score is always up to date.

Techniques for use

The scoreboard is simple to use, but there are techniques to using it that make the overall experience better for those viewing it remotely from red-goose.uk. At the start of a new match the scorer clicks on the red button to start a new innings. They are taken to another web page where they have to state whether it is the innings of the home or away team before they are taken back to the scoreboard page and allowed to enter scores into the scoreboard. This stage exists so that those viewing the scoreboard online can tell which team is batting. It makes no difference on the scoreboard itself because there isn't any indication on the actual scoreboard which team is batting.

At the end of the first innings the score should be left on the screen until the second innings is about to begin. This is so those viewing online get the chance to see how the innings ended up, i.e. how many wickets were down, number of overs taken, etc.

At the end of the match the scoreboard should be left as it is and not reset until the following match. Again, this is so that anyone viewing online can tell how the match ended up even if they don't view the scoreboard until say, the middle of the week. It should be clear, to anyone who knows anything about cricket, what the result of a match was by looking at the scoreboard at the end of the second innings. For example. If the second innings score is greater than the first innings score then the team batting second won. If the first innings score is greater than the second innings score then either the match hasn't yet finished (which is unlikely if you're viewing it two days later!) or the team batting first has won. This can be confirmed by looking at the number of wickets down and the number of overs bowled. Obviously the number of wickets down can only go to a maximum 9 on the actual scoreboard because there is only one digit available for wickets, so it's possible that the viewer might think the match is ongoing if the batting side require, say, ten to win and the number of wickets down is 9 with overs to spare, even though the last wicket has fallen. I suggest changing the number of wickets back to zero and leaving the rest of the scoreboard as it is in this case.

A detailed tech guide to how it works

There are 2 main parts to the scoreboard system:

1. The Scoreboard

The scoreboard is a wooden box with a laminated glass front to protect the LEDs from rain and the impact of a cricket ball. It is made from 4x2 softwood and plywood. Inside the 'box' are 15 LED digits each comprising 32 LEDs that are all connected by one data wire. There are 480 LEDs altogether all connected together. The LEDs were purchased as two strips of 300 individually addressable LEDs that were chopped up into groups of 4 and 5 LEDs and these were then soldered together to make the digit 8, with 4 LEDs making the horizontal bars of the digit and 5 LEDs making each of the vertical sections of the digit.

The digits are grouped together in banks so there are 3 digits for each batter's total, 3 digits for the main total, 2 digits for the overs, 1 digit for the wickets and 3 digits for the first innings total. The LEDs come with an adhesive backing and each group of digits was stuck onto a perspex sheet before being attached to the framework of the scoreboard. The positions of the small lengths of LEDs was painstakingly laid out using masking tape before being stuck down, to ensure all digits looked identical.

Inside the rear of the scoreboard without the external plywood back.

There is an internal plywood panel inside the scoreboard that has the control system on it. Top left is the Raspberry Pi, plugged in to the mains power. To the right of the Pi is the logic level shifter (explained below) then wiring to and from a 5V 10Amp transformer. Each bank of digits has its own power supply from the transformer and there is a single wire joining all the digit banks together. This is the data wire.

The LEDs are WS2812b individually addressable full colour LEDs, which means each LED can be set to any colour using the RGB value. So, for example, by setting the RGB values to R=0, G=255, B=0 you will get a fully green LED, or by choosing R=255, G=255 and B=255 you get bright white light. You don't have to use values of 255, you can use smaller values for dimmer lights. The values are set programatically in the Python code which is explained further below.

As mentioned above, there are 300 LEDs to a strip (this is how I bought them, but you can get strips with varying numbers of LEDs and varying spaces between each LED. You can even buy LEDs in a matrix)

Video of one digit under construction

You can see from the video how the digits were built. Sections of the LED strip were cut and stuck onto the acrylic sheet, then these sections were soldered together. The LED strip can be cut into any number of LEDs simply by cutting across the strip on the exposed gold coloured metal areas, which can be seen in the video between each LED. It is then possible to join the short srips of 4 or 5 LEDs by soldering the gold metallic strips together using assorted lengths of wire. I used some standard 1mm twin and earth that is usually used in household electrical lighting circuits and ripped the wires out of that. I discarded the earth cable because that isn't plastic coated and cut the remaining brown and blue plastic coated wires into short strips. You can see in the video that I've used brown or blue wires without any order, i.e.I haven't kept blue for ground and brown for live. I knew I was going to mask off the LEDs then spray over the wires with black paint in the end so I didn't bother being strict about wiring conventions. The central wire of the three is the data wire and the two outer wires are the +5 volt wire and the ground (zero volts). It says on the LED strip which is which so you can't make mistakes when soldering.

The video shows the order in which I connected the strips. The data comes in from the left of the screen and so the first LED of the digit is the first one in the bank of five in the top left of the digit. In order to make the digit light up like this I've told digit number 1 to light up, then digit number 2, digit number 3, etc, up to digit number 32. Then I've told digit number one to turn off, then digit number two etc. In fact, as you've got this far through this write-up you'll probably know that it actually counts from LED number 0 and continues to number 31, because computers count from zero. The next digit, which hasn't been wired up yet in this video, will have wires soldered from LED #31 of the first digit to LED #0 of the second digit. As the digits are all controlled with one data cable which tells which LED to light up and what value of RGB to apply, you'll probably understand that the first LED of the second digit is not number #0, but is in fact #32. The first LED of the third digit is #64 and the fourth digit starts with LED #96. You can see then that as there are 32 LEDs per digit and 15 digits in total, the final LED is number #479, with each successive digit having a starting LED that is a multiple of 32. This fact is used in the Python program to allow functions to be written for each number displayed on each digit.

The Raspberry Pi was chosen because I'd used them before on other projects. I know a little Linux ( Linux is the operating System of the Raspberry Pi {actually the OS is called Raspbian, but it's pretty much the same}) and I knew there were output pins that I could use to control the LEDs. Only 3 output pins are used for the scoreboard. One pin is +5 volts, another is ground (0 volts) and another is any pin that can be used as an output, which is +3.3 volts. This is pretty much all that is required to control the LEDs except for one thing: the data line for the LEDs requires 5 volts and the Pi only gives out 3.3 volts. This is where the logic level shifter comes in. Its sole job is to change the 3.3V output to 5V when called to do so. I bought the logic level chip, watched youTube clips, then built the shifter. It uses a resistor of some sort. I can't remember exactly what size. You might be able to see a capacitor if you look closely at the photos but I think that was one idea that I discounted, so it's not attached to the shifter. Bear in mind that I had to learn all the electronics for this project, so if you're planning on building one then just use youTube to get the skills like I did. In fact, I wouldn't say I've gained any electronics skills as I simply copied what someone else had already done. My soldering hasn't got any better either, and there's over 600 soldered joints in this beast!

There is a 5V, 10A transformer in the system. If every LED was to be switched on at full power at the same time then some clever person on the internet did some calcs which showed this number of LEDs could be pulling 10 Amps. I can't foresee any time, except when I was testing the digits during the build, when all digits would be set to 8 on maximum brightness, so I went for the 10 Amp supply as an over-estimate. It also has some built-in protection.

There can also be an issue where the LEDs at the end of the strip become dimmer due to the power being taken by the earlier LEDs, so it's allowable to add power to both ends of the strip and anywhere along the length of the strip too to prevent this. I decided to add power to each bank of digits and hopefully you can see from the photo looking inside the scoreboard how I did that using two terminal blocks to feed twin and earth cable to each bank (The earth wire wasn't used). The individual wire connecting the banks together is the data wire, which HAS to join all LEDs together sequentially.

2. The Technicalities

I had to write a Python programme to control the LEDs. I'll explain how that works, but first I have to explain how the web page links to the Raspberry Pi. The web page is a stand-alone system in that it doesn't require the actual scoreboard to even exist. The web page takes an input from a button click, changes the displayed digit by going to a different php file, then comes back to the scorebord page and displays the new number, then waits for the user to press the next button. It works immediately and without any delay. This is standard php stuff. But what it also does is create a 16 digit text file each time the score changes. The file might look something like this: "H.23151.82326...". The first character defines whether it is the Home or Away team batting and is therefore either H or A. The next 15 characters are the digits in the scoreboard, so in this example: the first batter's total is 23 - note the blank space before the 23 because the hundreds digit is blank. The overall total is 151, the second batter's score is 82, 32 overs have gone and 6 wickets have been lost. The last three digits are blank because this is the first innings of the match. It is this text file that the Raspberry Pi is constantly searching for and changing the value of the displayed digits based upon its contents. So the Pi will be asking "What's the number of the 6th digit? OK it's 1, so I now have to change the sixth digit on the scoreboard to a 1. I can do that because I know the 6th digit starts with LED numbner 32 x 6 = 192, and I will send this number to the function that draws a number 1". The function to draw a 1 takes a parameter x which is the position of the first LED (in this case x=192), then sends power to LED number x+9, x+10, x+11, x+12, x+13, x+27, x+28, x+29, x+30, x+31 (the very keen of you will probably look at the video and confirm that this lights up the two vertical strips of LEDs on the right hand side of the digit to make the number 1).

The Python program sets the Raspberry Pi to use the pin I chose to act as an output pin. The pins are called GPIO (General Purpose Input Output) pins and need to be set before they can be used. Then the code looks for the text file which is on an external server that hosts the web pages including this web site. It looks every 5 seconds, which gives the LEDs time to light up where necessary. It then checks each character position in turn and displays the correct numbers in the correct place. It's not very complicated at all, except that the digits don't all light up in the same order that you see in the video. The digits on the bottom of the scoreboard light up back to front. (There is an arrow drawn on the LED strip showing which way the data has to travel. You can't just stick them together any way round or they won't work). The reason I made them like that was so that as the data wire moves between the banks of digits, it goes all the way along the top row then directly down to the bank below then back along the banks on the bottom row (Batter #1, Total, Batter #2, First Innings, Wickets, Overs). I could have gone left to right then top to bottom but I wanted to keep the data wire as short as possible between data banks to prevent data loss that can sometimes happen with a long wire. Doing it this way meant that I had to write different functions for the digits on the bottom row. If you're struggling to understand this then maybe this will help: I explained above how a number 1 was displayed, well if the flow of data now comes in from the other side of the digit to the direction shown in the video, to create a 1 you'd need to light up digits x, x+1, x+2, x+3, x+4, x+18, x+19, x+20, x+21 and x+22. Also, all other numbers needed to have new functions except zero and 8 (and blank. Each time a digit is changed you have to set some LEDs to off and some to on, you can't just change the ones that need to be on).

Hopefully by now you've seen the web page that can be used to view the score. If not, it's at www.red-goose.uk and is essentially just a slave of the scorer's version. Being a page on a website it's obviously available to view from anywhere. The Elmley team playing away will use it to follow the home team score, my uncle in the USA will be able to keep up with play and so will Shirley Sheward in Hong Kong and Cooperman in Canada. If you'd like to build one for your own club and want some advice, then feel free to email me at ian@red-goose.uk.

Ian Woodford. 2021