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?

  • 1
    \$\begingroup\$ The power requirements for the light beam sensor can be very low: you only have to briefly pulse (a ms or so) once every few seconds, so that's <0.1% duty cycle. I'm more thinking about the 5 minutes alarm condition. In 5 min you can be already far away, and then the alarm is of no use. I don't think the key should remain in the lock with the door closed for more than 10~20 seconds. \$\endgroup\$
    – stevenvh
    Commented Aug 29, 2011 at 9:32
  • \$\begingroup\$ @stevenvh: the issue is not so much the power consumption (which indeed I expect to be low), as well the power adapter and extra cabling etc. Concerning the alarm time: the key-in-lock issue only happens when entering the house, not when leaving. \$\endgroup\$ Commented Aug 29, 2011 at 9:50
  • 2
    \$\begingroup\$ Swing cover that you nudge aside with tip of key when inserting. Gives a positive indication which can be telemetered many ways. I could probably think of a dozen ways, so somebody is going to suggest a 'best' one. (My swing cover is positive but not elegant. ) \$\endgroup\$
    – Russell McMahon
    Commented Aug 29, 2011 at 11:33
  • \$\begingroup\$ Use a spring to force the key out after you let go of it. No need for a sensor that way. No power. No wiring. Simple is often better. \$\endgroup\$
    – user3624
    Commented Aug 29, 2011 at 12:46
  • \$\begingroup\$ @Rabarberski You've never locked the door and forgot the keys in the lock? It's something that can't be ruled out... \$\endgroup\$ Commented Aug 29, 2011 at 13:19

2 Answers 2


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.

  • 3
    \$\begingroup\$ Another idea would be to attach a RFID tag to the keyring an detect the presence of the tag. \$\endgroup\$
    – 0x6d64
    Commented Aug 29, 2011 at 12:59
  • \$\begingroup\$ @ox6d64: RFIDs crossed my mind as well. Might indeed be worth considering \$\endgroup\$ Commented Aug 29, 2011 at 14:14

Seems like the capacitance of the door knob alone, vs the door knob with key, would have to be slightly different. Not sure if it would be significant enough, but in principle if you made that capacitance part of an oscillator, there would be a frequency difference between having the key present vs not present.

  • \$\begingroup\$ fwiw, at a guess the frequency of any such oscillator would probably have to be rather high, since the capacitance of a door knob unit is probably down around a single picofarad. (considering the typical capacitances of tesla coil top-loads) \$\endgroup\$
    – JustJeff
    Commented Aug 29, 2011 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.