Raspberry Pi Restroom Monitor


Carbon8 has a good number of people. Carbon8 has one restroom. Necessity is the mother of all invention.

Over the past year, Carbon8 has experienced one major problem with our growth -- the number of people in the office keeps expanding and yet the number of restrooms remains the same (one). It doesn't help that the restroom is down the back hallway, so as we increased in numbers, it became more and more common for people to walk all the way through the office and down the back hall only to find that the restroom was occupied. The person would sigh and walk back to their desk because it's a little weird to lurk next to the bathroom door in a dark hallway. When this happened to the same person two or three times in a row, they could get downright cranky.

After near-constant harassment, courtesy of Lisa, I decided to fix the problem with technology. (As a side note, any problem can be solved with technology, be it procedural, social, relationshipinal, etc.)

First, I turned a Raspberry Pi into a small Apache web server.

Next, I connected a Teensy to a home alarm door sensor on our bathroom door. The Teensy is set up as a keyboard and runs a simple shell script to modify a text file every time the door's status changes. It simply reports "available" or "occupied". And yes, I could have connected the door sensor straight to the Pi, but I had to wait a week for the Pi to ship, so I did the Teensy part first.

Finally, I wrote a small .NET program that pings the Pi web server over the internal network every 5-10 seconds. This gives everyone an up-to-date view of the bathroom right in their system tray.

Restroom available

Restroom occupied

I also added a few extra features just for fun. If you are one of those people who gets distracted and forgets they need to use the bathroom, there's an "I'm Waiting" menu option. Click this when the restroom is occupied, and your computer will make a nice flushing sound when the bathroom door opens. We recommend using this only if you wear headphones, as people tend to laugh at you otherwise.

Additional options

The whole contraption lives in our network closet... in a dishwasher soap box.

Pi in a box

Someday, I plan to add a website to chart restroom statistics, including:

  • Average length of visit
  • Best and worst times of the day to use
  • Approximate wait time based on current usage, etc.
Jeff Robertson

Jeff Robertson is a digital marketer and an online development expert with experience stretching back to dial-up. He is partner and Chief Technology Officer at Carbon8, where he helps bridge the gap between the technical and marketing worlds, as well as oversees technical infrastructure.

share this