How to Install the Foraker Bathroom Monitor

We recently moved offices here at Foraker, and with that move came our own private bathrooms. We have two new single-occupant bathrooms located down a short hallway just off of our common space. This layout is much better than a large public bathroom, but it does have one glaring problem: while sitting at our desks, we have no way of knowing if the bathrooms are occupied or not!

We would hate to take our headphones off and walk over to the hallway only to discover that both bathrooms are occupied, so we decided to use technology to solve this problem. Tom realized we could take advantage of our office StatusBoard for this task, which is prominently displayed in our open space area, and can also be pulled up on laptops and smartphones.

To achieve this, I wanted to use the ESP8266, a cheap yet powerful WiFi module that can be programmed using the Arduino IDE. I decided to use a board built on the ESP8266, the SparkFun Thing Dev Board, for the convenience of having a built-in USB-to-serial converter and other goodies.

If you are looking to solve a similar problem and have some experience with Git and Rails, here is a quick tutorial to get up and running.

Creating your own Bathroom Monitor

Hardware List (per bathroom):

You will also need straight headers, a soldering iron, and screws (if you would like to mount it to the wall).

Ready to build!

First, make sure you have your own StatusBoard set up; it is quick and simple to deploy on Heroku.

As a side note, you can also use your own API if you wish. Make sure it accepts a POST to api/bathroom_updates with bathroom_update[occupied] (sends a “1” for occupied, “0” for unoccupied) and bathroom_update[room] (integer) parameters.

That’s all we need to display our occupation status, next we need to set up the hardware.

The Hardware

The Thing Dev Board requires you to solder headers in its pins if you plan on prototyping on a breadboard (highly recommended). In fact, I used half-breadboards for each Thing and left them in the enclosure so I can easily make changes in the future without having to desolder anything.

Once you have the headers soldered on, connect the door sensor to GND and Pin 12. This is what everything should look like so far:

Either wire can connect to GND or Pin 12


Next, install the Arduino IDE. Follow the instructions here. I had to use the Generic ESP8266 board and edit the other values to their suggestions.

Now you can install the Arduino code on the Thing. You can copy the template from here. However, before you upload the Arduino code to the Thing you will need to configure it a bit. At the top of the program, change:

After making those changes, you are set to upload to the Thing! Check back here if you have trouble uploading. Open your Serial Monitor and you should see messages about connecting to your WiFi network. You can test that the door sensor is working properly by placing the magnetic half against the sensor; you should see messages about connecting to your URL and changing occupied status.


If everything is working correctly, it is time to place it all inside the enclosure! First, take the back half of the enclosure and drill two drywall screws through the plastic to hold it onto the wall (be sure to choose a location close to an outlet!). Remove the bottom pegs to allow room for the Thing and breadboard.

Run the wires of the door sensor through the top window and affix it to the doorjamb. Affix the magnetic half to the edge of the door. Plug the micro USB cable into the Thing and then plug the other end into the outlet. Place the cover on and you are all set!

This is what the finished product should look like:

All set! 🎉

Test it out by opening and closing the door a few times and watching your StatusBoard. The occupation status symbols should change color. If not, make sure the Thing has a solid blue light, indicating that it is successfully connected to the WiFi. Also ensure the two halves of the door sensor are close enough to trigger when the door is closed.

Celebrate! 🍻

Celebrate the fact that you will no longer hopelessly wonder if you are able to poop, and that your office is stepping into the future with IoT-connected bathrooms!

Want to build something cool with us, or perhaps interested in a bathroom montior kit to help you out? Drop us a line and we’ll be more than happy to help!

Tweet at Foraker

Share this post!