A few of us Many have been working on a side project that we’ve aptly named Is the Toilet Free? Its purpose to provide an at-desk indication of whether a toilet is free in an effort to remedy that laborious walk to the loo only to find that they’re all engaged. Begone queues and awkward pre-poo chit-chat. (Some of many struggles at MxM.)

It was an idea communicated simply as a website that could do this:

Fiona and Raffi began fiddling with a Raspberry Pi to see if they could come up with the bare essential hardware & software. From there (with my near-non-existent knowledge of electronics) I was able to extrapolate on what they had created to add a few more switches and LEDs. We soon had a circuit that resembled the end result. We prototyped…

And we had some software that updated the website. It worked brilliantly.

I designed a box to house the Pi and some strip LEDs that would sit on the wall outside the loo.

Thus far it had all been hacked-together prototypes so we needed to formalise what we’d done. I wrote some new software that in principle was: show a green light if there is at least one toilet free, otherwise show red. Then when a change is seen, log it and update the website. Ben and I ordered some components to create the V2 circuit, and tested it on a breadboard:

Then transferred and soldered it to some stripboard:

The circuit diagram:

(PCB coming soon…)

We fit it all in the box, and the DIY man had come to fit some reed switches on the toilet doors. He made a pickle of it. (Sorry DIY man if you’re reading this.)

Along the way we’d thought about what we could do with the data being logged. We knew in and out times, why not make some charts out of it? To debunk any upfront data uneasiness – because you might be asking “Why am I being recorded going to the toilet?” – privacy was our core concern; the light collectively represents the toilets’ state to prevent distinguishing one toilet from another. It doesn’t know who you are, and it’s not measuring your deposits or anything similarly absurd. Refer to Peter’s excellent toilet privacy guide for more.

Moving on though, we’ve been collecting data (rather inconsistently) for about 3 weeks, and composed some (hopefully reliable) SQL queries. Thanks to Dan and Raffi we can tell:

  • if the toilets are free
  • the total number of visits
  • minimum visit duration
  • maximum visit duration
  • average visit duration
  • total visits by hour
  • total visits by day

From which we can infer:

  • the favourite toilet
  • peak times
  • off-peak times
  • an estimated wait time

I created a command-line inspired stats page for the above:

Garold’s also made something that lives in a Mac OS menu bar:

It’s rather pointless but it’s all in the name of fun.

What’s next?

For now we’ll keep collecting data to see what other worthless knowledge we can assimilate. The software has gone as far as seems sensible, but it’d be brilliant to develop the hardware. The sign looks a bit pathetic (that bloody LED that won’t glue down!) and it’s all far from ideal. I’m trying to document as much of what’s been done so far however, because I’ve learnt a great deal and it makes sense to capture that and share it. The software is on GitHub should you want to look at it. There’s also a wiki that I hope will grow into a guide for making your own.

Raspberry Pis are brilliant; we were able to create Internet-connected hardware with very little. It’s empowering to say the least, and the barrier to entry seemed so small. For a project intended as a bit of fun, it’s certainly delivered. I’ve thoroughly enjoyed all of it. It’s been an excellent opportunity to explore new things that I’ll without-a-doubt pursue further. Personally I would love to see others’ attempts at something like this – you’re sure to have as much fun. We have a new project in the pipeline that you’ll be glad to know doesn’t involve fecal matter. Think solenoids and severed fingers.

I doubt we’ll ever track down the Phantom Switch Snatcher…

Big thanks to Paul S. And to our willing actors Nicki, V-Bee, Ben and Melissa.


If the toilet is a non-trivial distance away from some of the office seating, it would be nice to implement an anonymous count of who's currently pursuing the toilet after it becomes available. I can imagine a small group of people leaving their desks once one becomes available during peak hours.


perhaps you are aware of the coffee app cautionary tale? http://royrapoport.blogspot.com/2011/05/coffee-and-its-effects-on-feature-creep.html


Thus yet another tragic 1st World problem is solved!


Another very simple way to do this is with Twine http://supermechanical.tumblr.com/post/44307832453/how-to-quantify-productivity-with-twine
Quantify flushing toilets or the door.


So I assume then that you guys don't have problems with people closing the door after they leave which would trigger the stall to be marked as occupied. We made a similar thing where I work that did this a little differently to account for such cases. I'd also suggest determining a way of detecting stench to some level, it was super useful, there are sensors. Unfortunately because of our office situation we haven't been able to permanently install our device, so I'm a little envious.


Great Work! It is Nest for the restroom. Also, I believe you could this to companies with small restrooms. It will also help avoid awkward moments.


Good idea, i would suggest adding queue reservation. One could put a "reserve" buzzer which would put them in a waiting queue. A green would mean, the current person's can now go, where as if it is the only vacant one, it shows red for others. This would get a bit more sophisticated in terms of returning custom responses, (may be session id or something) for individual. Then it could start showing current estimated waiting time and might even show you id of vacant toilet along with green. It is a pretty interesting real world user application of many of abstract Computer science principles. In some ways (not entirely) could be related to Producer - consumer

Hugh Mason

Add foursquare style functionality and you can call it TwitShit. Social networking plus deep doxing into the medical records recently sold off by the UK government could let cubicle occupants know who sat there before them and what diseases they had. All in all, a web 2.0 Big Data Dump


I thought this article was going to be about how much each flush cost around the world,. I should've known better!

David Balatero



Love it!

I made something very similar with a Spark Core (https://www.spark.io/), lots of wire, some paper clips (which touch when the bolt is locked), post-it notes and gaffer tape. I should really get round to writing that up. Same single purpose site design (albeit only on our Intranet) but it has mobile apps and desktop notifications. Time for a pull request.

I was inspired by http://www.frisnit.com/telemetry/. Seems like this is a pretty common problem. :)

Is the mac app source code available? Can't see it on github.


It's been done over a decade ago: http://slashdot.org/story/01/09/02/0320223/mits-bathroom-server

Richard Stallman

Free as in beer or free as in freedom?

Sgt. Carter

You need to see "No Time for Sergeants" introducing Jim Nabors as Pvt. Gomer Pyle.


Well after someone leaves the toilet, it should show yellow and not green for a while :D
You could also add a sensor to evaluate the level of methane gas (aka fart) to inform if the toilet is usable/breatheble... just an idea!


So if I understand correctly, the system counts the times the door is opened and closed: 1st open/close = occupied, 2nd open/close = free. What happens if you open/close but don't use the toilet. Then it is marked as occupied but in fact it isn't, right? How to deal with that?


A very fun project, and thanks for releasing code (Interesting to see twisted.websockets being used)

But wanted to ask you to explain more about stats page, is it in command line, or just made to look like it? Can you put the code up for that also on github please. Thanks


Nice and fun project! in my small village, a bar called 'the red traffic light' installed a traffic light on the top of the toilet door. When the light is green the toilet is obviously free. Oh, obviously there are two lights (one with a female icon and the other with a male icon)!


I love it! I'd love to try and build something like that for our office shower room. I've never done any hardware hacking at all, any chance you'd be able to get in touch to talk more about it?


Could you add something to measure the collective weight of all visitors going in against the total weight when leaving?

Sean Neilan

Can you get another toilet or a bigger office?


Thanks for sharing! We have built a very similar device for our four shower cubicles to avoid queuing in the morning. It's a similar solution using a raspberry pi, with an ipad and web front end #officehacking

Reginald Smellsworth

I think smell is also an important consideration, it's not free 'til the smells gone.


It sounded an interesting and fun project when I read about it on HaD, then I followed the link and found an almost completely empty page.


What's the point of not hosting a single shit on your own fucking server ?


Reminds me of a hackathon project I worked on, but you guys took it to the next level :)


Neat Idea - any reason you chose a Raspberry Pi over an Arduino? Seems like the Pi might be more high powered than is necessary for this project.


Chris - I think we used the Pi because it was what we had laying around the office when I initially had some free time to get us going.


Great project :) Will you publish the Menubar application code also on github ? I'm trying to build one too, and I have a mac. So it would be awesome to have the Menubar too.

Tom (Intracto)

We had a similar, yet less complex, installation in our offices for a while now. It got featured on raspberrypi.org -- http://www.raspberrypi.org/guest-post-2-peeping-tom-in-the-toilet-with-raspberry-pi/


ustwo hacked together something quite similar: http://ustwo.com/blog/digitally-engaged/

Leave a comment

Required fields are marked. Don’t worry - we won’t do anything fishy with your email address.