A stupid simple tabletop soccer app

A stupid simple tabletop soccer app

·

5 min read

The next project I want to build is a very simple app. This time I really want to write code which is being used on or with hardware. A raspberry pi will be used. Now the first step will be simple app that counts goals on a tabletop soccer.

We all have some breaks at work right? In the agency I work at there is a dedicated group of people playing tabletop soccer every break. So why don't we turn this into a fun project as well?

Proof of Concept

Before starting the project it's important to know if it's possible. That's why the first step of the project is just counting goals. But even that has to be possible right? So how do we count goals, which hardware is required and what are the difficulties of the project?

The Game

foosball-table-g3deb758e3_640.jpg If you ever played a round of tabletop soccer you probably know that the speed of the ball can be pretty damn high. Not only that there is also a high variance of possibilities how the ball goes into the goal. The last thing you have to be aware of that there are two goals or teams that you have to differentiate. Let's break it down.

Counting goals

At the end we only want to count goals! How do we achieve that with a raspberry pi? Exactly we need hardware that we can connect to our pi. There are a couple of different possibilities to count goals:

  1. Light barrier
  2. Force-Sensitive Resistor

I'm pretty sure there are a lot of other possibilities too but these two seemed to be the easiest. At first we took a look at a light barrier which in theory sounded great! After some testing noted that a light barrier is not the right choice. The light barrier was a bit to inaccurate.

So we have to test the Force-Sensitive Resistor. Every time a team scores the ball rolls through a shaft. In that shaft we have to place our force sensitive resistor. Will it work? Maybe. The problem here is that the ball is pretty lightweight. Also the ball has to roll over the resistor.

If the resistor notices the ball after a team scores, we have our proof of concept!

The teams

Luckily we have a table with two shafts. That makes it easy to differentiate the teams. Once we are able to count the goals we are done in theory. We will use a small display to show the score and we need to reset the score after a match ends.

All comes down to counting the goals. Do we need this? Absolutely not! But it's fun and super cool. Just imagine automatically creating statistics that show you the win rate of one team!

The Hardware

photo1662247871.jpeg We need a bit of hardware for this project. That's pretty cool because I never did something with external hardware before. The hardware we will use is:

As far as I know we don't really need more. The accuracy probably will not be 100% but I think if we hit like 90% it's good enough. For the goals that are not being tracked it would be cool if there would be a possibility to add goals manually.

We could just add two more Force-Sensitive Resistors and put them on top of our table. If a goal is not being tracked we just press the resistor manually. Now there are probably better ways but the most important thing is to get the app running!

Result

At the end we should have a very stupid simple app which counts the goals on our tabletop soccer. Every tabletop soccer has something to count goals so we absolutely don't need it but it's still pretty cool!

We want our app to count the goals for every team and display the score at a little screen. At the end of a game the score should reset and we need something to add goals manually, just in case. In theory super easy and simple and I really wanna do this!

Now the best thing about software is that you can scale it and do almost everything with it. Let's take a look what's possible.

Next steps of the app

Once we got the app running and we successfully can count goals we can work with that data. We just have to numbers right? But we still can create statistics like Team 1 has a winrate of 51%.

Let's get a step further. We could implement the possibility to create teams containing 1 or 2 players. So we don't only count goals we also know who plays in which team. With that we can create even more statistics like: The team containing player X has a winrate of X%. It's also interesting to see some 1v1 stats right? Or some 2v2 stats? All this is easily possible.

Something which is a lot easier to do is to add the time. So we are just stopping the time and have information on how long a game lasts.

Imagine having all that data.. With that you can do even more! If you got some stats of the players you can add a feature that creates teams that should be even matched. That would be pretty damn cool! In general a feature that creates random teams also would be cool right? As you can see, a lot is possible.

Conclusion

We need a bit of hardware and we might add some hardware to the project, if we get some other cool ideas, but if this works this is by far the coolest project I've ever worked on. Probably because I like to play some rounds of tabletop soccer myself!

Sure you have to invest a bit of money but just imagine all the things you could do! And everything just because you build a very simple counter app in the first place. Now it's time to create that app right?

Did you find this article valuable?

Support Joschi by becoming a sponsor. Any amount is appreciated!