Solving Bathroom Contention with MQTT: Atomic’s A2 Office Gets a PottyMon

It’s been nearly four years since Scott Vokes made the first version of the “Callaloo” bathroom occupancy monitoring system in our Grand Rapids office. As we grew in size and moved to a brand new building, I revamped and expanded the system to fit our new office. And now with our Ann Arbor office growing in both team and office size, it’s time that they got a Callaloo system of their own!

What Is “Callaloo”?

The bathroom monitoring system at Atomic has many names, including “Callaloo” and “PottyMon.” It originated in our old building at 941 Wealthy, where two of the three single-occupancy bathrooms were downstairs. Having a system to monitor and report on bathroom states (open or closed) saved plenty of trips downstairs and awkward waits for a bathroom to open up.

The Ann Arbor office is now in a similar situation—lots of new employees but an office layout that has the same issues as the old Grand Rapids office.

System Design

There are four bathrooms in the Ann Arbor office building. The status of each one can be open, closed, or unknown. We want to report the status of each facility in real-enough time over the company network.

Callaloo System Diagram

A server on the network will run a Go program that listens for the messages, then displays them on a webpage that is part of our company “radiator.”

The system uses MQTT, which is a publish-subscribe model. Each of the bathrooms will publish its status to an MQTT broker running on the server. The Go program (also running on the server) will subscribe to these statuses and then change its UI accordingly.


How is the open/closed status of a bathroom determined? We use a reed switch in the doorframe and door.

This switch is designed with flexible metal contacts. When a magnet is within a given proximity of the switch (usually within an inch), the magnet pulls one of the metal contacts down. This closes the circuit and allows electricity to flow through.

Reed switch
Wikimedia Commons (André Karwath)

The reed switches at Atomic are embedded in the frame of each bathroom door. A magnet is embedded into the top of each door such that when the bathroom door is closed, the magnet aligns with the reed switch and closes the switch.

For you EEs out there, the reed switch circuit also has a resistor in series and a capacitor to ground. This helps filter out any noise that might be picked up on the (long) lead wires.

The other main hardware components of the bathroom monitors’ is the ESP8266 dev board, which I used in my Stranger Things project and a variety of other projects. The ESP8266 board is essentially a small, wifi-connected Arduino. We also used power adaptors and lots and lots of heatshrink. The reed switches are recessed into the door and frame, and the (small) ESP8266 boards are hidden as well, so the system is hardly noticeable.


This project has two main software components. One is the software running on the ESP8266 boards–C with Arduino libraries. This program, running on each of the four bathroom monitors:

  • Connects to the wifi
  • Connects to the MQTT broker
  • Reads in the state of the reed switch (high or low)
  • Reports the status (open or closed) on the appropriate MQTT channel (i.e. “callaloo-a2/upstairs-east”)

The server has Mosquitto installed and has a Mosquitto broker running. It also runs “Dasheen,” which is written in Go. Dasheen was originally written by Mike English, and luckily, only minor updates were needed for the logic portion of the program.

Design update

Dasheen did get a pretty nice UI update, though.

Taylor Vanden Hoek created new designs for the Callaloo portion of our monitor. Now, the statuses reported by the bathroom monitors are displayed like so within the office:

A2 Bathroom Monitor Icons

Other help

A big thanks to Jonah and Kelly for coordinating the installation efforts, and to JK for solving some wifi connectivity issues in the office!