ScoreTechHockey – a Real-time Hockey Scoreboard
by AndreasAdam in Circuits > Raspberry Pi
7 Views, 0 Favorites, 0 Comments
ScoreTechHockey – a Real-time Hockey Scoreboard



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:
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
- Raspberry Pi 4 (with SD card and power supply)
Sensors
- MPU sensor – Detects when the ball enters the goal
- Real-Time Clock (RTC) – Keeps accurate time, even without Wi-Fi
- Humidity sensor – Measures field humidity
Actuators & Displays
- Passive buzzer – Gives an audible signal when a goal is scored or the game is paused
- LCD display – Shows the Raspberry Pi’s IP address
- External display – Used as the main scoreboard visible next to the field
Other Components
- Resistor – Used in the buzzer circuit
- Breadboard + jumper wires – For easy prototyping
- Laser-cut case – Custom housing for all components
- Button – For physically shutting down the Pi
- Miscellaneous – Resistors, header pins, USB cables, etc.
Downloads
Electronics & Circuit Setup




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

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.
Backend & Dataflow

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:
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:
- The code for each component
- The logic from DataRepository.py
- 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:
- MPU → Detects scoring motion
- RTC → Keeps track of time
- Humidity Sensor → Logs weather conditions
- Ball Detection → When the ball is detected in the goal:
- Score is updated
- Goal is logged
- Buzzer sounds
All of this data gets pushed to the database and the frontend in real time.
Frontend & Visualization

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:
What can you see on the website?
- Dashboard: Live score, game timer, and match history
- Klassement: The current team standings
- Sensors: Graphs that show real-time sensor data
- Admin: If you log in, you can:
- Edit the score
- Pause the game
- 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


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:
- Sketch it first: Draw out your design on paper so you have a clear idea of what it’ll look like.
- Measure everything: Make sure to measure all your components, so everything fits nicely inside.
- 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.