Ben’s Raspberry Pi Twilight Zone pinball hack

When Ben North was faced with the dilemma of his nine-year-old son wanting him to watch his pinball games while, at the same time, Ben should be doing housework, he came up with a brilliant hack. Ben decided to investigate the inner workings of his twenty-year-old Twilight Zone pinball machine to convert its score display data into a video stream he could keep an eye on while working.

Ben North Raspberry Pi Twilight Zone Pinball

Ben ended up with this. Read on to find out how…

Dad? Dad! DAD!!

Kids love sharing their achievements. That’s a given. And so, after Ben introduced his son Zach to his beloved pinball machine, Zach wanted his dad to witness his progress. However, at some point Ben had to get back to the dull reality of adulting.

My son Zach, now 9, has been steadily getting better at [playing pinball], and is keen for me to watch his games. So he and I wanted a way for me to keep an eye on how his game is going, while I do other jobs elsewhere.

The two of them thought that, with the right tools and some fiddling, they could hijack the machine’s score information on its way to the dot matrix display and divert it to a computer. “One way to do this would be to set up a webcam.” Ben explains on his blog, “But where’s the fun in that?”

Twilight Zone pinball wizardry

After researching how the dot matrix receives and displays the score data, Ben and Zach figured out how to fetch its output using a 16-channel USB logic analyser. Then they dove into learning to convert the data the logic analyser outputs back into images.

Ben North Raspberry Pi Twilight Zone Pinball

“Exploring in more detail confirmed that the data looked reasonable. We could see well-distinguished frames and rows, and within each row, the pixel data had a mixture of high (lit pixel) and low (dark pixel).”

After Ben managed to convert the signals of one frame into a human-readable pixel image, it was time to think about the hardware that could do this conversion in real time. Though he and Zach were convinced they would have to build custom hardware to complete their project, they decided to first give the Raspberry Pi a go. And it turned out that the Pi was up to the challenge!

Ben North Raspberry Pi Twilight Zone Pinball - example output

“By an amazing coincidence, the [first] frame I decoded was one showing that I am the current Lost In The Zone champion.”

To decode the first frame, Ben had written a Python script. However, he coded the program to produce a score live stream in C++, since this language is better at handling high-speed input and output. To make sure Zach would learn from the experience, Ben explained the how and why of the program to him.

I talked through with Zach what the program needed to do — detect clock edges, sample pixel data, collect rows, etc. — but then he left me to do ‘all the boring typing’.

Ben used various pieces of open-source software while working on this project, including the sigrok suite for signal analysis and the multimedia framework gstreamer for handling the live video stream to the Raspberry Pi.

Find more information about the Twilight Zone pinball build, including a lot of technical details and the code itself, on Ben’s blog.

Worthy self-promotion from Ben

“I also did an FPGA project to replicate some of the Colossus code-breaking machine used in Bletchley Park during World War II,” explained Ben in our recent emails. “with a Raspberry Pi as the host.”

Colossus computer Twilight Zone Pinball

The original Colossus, not Ben’s.
Image c/o Wikipedia

As a bit of a history nerd myself, I think this is beyond cool. And if, like me, you’d like to learn more, check out the link here.