Hack Day 2017: Revolutionising the Office Facilities

As Ian mentioned in his blog post, each project in this year’s Hack Day needed a physical aspect to it. Our two man team decided to tackle a serious problem in the Caplin office and revolutionise the office facilities all at once!

The Problem

We have a problem in the Caplin office as there are a lot of staff and only two toilet cubicles, so when you head to the loo you’re often greeted by the sight of all red locks.

Our grand plan was to add lock sensors to the cubicle doors, so that you know in advance whether they’re free or not. No longer will you have to leave your desk only to find that both cubicles are occupied, instead you just check out the handy webpage!

Toilet free
Toilet engaged

The main physical component for the project was the door lock sensor, and finding something suitable was tricky as we had three somewhat conflicting requirements:

  • Wireless transmission (there are no Ethernet sockets in the toilet)
  • Battery powered (we don’t want power sockets and cables in the toilet)
  • Long battery life i.e. months (nobody wants to have to change the batteries every week)

Fortunately we managed to find something that fit the requirements perfectly as INGICS makes the iBS01H Sensor Beacon, which combines a magnet sensor with Bluetooth Low Energy, and lasts for 3 years on a couple of CR2032 batteries! With a magnet attached to the door lock bolt, the sensor would trigger whenever someone slid the bolt over to lock the door, and broadcast the state over bluetooth.

Building It

The next step was to create a working model of the Caplin toilets for testing. As it was December we decided to go with a Christmas theme:

Physical components used:

  • Two model toilets
  • Two Bluetooth magnetic sensors (the black devices stuck next to the model loos)
  • Some cardboard, wrapping paper and tape

With our test model ready we started coding the cubicle status monitor. As web developers we decided to write everything in Node.js, and we ended up with a few key modules:

  • Bluetooth Repeater – reads sensor’s binary Bluetooth data using the noble library + forwards over WiFi to the Server
  • Server to publish events to the clients:
    • WebSocket for real-time cubicle updates
    • REST API to query the current cubicle state + metadata
    • Writes data to a Mongo DB for historical data + analytics
  • Cubicle status webpage  
    • Using ReactJs + REST and WebSocket APIs
    • Displays when a toilet is occupied  
    • Displays toilet usage facts and analytics (probably a bit overkill for a toilet monitoring system but it’s Hack Day so why not!)


Everything came together pretty well, and the sensors worked amazingly. We had some issues with the bluetooth stack on OSX (it wouldn’t reliably receive sensor updates) but our Windows and Android devices were perfect. With everything running the webpage we built updated in real time, and you can see pictures of the displays at the start of the post.

Of course no toilet monitoring system is complete if you don’t integrate it with Slack, so we created toiletbot to respond to people’s toilet related questions. It did a basic keyword match on sentences to answer things like “is the toilet free?” and “when is the busiest time?”:

And with half hour free at the end we also threw together an OSX status bar indicator using BitBar.

So that was 24 hours give or take, with a few hours sleep in between to complete Hack Day 2017, and our toilet monitoring system came 2nd place!

Leave a Reply

Your e-mail address will not be published. Required fields are marked *