Skip to content
Michael Lizzio

Automated Foosball Goalie

KURT (Killer.Ultimate.Robot.Teammate), a camera-tracked robotic foosball goalie

  • Raspberry Pi
  • OpenCV color tracking
  • Kalman filter
  • Stepper motor
  • Stepper motor driver
  • Custom motor controller
  • Overhead camera mount
  • T-slot framing hardware
  • Lego + cardboard prototypes

Working version by the end of December 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

A build log for KURT (Killer.Ultimate.Robot.Teammate), an automated foosball goalie built onto a $50 secondhand foosball table. A Raspberry Pi and an overhead camera track the ball with an OpenCV color tracker and a Kalman filter predicts where it is heading, while a stepper motor and driver move the goalie back and forth. The page is a dated timeline of seven videos from hauling the table upstairs in October 2022 to a working goalie on December 25, 2022, followed by a click-to-fullscreen photo gallery of the same milestones.

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.

Bringing the Table Home (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.

October 18, 2022

First Setup: Raspberry Pi and a Janky Camera Mount (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 3, 2022

Ball Tracking with OpenCV and a Kalman Filter (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 9, 2022

Stepper Motor, Motor Driver, and a Jingle Bells Melody (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 19, 2022

Designing and Building the Rig (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 setup and ready for the goalie to be moving!

December 22, 2022

First Movement (December 22, 2022)

Working motor controller connected to the table.

December 22, 2022

Final Setup: A Functional Foosball Goalie (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.

December 25, 2022

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.

Photo Gallery

Select any image to open the gallery, then use the arrow keys or on-screen controls to move through the build.

  • 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
  • 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 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
  • 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