Raspberry Spi


Home

A break room ping-pong sensor

What it does

We needed a way to quickly know whether or not someone was playing ping pong in the company break room, so we created a sensor that would listen to the ping pong table, and report to a website it's current status: in-use or available.

website

How it works

A Raspberry Pi with a USB-attached microphone records 3 seconds of audio, analyzes it, and repeats.

diagram

In order to analyze the sound, I created a gem that can be used to break a recording into a set of frequencies using a Fast Fourier Transform algorithm called FFTW3. The resultant frequency set is then compared to sample ping pong ball strikes that we gathered previously. If the frequencies are within an acceptable margin of each other, then we consider a hit to have taken place.

frequency graph

Suspected "hits" were recorded in a database, from which a rails application hosted on the Raspberry Pi displayed the table's in-use status, which was determined by whether or not a sufficient amount of hits occurred in the last minute or so. Everyone on the company network could view and use this information as needed.

Results

The accuracy of the detection algorithm and the auto-updating site enabled this project to be a huge success around the company. A noteable percentage of our coworkers used and relied on this service, which probably saved the company thousands, if not millions of man-hours over the lifetime of the Pi.

Unfortunately, however, ping pong is a brutal sport. The server was eventually lost to the intensity of the game some months after launch, when the USB ports were yanked out.