Hot's Pizza Payphone
A Raspberry Pi inside a payphone at Hot's Pizza in Chinatown. Dial a combo, press #, and hear whatever's mapped to it.

The Raspberry Pi-powered payphone mounted outside Hot's Pizza in Chinatown.
How a payphone ended up at Hot's
My girlfriend works at a design firm with the owner of a bar called Little Canal. At a party one night, the owner told me she was opening a pizza joint down the street, that she wanted to put up a payphone, and that she'd love it if it were interactive.
Oh ho ho. I didn't get a degree in mechatronics for nothing. I love tinkering with Raspberry Pis, so I told her I'd build it.
Pick up, dial, press #
Pick up the handset, dial a sequence, and press #. If the sequence matches,
its sound starts right away. If it doesn't, you get a try-again sound.
Different key combos unlock different sounds, but there is no cheat sheet beside
the phone. Finding them is the fun part. I'll give away one easy combo: 911#.
The rest are up to you.
The finished installation runs on a Raspberry Pi Zero 2 W. It decodes the
sounds and keeps them ready in memory instead of opening them from storage
after every dial. Press # and the result plays without a pause.




Mapping the keypad wires
The keypad comes out of the phone as eight wires, and each key connects one pair of them. So I wrote a script that asks you to hold each key, records which pair closes, and works out which wires are the rows and which are the columns. The answer was a 3×4 grid. The hook switch got a probe script of its own, which found the one pair of wires that connects when you lift the handset.
Why the beeps clicked
Each key plays its real touch-tone beep, two sine waves at once, for as long as
you hold it. The Pi does that by looping a short buffer. In the first version
that buffer was 120 ms, and it clicked every time it looped. 120 ms of 697 Hz,
the low tone for 1, 2, and 3, is 83.64 cycles, so each loop cut the wave
off mid-swing and jumped back to the start.
The fix is to make the buffer a whole number of cycles of both tones. For each
tone, the code finds the smallest number of samples that holds a whole number of
cycles, then takes the least common multiple of those two counts and repeats it
until the buffer is at least 120 ms long. At 22,050 samples a second, that's
exactly one second for most keys, between 143 and 500 ms for 5 through 8,
and 200 ms for the 350 + 440 Hz dial tone. The end of each buffer now lines up with its start,
so the loop no longer clicks. While a tone plays, whatever is playing behind it
drops to 40% volume.
The control panel
The browser control panel is where I change the collection. I can upload a file or record a sound, trim it, preview it, and assign it to a dial sequence.
It also shows us which combos people punch in most. If everyone keeps trying the same unmapped pattern, maybe we'll upload something for it ;)

The control panel handles upload, recording, trimming, preview, and dial-code mapping from one screen.
Recovering on its own
A payphone in a pizza shop has to recover without a keyboard or me standing beside it. Every two minutes, a watchdog checks that the audio service and the control panel are both alive. If either isn't, it restarts both, and after three failures in a row it reboots the Pi. If the shop's WiFi drops and no known network turns up within five minutes, the Pi starts its own setup hotspot, so someone can join it from a phone and point it at a new network. Updates pull the new code, run setup again, and put the backup back if the services don't come back healthy in time.

The dashboard's Keypad Debug and System Update cards.
Go try it
The payphone is at Hot's Pizza in Chinatown, 181 E Broadway B, New York, NY 10002, right across the street from Little Canal (same owner!) and just a stumble away from 169 Bar.
Go grab a slice, pick up the handset, and start with 911#.