Occupancy detection

I would like to detect when a bathroom privacy door is in locked state or not (in order to know if it is occupied). What is the simplest sensor that can be used for this?

Simple level switch that is pressed when the lock is engaged.
https://www.digikey.com/products/en/switches/snap-action-limit-switches/198?k=lever

In my students' flat we'd look at the window above the door - is there light shining through that window, it's occupied. Works great - until someone forgets to switch off the light.

But back then of course Arduinos didn't even exist yet :slight_smile:

wvmarle:
In my students' flat we'd look at the window above the door - is there light shining through that window, it's occupied. Works great - until someone forgets to switch off the light.

But back then of course Arduinos didn't even exist yet :slight_smile:

well, there was one......

I see the question asks for the simplest sensor.....

do we only discuss sensors ? he did not ask about what to do after sensing.

and although the only sensor actually offered was not the simplest, it was electronical in nature.

although not inexpensive, this is actually simpler, IMHO, because it does not require any exterior wiring.

also, it appears we have jumped to the assumption (rightly so) that since he posted on an Arduino forum, he would like to have some electronical devices.

Yory, can you offer more details of what you want ? a simple light that goes on and off with a sensor like Crossroads posted would require wire, a power source and some indicators such as an LED,

I can see that one might want to connect to an Arduiono or something and find our from a distance what the status was.

Thanks for your responses. Someone has a tendency to spend too much time in the bathroom (toilet and shower) and the goal of our project is to automatically report the time for which the bathroom has been occupied and also give periodic reminders if someone is in the bathroom for more than some period of time. We cannot depend on the person to set a timer as they are likely to forget. Using the light is also not a good indicator as it may be left on when not occupied (but this is the second best option).

you could use a PIR sensor but that only detects movement
an alternative is a thermal sensor such as the Omron D6T

Kill two birds with one stone. Fit a timer switch to the bathroom light. If someone spends too long in there, they get plunged into darkness. If they are quick, the light switches itself off.

PaulRB:
Kill two birds with one stone. Fit a timer switch to the bathroom light. If someone spends too long in there, they get plunged into darkness. If they are quick, the light switches itself off.

Nah, that's dangerous... but you can make it blink on and off annoyingly. Or you could sit everyone down and talk about it like adults...

aarg:
that's dangerous...

Nah, it's just a well known phrase. No real stones are thrown. No birds are actually harmed.

We used a bucket of cold water..... Problem never arises a second time. More fun too .... :o

How about having a magnet attached to the locking mechanism, that will close a magnetic reed switch (of the type used in security systems, and hence readily available in convenient door-frame mounting variants).
Or a magnet and hall effect sensor.