It’s Pi Time We Played Some Table Football…

Table football, otherwise known as foosball, has been around since the 19th century, whether you’ve played it at home, in a pool hall, or in the corner of your local pub we all know the excitement in furiously spinning your strikers when you’re one goal away from a win. But when the competition is fierce and emotions are running high it always seems to go back to one thing – what was the score again?

At Matmi HQ we have a table football table of our own – when we’re not hard at work, sat in meetings, or debugging our way through countless lines of code we like to play a game, or three.

Something we often consider is how insular the experience is. For the players it’s a fast-paced gaming experience – you can’t take your eyes off the ball right up until the end, but for those around you (and those nearby) it’s significantly less intense as they stand around on their toes to see the ball and keep track of the score.

We wanted everyone, players and spectators to have the same experience – we’ve put a lot of thought into how we could make the game more inclusive for all. After some research into official tournaments happening around the world we found, to our surprise, they have no interactive elements at all! From world championships to local tournaments the most interaction we found was a cameraman linked up to a screen on the wall and that was only at the highest level of game play.

The solution needed to not only be practical, but low cost as well so it could be applied to any foosball table, no matter where it is.

Our solution was to create a Red vs Blue Table Football Companion App. All it required was a Raspberry Pi 3 B+, a few wires to connect the sensors to the Pi and two micro sensors. The app allows players to enter their names and track their scores in real-time through a local web page generated by the Pi, plus a shot of confetti with every goal.

The app was made in Vue.js for its simplicity (and making up for my lack of developing experience). This project has taught me a lot about working with a Pi – they’re pretty amazing. I’ve also learnt a lot about programming in HTML5, CSS and JavaScript, which prior to the project I hadn’t worked in at all.

Both micro sensors were relatively cheap and powered by two of the 3.3v outs from the Pi pins with the signals being sent to two unallocated pins. They’re fitted half way down the foosball table pipes that take the balls from the goal to the tray. I glued some cardboard tabs onto the triggers to make it easier for the balls to hit them. When a ball goes through the pipe the signals are read by a simple program that runs in Visual Studio Code – it was installed onto the Pi through the terminal in just one command – this triggers a message to be added to the Nginx hosted HTTP cache, detailing who scored and at what time.

The display app runs from a laptop – once the game starts the client polls the page a couple of time per second using Wi-Fi to check for new goals in the cache and to trigger a sound clip as well as the very important confetti.

I would like to further develop the app to make it a bit more self-sufficient and add a 2.4A or higher portable power source for the Pi into the table so it can be easily moved around the room without dragging wires about. It would also be great to set it up to run Visual Studio Code after start-up without the use of TightVNC or a HDMI screen to access the Pi. Also, I plan on adding a tournament mode to randomise the match ups and display the brackets, adding a bit more excitement and pressure to the game.

Keep an eye out for more updates, and thanks for reading.

Want to receive the latest news and tips from Matmi?Sign up to our newsletter

* By submitting your information you are agreeing to be contacted by Matmi. You can unsubscribe at any time by following the unsubscribe link within any of our newsletter emails.