This was a project to retrofit a football table with electonics to enable automatic scoring and special effects during gameplay. I have used a Raspberry Pi to run software I wrote in Kotlin/Native. Goal detection is realized with two HC-SR04 ultrasonic range finders placed inside the table, so that a ball returning to the table's ball feed mechanism has to pass in front of a sensor and be detected in this way.
Four 8x8 dot matrix displays placed next to each other form a 32x8 display which I have mounted in the center of the football pitch in an opening I made for it. Because the the pitch has a sheet of glass on top of it, the display does not interfere with the game while still being visible through the glass.
Both the sensors and the display have been connected to the Raspberry Pi's GPIO pins with flat ribbon cables. Although Python libraries exist to use these components, I have written my own drivers for them to keep the project Kotlin-only.
I have also placed a pair of speakers inside the table connected to the Pi to play sound effects for goals, streaks and other gameplay events. A button wired to the outside of the table allows to start and restart a running game.
My display driver includes a flexible font and animation system, in order to animate the goal and win effects.
During the game, the display shows the current score along with a flipped copy so that both players can easily read it. It also shows animated text effects for goals, goal streaks, come backs, wins and other special scenarios like a 9:9 score, all accompanied by sound effects from the speakers. When the table is not in use, the display doubles as a clock.
All of the source code is available in a repository.
I'm excited to hear from you.