Electronic – arduino – Solution to detect key present in door lock

arduinosensor

What would be a good way to detect whether a door key is present in a door lock (type: pin tumbler lock) at the outside of the house ? The idea is to be alerted when one forgot his keys in the lock.

I am thinking of some electrical/electronic sensor or solution that I can hook up to for example an Arduino (which would then alert me when a key is present in the lock for e.g. more than 5 minutes).

Requirements wishlist:

  • The most practical solution would not need power and have a simple open/closed contact that I can poll periodically using Arduino. An open/closed contact would have the (marginal) added advantage of being able to put several sensors in series (for multiple doors).
  • The state of the lock (locked or unlocked) is not relevant.
  • The actual act of inserting or withdrawing the key is not my primary interest, although it could be used as a stateful (i.e. would require keeping state) workaround solution.

Non-optimal sensor methods considered:

  • I've considered a light beam sensor monitoring the door entrance at key height (cons: needs power, and requires installation at the outside of the house),
  • small inductive sensor next to lock (cons: needs power, will be very visible, requires drilling a hole in the door).
  • Some home made sensor could maybe be a wire wounded round the lock to create a coil (if that would be possible, space-wise) which would presumably have a different inductance based on a key being present or not. However, I am not sure about the required circuitry for the latter.

Any ideas?

Best Answer

Depending on the type of your door and key, you might have some success with inductive measurement from the inside. If your door, lock, and cylinder are mostly diamagnetic, and the key is ferromagnetic , you can measure a change in inductance of an inductor mounted on the inside of the lock when a ferromagnetic key is inserted. This should work for paramagnetic keys as well.

If your key is ferromagnetic, you might successfully magnetise the key and measure the inducted electromagnetic field when the key is inserted.

If the door cylinder is useable from both sides, you might insert a pin into the lock from the inside that will be moved when a key is inserted on the outside. Not a good idea because it might possibly damage your lock, though.

A totally different way would be to force people to put their keys on a specific hook, and alert if the key is not there.

Or make the door keyless.