Skip to content
← Back to all posts

Hacking a Foosball table

24 June 2016

Written by 


Russ Hill


Our company hack day came around again and the topic for this one was improving our social media presence. So we decided to take something “social” that we do internally and let the world hear about it: we hacked the Talis foosball table to count goals automatically and tweet the final scores. Here’s how…


A happy head start

Mark Wallsgrove (already a legend of the Talis foosball table due to the infamous “Wallsgrove Wallop”) and I worked on this hack and it involved both hardware and software. Fortunately a previous hack day had yielded the basics for the goal scoring mechanism which was essentially a Raspberry Pi Model B+ and simple infrared Break beam sensors mounted to the ball return mechanism for each goal, but due to time-constraints this hadn’t been completed. However, it would serve as a very useful head start to this project.

Resurrection time

Task one was to ensure that this collection of wires and circuits still worked, and thankfully it did - minus one rather important thing: the dot-matrix screen we originally planned to use to display the scores.

After a bit of head-scratching it was decided we’d be wasting too much time on this one day hack trying to get that working so we opted for an alternative:

  • use text-to-speech synthesis and a speaker system to announce the scores
  • post the scores in realtime to a HipChat room

This meant that players would have the scores announced to them as they played and other Talis staff could see the scores as they happened, no matter where in the building (or outside) they were.

Coding in Python

Mark got straight back in to the Python code (with me filling the role of backseat driver) and before long we had the code re-worked to use a TTS Python library called pyttsx. This now meant we had the scores being announced over the speakers we’d attached to the Pi and it wasn’t much of a stretch to add in the additional code to post goals as they happened to HipChat using Python Simple Hipchat and the final scores to Twitter using Tweepy.

Installation

The really fun part of the hack was actually installing the sensors and circuitry into the foosball table itself. Our goal was to do this in such a way as to hide the fact that the table had been modified, other than a rather obvious cable running to the table leg!

table

We got the Pi + wiring in place pretty quickly:

pi in situ

And the speakers:

speakers in situ

Then one further thing that needed to be on the outside was a reset button - to reset the scores and start a new game:

reset button

…and the wiring for the button:

reset button wiring

And finally onto the main event - the break beam sensors:

sensors in place ball return

Testing and tweaking

Following installation, we noted some issues with the one break beam sensor and had to relocate it in order to get an accurate report of a goal - we suspected this was down to the angle of the emitter vs the receiver and just some general jiggling resolved things nicely.

Other than that, a couple of test games showed that the table was recording the goals perfectly and announcing the score each time. As well as this, we had a great running commentary in HipChat:

hipchat history

And a rather neat final score posted to the Talis engineering Twitter account:

twitter scores

Comments on HN