Internet of Things toilet

There are many things that happen in my bathroom which I wish to keep private. But over at Instructables, member e024576 (about whom all we know is that he’s male and aged 59 – judging by the accent he uses in the video below when he runs out of loo-roll, he’s also from somewhere in the lower half of the USA) has been able to power through any bathroom-related shame to work out what toilet events can be usefully hooked up to the cloud without causing any personal embarrassment, all with the potential for making your toilet experience smoother, more environmentally friendly and less fraught with worry that the paper might have run out.

Why? Because he can.

Flushed with success

Flushed with success

I still wouldn’t use e024576’s loo, but that’s just me.

e024576 says:

How does it work? – An aquarium liquid level sensor float switch detects toilet tank level; flushing lowers the level closing the switch. A photo cell located in socket (blind hole) of the toilet paper holder spindle mounting arm detects when the spindle is removed to change out the toilet paper (letting light hits the photo cell, thus “closing the switch”).

Signals from these two sensors are sent (wirelessly – despite what the intro photo implies) via a hacked two button key fob; that is, sensor switch closure effectively pushes a button. A 315 MHz receiver module connected to a Raspberry Pi receives switch closure signals.

The Raspberry Pi, using Python API gspread, transmits the event data to Google Drive spreadsheet.

See system layout image.

How hard and how much $ ? – Assuming you already have a Raspberry Pi, and you know how to load and run Python programs, and can build basic electronic circuits – this is pretty easy & quite inexpensive (< $40) IoT (Internet of Things) project.

Why do this? – (1) To explore IoT on the cheap, and (2) because I can.

Here at Pi Towers, everybody is shouting about their own improvements to the system – which start with working out how to signal that the toilet paper is about to run out *before* it actually does. Someone who will not be named suggests encouraging the saving of water with a display that flashes “If it’s yellow, let it mellow. If it’s brown, flush it down.” And we think that electrifying the handle would be a great prank – combined with OpenCV, perhaps, so the toilet could give out worse shocks to people whom it doesn’t like. The possibilities are endless.

If, for no particular reason I can make out, you want to try to emulate this project yourself, you can find full instructions over at Instructables. Thanks e024576 – if you get in touch to let us know what your real name is, we’ll add it to this post!


james avatar

A fellow hi-tek red-nek.

Mike Redrobe avatar

What, no “toilet seat left up” sensor / alarm ?!

Patrick avatar

This is ridiculous.

However, I like mechanic of how this works, especially the ability of storing data in the Cloud.

Thanks for sharing !!!

Alex avatar

Maybe he could also hook up the Sensorof an optical Mouse to get more accurate data of the paper usage

Liz Upton avatar

You could measure the rotations the roll makes, and find out how much paper people are using. Magnificently invasive.

AndrewS avatar

Or you could spin the toilet roll backwards (like the odometer trick in Ferris Bueller’s Day Off) to make it look like you’ve used *less* paper than you actually have ;-)

Using the data from e024576’s spreadsheet (SO nearly mistyped that!) I wonder how constant the flushes:TP-replacement ratio is?

Steve avatar

And .. my wife said I should get a ‘job’ (I’m retired).. but Liz ain’t (U.S.A.. for Liz: Amn’t)

.. if I could only waste my days with as much thought .. err and effort

Chris Monaghan avatar

I’d love to account for the amount of paper each person in my household uses. Need to account for usage over time as the tube’s rotation will change as the diameter of the paper roll is reduced.

Roger G7RUH avatar


I guess that will mean that everyone in your house will have to have a wireless fob to open the toilet door so you can identify the user. To prevent misuse, you may need two factor ID.

A further step is to measure displacement of the pan water too, logging it in a league table, perhaps?

If you monitor roll diameter you will also need a look-up table of roll type and diameter as the soft rolls are shorter as they are thicker per sheet.

Is this enough to go on?

Mark Daniels avatar

Don’t measure rotations, count perforations and you could identify exactly how many sheets are used. Could be useful in divorce proceedings ;)

Carl avatar

There’s always someone that tears off 5 sheets with one tear and folds folds folds.. This might be a bit more tricky to account for?!

paul avatar

The fabulously beautiful planet Bethselamin is now so worried about the cumulative erosion by
ten billion visiting tourists a year that any net imbalance between the amount you eat and the
amount you excrete while on the planet is surgically removed from you body weight when you leave:
so every time you go to the lavatory there it is vitally important to get a receipt.

You only been a few mods ?

James Hughes avatar

I’ll approve anything with a H2G2 reference.

another dave avatar

Wiegh the toilet roll. Wiegh an empty roll. Tare it with the empty roll. When the roll is a third of the original wieght signal for new roll. Simples.

Helen Lynn avatar

Yes; mass is the way to go. I can’t fathom why the rest of them are wittering on about rotation and perforations and diameter. It doesn’t intrinsically address the differing length:mass ratio of different kinds of loo roll, but the other proposed solutions are all liable to variations on this problem too.

James Hughes avatar

But then you have to calibrate for different weights of paper – so the cheap slippery stuff we used to have at school vs thick velvety stuff you buy to stop friction burns.

Bryan Crotaz avatar

Don’t want to imagine how a strain meter would be used…

Alex_B52 avatar

Does a sensor able to measure how safe it is for me to go after somebody else ? An odor sensor or air density (sh**) stuff ? Upload it on a spreadsheet with an ID to identify the guy (data is data). This is probably an effective way to lose all your friends along the way.
And what about the three shells ?

Liz Upton avatar

Or a good old-fashioned methane sensor. (We’re currently building a fart-detecting project for the resources area which uses one: I predict it will be a hit with kids.)

Alan Williams avatar

Methane is a colourless, odourless gas, according to this site making up less than 10% of the volume of the gas in question.

I think you would actually want to detect the sulphides if you wanted to measure nasally perceived badness.

Where I got confused about this was with the agricultural references to the production of greenhouse gas by cattle. It turns out though that the methane they produces is expelled via burps.

Liz Upton avatar

Actually, that <10% is plenty for a methane sensor to get its teeth into; it works a treat. (Dave has also been able to demonstrate that you can set it off with a can of Lynx.)

u8nc avatar

..and all it takes to wreak havoc with the data is a visitor to replace a new roll with the paper hanging down at the back. – you know, young mums who have children who love to play with the roll by spinning it while they’re “on the job”

Uploading to a spreadsheet doesn’t really do anything useful beyond analytics. It would make more sense for the Pi to be more centrally located and monitor pantry and refrigerator restocking patterns so the toilet paper finds its way into a meaningful shopping list. If the pi could scan the specials online at a number of alternative supermarkets it could then compile the lists for each stop shop in the order that you come across them according to their aisle layout.

Technology now does our living for us.

Sudarshanarao duttaluri avatar

Awesome !!!

Ken MacIver avatar

Add a rotation sensor from Lego mindstorms with algorithm to translate revolutions to available remaining bathroom stationery based on a spiralling algorithm..

All clear signal
Elapsed time since last occupancy with a Bayesian filter that increases all clear time based on the ‘dwell’ time of the previous incumbent..

On a very serious point a less barking solution would provide an excellent activity monitor for a live alone individual. The Pi could learn normal patterns of behaviour\usage and raise an alert\alarm to a remote carer..

Ashley Buckingham avatar

Could you rig the toilet roll holder to get the measure the weight of an empty loo roll (within a margin) and then once the weight of the roll hits that margin, it prompts you to replace the roll?

Also, could you place sensors near the back of the toilet to measure “Accuracy”?

Haggishunter avatar

Ah, all this discussion of how to measure what’s left on a bogroll. Surely the easy way is to switch to a folded paper dispenser and mount an infrared LED-detector pair across, err, lower part of the paper holder.

Come to think of it, you could do something similar for a roll holder, but it’d be harder to make it reliable.

Arthur avatar

Finally /flushdns has a meaning :P

Comments are closed