ScoreTechHockey – a Real-time Hockey Scoreboard

by AndreasAdam in Circuits > Raspberry Pi

7 Views, 0 Favorites, 0 Comments

ScoreTechHockey – a Real-time Hockey Scoreboard

IMG_5051.jpeg
image00001.jpeg
image00018.jpeg

ScoreTechHockey is a smart scoreboard platform for field hockey that automatically tracks goals and time using various sensors. The data is streamed live to both a physical scoreboard and a responsive web dashboard, so players, referees, and fans can follow the game in real-time.

Everything little bit of code I wrote, u can find on my GitHub:

GitHub - ScoreTechHockey

Supplies

Here’s a list of all the components I used for the project. I’ve also included an Excel file with links to where you can buy each item.

Controller

  1. Raspberry Pi 4 (with SD card and power supply)

Sensors

  1. MPU sensor – Detects when the ball enters the goal
  2. Real-Time Clock (RTC) – Keeps accurate time, even without Wi-Fi
  3. Humidity sensor – Measures field humidity

Actuators & Displays

  1. Passive buzzer – Gives an audible signal when a goal is scored or the game is paused
  2. LCD display – Shows the Raspberry Pi’s IP address
  3. External display – Used as the main scoreboard visible next to the field

Other Components

  1. Resistor – Used in the buzzer circuit
  2. Breadboard + jumper wires – For easy prototyping
  3. Laser-cut case – Custom housing for all components
  4. Button – For physically shutting down the Pi
  5. Miscellaneous – Resistors, header pins, USB cables, etc.

Electronics & Circuit Setup

Schermafbeelding 2025-06-19 133342.png
Schermafbeelding 2025-06-19 133550.png
image00031.jpeg
image00036.jpeg

Before starting the actual build, it's important to make a prototype and have a clear reference for how everything should be connected.

To help with that, I created a Fritzing diagram that shows how to wire all the components. This made it much easier to follow while building the circuit — and most importantly, it helped me avoid damaging my Raspberry Pi.

Database Design

Schermafbeelding 2025-06-19 133205.png

Next up, the database. We need to make sure the data can be stored in a good way and that our database is easy to expand without changing our whole logic behind it. That's why I made sure my database is 3NF, this means it is expandable if u would like to add things to it.

Database Tables:

acties: This table stores the actions of what a component did

component: stores all the components u have and describes what they are

historiek: : Here you can see what the components did and when they did it, this is really handy if you want to make a graph of your data for example.

Teams: Store all the teams there name location and points

wedstrijden: The games that are played are stored here which team against which, the score, location, and referees.

wedstrijdleiding: all the referees and there role


You can see the EER Diagram above and how I linked everything together.

You can just run the .sql file in your workbench and everything should be setup with dummy data.

GitHub - sql file

Backend & Dataflow

IMG_5055.jpeg

Finally, the fun part: coding the project!

You can find all the files mentioned below in the backend folder of my GitHub repo right here:

GitHub - Backend Folder

Connecting the database to your Raspberry Pi

To let your Raspberry Pi know which database to use, start by making a copy of the config_example.py file. Then, fill in your own details like this:


USER_HERE = "your_username"

PWD_HERE = "your_password"

DATABASENAME_HERE = "your_database_name"


Make sure your Pi can reach the correct IP address too.

The Backend

For the backend, I used FastAPI to handle all the data and Socket.IO to send real-time updates to the website.

DataRepository.py

This file contains custom functions to filter and retrieve exactly the data I need from the database.

App.py

This is the main backend file where everything comes together:

  1. The code for each component
  2. The logic from DataRepository.py
  3. The routing and socket events

To keep the project organized, I recommend putting the logic for each component into separate files and then importing them into app.py, just like I did.

All_sensors.py

This file contains the logic for each individual sensor and what triggers what. Here's a quick breakdown:

  1. MPU → Detects scoring motion
  2. RTC → Keeps track of time
  3. Humidity Sensor → Logs weather conditions
  4. Ball Detection → When the ball is detected in the goal:
  5. Score is updated
  6. Goal is logged
  7. Buzzer sounds

All of this data gets pushed to the database and the frontend in real time.

Frontend & Visualization

Schermafbeelding 2025-06-19 154111.png

The Frontend

The frontend is pretty straightforward. I used HTML, CSS, and JavaScript to build the website and display all the live data.

You can find all the files right here:

GitHub - Frontend Folder

What can you see on the website?

  1. Dashboard: Live score, game timer, and match history
  2. Klassement: The current team standings
  3. Sensors: Graphs that show real-time sensor data
  4. Admin: If you log in, you can:
  5. Edit the score
  6. Pause the game
  7. Shut down the Raspberry Pi remotely

Functionality

JavaScript is the main language that powers all the interactive features.

Most of the real-time stuff works using Socket.IO combined with regular JavaScript functions.

Tip

Want your site to work well on phones too?

Make sure it’s responsive by using CSS Grid and media queries.

Case Design & Assembly

image00001.jpeg
image00018.jpeg

Putting Everything in a Case

Now that you’ve built everything, it’s time to put it in a case!

I laser-cut mine, but you can also 3D print one or build it by hand it your chose.

A Few Tips Before You Start:

  1. Sketch it first: Draw out your design on paper so you have a clear idea of what it’ll look like.
  2. Measure everything: Make sure to measure all your components, so everything fits nicely inside.
  3. Choose the right material: Think about what material you want to use. I used 3mm MDF and designed everything in Adobe Illustrator, but feel free to use any software or material you prefer.

Once your case is ready, just load all the components inside — and you're done!

Bonus Tip:

Make sure the cables for your MPU sensors are long enough to reach the goal.

You can use an old Ethernet cable, for example.