There are fewer things more satisfying than building a machine to automate a human task. But there's a special degree of satisfaction when that task is a game. From the first chess bots to Go-playing AI, constructing machines to play games has long been a worthy challenge.
These four Kennesaw State University students have done exactly that, but with an unlikely candidate: a pinball machine! The entire machine is made from scratch using CNC routed plywood, solenoid-powered actuators, some hobbyist electronics, and a Linux computer.
An Arduino Mega lies at the heart of this build. However, most off-the-shelf pinball components use solenoids. These run on a 48v source and require quite a bit of current that the Mega isn't able to deliver. The team went with some IRF44V MOSFETs to safely drive the required power to various flippers and bumpers, along with some protection circuitry to boot.
As for the automation, a webcam mounted above the playfield keeps an eye on the ball's position with the help of a computer running an OpenCV script. This looks for a ball entering the "Flip Zone" and sends a command to the Mega to trigger the flippers when it's time to strike.
Interestingly, the way they've written the OpenCV script does not detect the ball using circle detection, but instead by using a reference photo. A picture is taken of the playfield with no ball present and the flippers down, then all subsequent frames are compared against this baseline. Any differences between the two images are marked as a potential ball. The team notes that there are a couple advantages to this approach, namely the increased speed of execution and catching irregular shapes caused by the ball's motion blur.
"'A pinball machine that plays itself, doesn't that take all the fun out of it?' I hear you ask. Maybe if you're not into autonomous robots it might," says team member Tyler Gragg. But in case you aren't, they included an option to turn off the automation and play a good old fashioned game of pinball.
The team has an excellent project write-up here.