Here I describe my current implementation of CessLight. It has been tailored to my needs, so the number of red lights and the logic to check room engagement.
If you want to use it for your needs, it is likely you will have to modify the hardware and/or the software.
This is my workplace restroom (I think it is a very common arrangement). It is compound by:
- A common room with one sink, that is the main entry to the toilets.
- A room for the man's toilet.
- A room for the woman's toilet.
![]() |
| My restroom |
I want to check them separately: I want to know whether the man's, the woman's or the common room are engaged. Let us call them, respectively, M, W and C.
Let us call their doors, respectively, Md, Wd and Cd.
This led me to put three red lights: M, W and C, as shown here:
![]() |
| CessLight's LEDs, buzzer and connector |
Please note that this is a prototype and is still experimental. Sometimes I modify the circuit by adding components to test new features. This is why it is built on a stripboard and looks very ugly.
And yes: the green LEDs are fake: I did not have the time to make a shot showing all the LEDs on!
Problem 1: How can you determine if there is someone in M or W?
Currently I solved this by magnetic contact sensors, the one used for home anti-theft devices:
![]() |
| A very common magnetic contact. |
Logic is very simple: M is engaged if and only if Md sensor is triggered (also apply to W).
For this reason, the door of M or W must be kept close if and only if there is someone inside.
This logic has a drawback: when you are in you usually keep the door closed. But keeping the door open when nobody is in is not a generally accepted behavior. A lot of people would find this an impolite practice.
More advanced solution can be found. I decided to replace this with another method, but I will uncover this later. The point to me is that this is the cheapest solution.
Let us call the two sensors Mm (Man magnetic contact) and Wm (Woman magnetic contact).
Problem 2: How can you determine if there is someone in C?
I did not want to use the aforementioned approach for C. This is because usually a bathroom door is kept closed at any time, except to enter and exit, of course.
Since I had a spare infrared sensor, I decided to use it for this purpose:
| A Passive InfraRed (PIR) sensor. |
This is the logic: C is engaged if and only if its PIR sensor is triggered.
Let us call this Cp (Common PIR sensor).
Rationale: if there is someone in C, she should be moving, triggering Cp. Again, this have a drawback: sometimes one moves very little (e.g. while brushing her teeth) and this causes C to appear disengaged.
Rationale: if there is someone in C, she should be moving, triggering Cp. Again, this have a drawback: sometimes one moves very little (e.g. while brushing her teeth) and this causes C to appear disengaged.
Even at maximum sensitivity, such sensors are not able to read small movements, because they work by measuring differences of IR detected by two adjacent regions.
One thing I did to mitigate this is to add a monostable timer to the sensor: C red light will be off only five seconds after the sensor is no more triggered.
This was applied to Mm and Wm sensor as well. See Lights Logic.
Again, there is a better (and more costly) solution I plan to adopt. But I will reveal it only after having tested it.
Problem 3: How can you determine if there is a bad smell in the bathroom?
This is a very nice feature and not really easy to implement.
I searched for some information about this topic on the Internet and I could not find enough.
Maybe I missed something important. If you know a better way to do so, please contact me.
In Odor-Based Incontinence Sensor they used an array of 4 gas sensors (targeted at different gases).
I copied the idea by using two gas sensors: Figaro TGS 2602 (air contaminants) and Figaro TGS 2611 (methane). Both of them make sense, since methane is often present in human "back-produced" bad smell (someone told me that only 33% of men produce methane, but my statistic are about 90%).
I copied the idea by using two gas sensors: Figaro TGS 2602 (air contaminants) and Figaro TGS 2611 (methane). Both of them make sense, since methane is often present in human "back-produced" bad smell (someone told me that only 33% of men produce methane, but my statistic are about 90%).
Let us call them Go (Gas sensor: organic) and Gm (Gas sensor: methane).
I have been testing them for two weeks. They proved to be sensitive to the substances of the bad small.
I have been testing them for two weeks. They proved to be sensitive to the substances of the bad small.
Unfortunately, the air contaminants sensor is too much sensitive to alcohol. This means that is triggered by just ashing your hands with the hygienic products that are in fashion after Avian influenza.
I decided to employ two different sensors also to have a better filter over false positives. I am currently experimenting them in my restroom in order to find an algorithm to better discriminate between good and bad smells. Currently CessLight turns yellow light on if one of the two sensor reports a value above a predefined threshold (respectively To and Tm). This gives a lot of false positives and negatives. I definitely have to improve it.
Installation
Installation
This is very simple:
- M light is on if Mm is closed.
- M light is off five seconds after Mm is open.
- W light is on if Wm is closed.
- W light is off five seconds after Wm is open.
- C light is on if Cp reads a movement.
- C light is off five seconds after Cp does not read a movement anymore.
- Green light is on if and only if no red light is on.
- Yellow light is on if and only if (Go>To or Gm>Tm)
Points 2 and 4 are to allow stepping from M to C or from W to C without turning the green light on.
Otherwise, when a man exits M (or a woman exits W) the M red light immediately turns off but C red light is not still on because he has to intercept one of the rays of the PIR sensor.
This would turn the green light on for some seconds and has been perfectly eliminated by the 5 seconds timeout.







