Skip to content
Michael Lizzio

Automated Foosball Goalie

Wide view of the finished build: the foosball table with the dowel camera rig suspended overhead, KURT's rail and electronics on the near side, and the tracker running on the monitor at the left
What it is
KURT (Killer.Ultimate.Robot.Teammate), a robot goalie for a real foosball table. A camera watches the ball and a stepper motor slides the goalie over to block it.
Why I made it
I saw a similar project on a college tour and wanted to build my own, so in October 2022 we picked up a foosball table from Facebook Marketplace for $50.
What I did
I tracked the ball with OpenCV on a Raspberry Pi, using a camera on a mount made of dowels and a Chinese food container, plus a Kalman filter to guess where it was headed. Then I built the motor circuit and controller with some guidance from my dad, and the side mount after Lego and cardboard prototypes.
How it turned out
By Christmas 2022 KURT was blocking shots on his own. He still has flaws, but he makes more saves than I would, and I learned a ton building him.

My original write-up

Making an Automated Foosball Goalie!

Below are some videos and descriptions detailing the process of constructing my automated foosball goalie, KURT (Killer.Ultimate.Robot.Teammate). I started the project after being inspired by a similar project that I saw on a college tour. It was a long journey from obtaining the foosball table in October to me creating a working version towards the end of December. So please feel free to jump around and check out the project below.

October 18, 2022

So this was the day where we picked up the foosball table from Facebook Marketplace for $50. After that, we had the fun time of hauling it all the way up the stairs so I could start putting it back together.

December 3, 2022

After setting up the foosball table, Raspberry Pi (the brains of this thing), and a very janky camera mount made out of dowels and a Chinese food container, I was able to focus on the software that would be used to track the ball across the foosball table. This was kind of a big deal because it would be the decider if this whole project was actually possible.

December 9, 2022

I did plenty of research on all sorts of object tracking software, even testing out some AI object recognition software. I ended up settling on a simple color tracker (OpenCV) mainly because it could quickly display the ball's coordinates (red circle and red text), which were derived from the live camera feed. Finally, I used the Kalman Filter to predict the future estimated position of the ball (the white circle in the video that's leading the ball).

December 19, 2022

Happy with the state of the object tracking software, I started to play around with the stepper motor and motor driver. It was a complex system, but utilizing resources found on the internet and with some guidance from my dad, an electrical engineer, I was able to construct the circuit that made the motor function. Having this isn't everything, though; I need to write the software that would control the motor which includes direction, activation, and the speed. I would go on to make a few versions of the motor controller software, and finally got one to work well enough for testing. Throughout this, I was fascinated by the sound it made as I increased the speed. It sounded just like a musical scale, which makes sense because to change the speed you set it to a different frequency, or, in musical terms, a different note. Knowing this, I was able to create the Jingle Bells melody. In the video you are able to hear the melody and also see the frequencies used, which are displayed on the monitor.

December 22, 2022

As a part of the planning process, I designed multiple prototypes of the contraption that would attach to the side of the table and move the goalie back and forth. Some were made out of Legos, and some cardboard. Once I was happy with the design, I added the parts to my Amazon cart and placed the order, praying that they would all work together. On receiving the parts I was thrilled to start putting the contraption (or KURT) together. After assembling and disassembling KURT many times, and a few runs to Home Depot, I was able to mount it and get almost everything set up and ready for the goalie to be moving!

December 22, 2022

Working motor controller connected to the table.

December 25, 2022

Finally, I was able to combine the ball tracking software with the motor controller to create a functional foosball goalie. A lot of tweaking and tinkering went into getting the optimal positioning strategy down, but in the end he makes more saves than I would.

Thanks for having a visit with KURT, my Automated Foosball Goalie!

There are still plenty of flaws, and many improvements to be made. But in the end, I'm happy that I took on this challenge, and even more so, I'm thrilled about all the knowledge that I gained.

Click on the Image to View Them Fullscreen!

  • The foosball table outside on pickup day, part way through reassembly, with clamps, a screwdriver and pliers lying on the playfield
    October 18, 2022
  • The first setup: the reassembled table in the bedroom with the improvised dowel-and-takeout-container camera mount suspended above it and a monitor and keyboard on a side table
    December 3, 2022
  • The rebuilt camera mount standing on the floor: taped dowel legs holding a plastic takeout container for the camera at the top
    December 9, 2022
  • A monitor showing the KURT_V2.py source in the Thonny editor beside the OpenCV 'Object Tracker' window, where the overhead view of the table is marked up with a green bounding box, the ball circled in red with its coordinates, and a red box around the goalie
    December 9, 2022
  • The stepper motor bolted to a board next to a breadboard with LEDs and a ribbon cable, surrounded by tools, bolts and mounting hardware
    December 19, 2022
  • A desk covered in electronics and parts during the motor controller work
    December 19, 2022
  • A whiteboard marker sketch of the drive mechanism - motor, rail and carriage clamped to the table - with a sketch of the goal end of the table above it
    December 3, 2022
  • Prototype models of the goalie mechanism built from Legos and taped cardboard, on a counter in front of a pegboard of pliers and cutters
    December 5, 2022
  • The ordered parts laid out before assembly: aluminium extrusion rails, brackets, mounting plates and hardware
    December 21, 2022
  • The aluminium extrusion rails mounted to the side of the table, carrying the plate that rides along them
    December 21, 2022
  • Close-up of the carriage plate clamped to the goalie rod, riding the rail on wheels and driven by a toothed belt
    December 22, 2022
  • The wiring panel: a breadboard fed by the Raspberry Pi GPIO breakout ribbon, mounted above a DM542T digital stepper driver
    December 22, 2022
  • KURT fully mounted to the side of the table - electronics panel, stepper motor and a cooling fan - with the rail extending out past a bench power supply
    December 22, 2022
  • The finished setup in use: the table with the camera rig overhead and the electronics on the right, and the tracker view running on the monitor at the left
    December 25, 2022
  • Wide view of the finished build: the foosball table with the dowel camera rig suspended overhead, KURT's rail and electronics on the near side, and the tracker running on the monitor at the left
    December 25, 2022