0

[question] Best way to detect if a door is locked?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

[question] Best way to detect if a door is locked?

by markg85 on Fri Sep 13, 2019 6:24 pm

Hi,

First of all, i'm not at all sure if this is the right sub forum. There is so much that could fit. Please move this topic to the right subforum if this one turns out to be inappropriate.

I'm trying to think of a system that can reliable tell me if my door is locked.
Note the word "locked"! I don't mean the simple magnetic door sensors that basically tell you if a door is open or closed. I specifically want to know if the door is locked.
I want to add this knowledge to my house to be able to get a notification that i forgot to lock the door when i'm away from home and didn't lock it.

For this to make sense, you might need a little more information about the type of door lock i have.
The door in question is an apartment door, the lock looks like this (just to get the idea):
Image

So there is a hinge part and a solid steel lock part which is controlled by a cylinder lock.

I do know of the wealth of "smart door lock" tech out there, but i have 2 kinda big problems with them.
1. Despite the name, they only tell you that the lock mechanism is extended. If the door is open and extended it counts as "locked" to them, which it obviously isn't. Some then add in a magnetic sensor too to detect if it's open, but that kinda ruins the looks with ugly sensors.
2. Surprisingly few systems work on a cylinder lock and those that are working for them are either stupidly expensive or really ugly or both.
3. I don't want to automate my locking mechanism (yet), i merely want to know if it's locked.

For the above reasons they just are not an option for me.

Now i want to know when the cylinder controlled part is fully extended in the door side. Thus the door being locked.
And which kind of sensors i might want to use for this.
The only requirement i have is that nothing on the door itself can change. No electronics or extra holes there. The door frame is where the tech would need to be placed in. The room i have is about the size of 3 arduino trinkets stacked on top. I can make the gap bigger, but i really do not want to do that. The room i have allows me to use a trinket or an ESP8266. The power for it is not a problem as there is one tiny very convenient hole right in the frame leading to another room from where i can power it.

I already have some ideas for this on which i'd really like your input on to see if this would work. Or more ideas that i haven't even thought of. Everything is welcome :)
The ideas i have thus far:
  • In the door frame, right underneath the place the iron lock slides in. There i would put a Time Of Flight (TOF) sensor pointing up. If the door is open the max distance would be read (the height of the hole for the lock part and for the hinge part). If the door would be closed, but not locked, the height would be slightly less. If the door would be locked the height would be close to 0. This was my initial first idea. It would work if the place where the lock and hings fall in would be one hollow section in the frame. It turns out that isn't the case. It's hollow only for that specific piece of iron to fit it. This can still work but then would only detect locking. If it were one hollow area it would also be usable to detect a closed door (not locked). I can hollow out the frame there to make this work, but i prefer not to do this. Also, the TOF sensor while small is still quite large to fit in that hole. I'd have to resort to desoldering it or making a custom smaller pcb. Both are steps i really don't want to do. Yet.

  • Using a hall effect sensor where the locking iron itself might already be magnetic enough to trigger it (doubtful though). If not, then i need to sticky glue a strong tiny magnet on it. That is still feasible. Within the door frame i would then put the hall effect sensor. This basically is the simple door switch sensor just in a much smaller form and completely out of sight. This could work, but i'm not sure how strong the magnet would have to be. If that's more then - say - 3mm thick then it might not fit in the frame hole anymore. Or i would need to hollow out the frame deeper. This is possible, but not a route i prefer either.

Those are the options i can think of now that could work..
Are there any other sensor combinations that will give me the same result but with less hassle?

I'm looking forward to all of your ingenious ways to tackle the same issue :)

Cheers,
Mark

markg85
 
Posts: 4
Joined: Fri Sep 13, 2019 4:50 pm

Re: [question] Best way to detect if a door is locked?

by dThirteen on Fri Sep 13, 2019 10:13 pm

My experience with reed switches is the magnet doesn't have to be very strong. I am in Australia and I have used this part https://www.jaycar.com.au/miniature-glass-reed-switch/p/SM1002. You could probably pot something like this in epoxy to give it some resilience.

A simple microswitch that is operated by the tongue of the locking bolt is probably the simplest solution. For example https://www.jaycar.com.au/spdt-125v-3a-sub-miniature-micro-switch-with-lever/p/SM1036

dThirteen
 
Posts: 5
Joined: Tue Aug 27, 2019 6:20 pm

Re: [question] Best way to detect if a door is locked?

by zener on Sat Sep 14, 2019 12:07 am

There are probably several ways you could detect the lock bolt. Here is something similar to your first idea, just simpler and less expensive. You possibly could use it either to detect the bolt itself, or the lack of the bolt:

https://www.adafruit.com/product/2349

zener
 
Posts: 4414
Joined: Sat Feb 21, 2009 2:38 am

Re: [question] Best way to detect if a door is locked?

by adafruit_support_bill on Sat Sep 14, 2019 7:07 am

The reflective sensor idea is a good practical one. We have a smaller version of those sensors here: https://www.adafruit.com/product/3930

Inductive proximity sensors are another good option. You can find reasonably priced ones from suppliers of 3D printer parts. They are used as bed-leveling sensors.

adafruit_support_bill
 
Posts: 74334
Joined: Sat Feb 07, 2009 10:11 am

Re: [question] Best way to detect if a door is locked?

by markg85 on Sat Sep 14, 2019 9:22 am

dThirteen wrote:My experience with reed switches is the magnet doesn't have to be very strong. I am in Australia and I have used this part https://www.jaycar.com.au/miniature-glass-reed-switch/p/SM1002. You could probably pot something like this in epoxy to give it some resilience.

A simple microswitch that is operated by the tongue of the locking bolt is probably the simplest solution. For example https://www.jaycar.com.au/spdt-125v-3a-sub-miniature-micro-switch-with-lever/p/SM1036


That was my very first attempt!
While that does work, i'm very space constrained. I have tiny strong magnetic discs of 10mm in diameter and 0.8mm thickness.
For that to trigger the reed switch the magnet needs to be within millimeters of it. That's quite precise for something as crude as a door. But it does work for the bolt.
It's not so easy to get it to work for the hinge because of the shape that metal has giving not much room to glue a magnet on. This does complicate the magnetic sensing quite a bit.

I might need to play a bit more with this method to see if i can get it to work reliable..

zener wrote:There are probably several ways you could detect the lock bolt. Here is something similar to your first idea, just simpler and less expensive. You possibly could use it either to detect the bolt itself, or the lack of the bolt:

https://www.adafruit.com/product/2349


Ha :)
That sensor is way too big to fit in the frame.
I was thinking about this sensor: https://www.adafruit.com/product/3317 and then on a smaller PCB. I already have that one https://www.amazon.co.uk/SODIAL-VL53L0X ... B075LHC51D It would be ideal if that PCB size could be half of what it is in that amazon link. Which i think is possible if i look at the components. But then again, i'm not adventurous enough (yet) to design my own PCB. If i go that route i might never get it done and probably just lose interest.


adafruit_support_bill wrote:The reflective sensor idea is a good practical one. We have a smaller version of those sensors here: https://www.adafruit.com/product/3930

Inductive proximity sensors are another good option. You can find reasonably priced ones from suppliers of 3D printer parts. They are used as bed-leveling sensors.


Thank you for the inductive proximity sensor idea, that would have been the most ideal version if i had the room in my frame :) Those sensors are quite large so i'm afraid they are just not an option.

Looks like i should either figure out if i can get the VL53L0X sensor to work. Sensing range won't be much of an issue as the max range it needs to cover is just about 10 centimeters. It can handle that with ease. But making that sensor fit in the frame quite the challenge!

markg85
 
Posts: 4
Joined: Fri Sep 13, 2019 4:50 pm

Re: [question] Best way to detect if a door is locked?

by adafruit_support_bill on Sat Sep 14, 2019 9:41 am

Reflective IR sensors come in many different form-factors. Some are quite tiny. https://www.sparkfun.com/datasheets/Rob ... 113.GR.pdf

adafruit_support_bill
 
Posts: 74334
Joined: Sat Feb 07, 2009 10:11 am

Re: [question] Best way to detect if a door is locked?

by zener on Sat Sep 14, 2019 4:35 pm

Since the bolt is metal maybe you could use these:

https://www.adafruit.com/product/394

zener
 
Posts: 4414
Joined: Sat Feb 21, 2009 2:38 am

Re: [question] Best way to detect if a door is locked?

by markg85 on Sat Sep 14, 2019 5:19 pm

zener wrote:Since the bolt is metal maybe you could use these:

https://www.adafruit.com/product/394


Oh this is funny :)
I click the link and the first thing i think: "uhm.. does he want me to drill a hole into that bolt?..." It looks a bit like a drill.
Then i went on reading it and am like: "ohhh, it's some form of switch!"

These could work too, but i'm a bit afraid of their size. The length the bolt goes into the frame is only about 10mm.
So for that reason i think those are not an option in this specific case.

markg85
 
Posts: 4
Joined: Fri Sep 13, 2019 4:50 pm

Please be positive and constructive with your questions and comments.