datadog3 min read

Curated summary

Restroom hacks

Read original(opens in new tab)

Datadog built an office bathroom-availability monitor to reduce contention without compromising privacy or existing door functionality. Raspberry Pi 2 devices, GPIO-connected sensors, and simple Unix tools provided a low-maintenance way to report whether bathrooms were occupied. The project showed that the hardest parts were adapting to varied real-world hardware, mounting sensors cleanly, and dealing with unreliable Wi-Fi—not writing software.

Project Goals

  • Avoid intrusive monitoring:
    • No cameras or sensors that could feel invasive.
  • Provide reliable occupancy information with minimal false positives and negatives.
  • Use door-lock status where possible as the occupancy signal.
  • Avoid interfering with existing locks and doors.
  • Keep devices secure, professional-looking, easy to maintain, and remotely updateable.
  • Treat the project as a fun hardware experiment.

Adapting to Different Bathrooms

  • Bathrooms differed significantly in:
    • Lock styles, including push-button handles and rotary stall locks.
    • Number of rooms or stalls.
    • Availability and location of power outlets.
    • Wi-Fi quality, especially near concrete walls and older electrical equipment.
  • These variations required different sensor designs rather than one universal installation.

Raspberry Pi and Sensor Hardware

  • Raspberry Pi 2 Model Bs served as the project’s controllers because they:
    • Ran Linux.
    • Supported Wi-Fi and SSH administration.
    • Were compact enough to conceal.
  • The team used several sensor types:
    • Magnetic reed switches for detecting door position.
    • Pin switches for detecting sliding stall-lock positions.
    • Photoresistors were purchased as a possible way to detect darkness but were not needed in the MVP.
  • For push-button locks, reed switches detected whether the door was open or closed. Although this could theoretically misreport a closed but unoccupied bathroom, it worked reliably in practice.
  • Stall-lock sensors were hidden inside hollow metal panels. Automotive-style pin switches were mounted using simple carved wooden blocks that contacted the sliding lock without obstructing it.
  • Wiring was concealed in wiremolding, with Raspberry Pis placed inside outlet boxes where possible.

GPIO and Unix-Based Monitoring

  • Raspberry Pi GPIO pins were accessed through files in /sys/class/gpio/.

  • A Python script read sensor values and translated them into bathroom availability.

  • Configuration handled differences between normally open and normally closed sensors.

  • The service was exposed through tcpserver and managed with daemontools.

  • A basic command-line client could query status with Netcat, for example:

    nc 11.bathrooms.datadog-internal.com 50
    

Making Availability Easy to Use

  • Employees could check status from the command line.
  • Some added bathroom availability to TextBar.
  • Datadog dashboards displayed bathroom status throughout the New York office.
  • The implementation required very little code; most effort went into sensor selection, physical installation, and network troubleshooting.

The project demonstrates that inexpensive, hackable hardware combined with simple Linux tools can solve a practical office problem. For similar systems, prioritize non-intrusive sensors, flexible installation designs, and secure remote management; the resulting software can remain remarkably small.

Continue with another curated summary.