What is the best way to detect lock/unlock of door with SparkCore?

I have written door open detection for Spark Core already.
Now I’d like to make a code and scheme for detecting lock/unlock door in my house.
Because I forget if I have locked the door or not every time. I go back to my house to check the door after I left the house… I think this is waste of time…
Could you give me suggestion to make lock/unlock detection with SparkCore?
Door locks in my house are below

1 Like

wouldn’t you be able to put two wires in the hole where the bolt goes, so that closing the bolt closes the circuit? (with the bolt?).

I am assuming the bolt is made out of something conductive?

I think it would be pretty easy to drill a small hole in the end of your deadbolt “bolt” and epoxy a small neodynium magnet in there. Then put a low cost magnetic reed switch in the deadbolt hole in the door jam. The wires can be run up and over to a control box where your spark core resides. The same idea can be used for a concealed and tamperproof way of detecting if your door is open or closed as well.

A magnet and reed switch in the deadbolt hole is great but if you have a hardened deadbolt you might find it hard to drill.

I have a used a microswitch in the deadbolt hole for this job but in either case it is hard to work inside the wall.

At first I was also thinking a magnet on the deadbolt lever, possibly on a little bit of an extension so it swings down near a reed switch on the door jam… but that just seemed too janky.

You MIGHT be able to get away with putting a magnet on the tip of the deadbolt without drilling. Especially if there is a little space in your doorjam frame already… if not it’s easy enough to drill it out. It wouldn’t be TOO bad to drill a hole through your Door jam TRIM that would give you access to the deadbolt hole in just the right spot in the back. Then slip your magnetic reed switch down in there, possibly gluing and double stick taping it in place.


A little bigger diameter would be better for positive activation of the reed switch, but it can’t be any thicker than the gap you have between the striker plate and deadbolt as the door closes.

And the switch should be oriented to the side of the magnet because reed switches work best when you line up the North to South axis parallel to your switch axis as you see it in this picture:


And there just happens to be enough space to the side of the deadbolt hole for this, as the deadbolt is usually flattened on one side, and the hole is … you know, round and bigger. You can even tuck the wires under the striker plate. See there’s tons of room up the side wall that I’m not even using by just putting this in there to show the relative size of things.


I like how the Lockitron guys do it as well… also an interesting approach. You could run power across your door hinge side of the door if you didn’t want to use batteries. Just put a large “service loop” in your wiring so it won’t stress the wires over time and break.

Here is the kind of thing I have used:




I just search for this link–no affiliation or experience with this vendor who is in Europe apparently.

What about a small reflectance sensor on the door jam pointing at the thumb lock mechanism. When the thumb lock is in one position, no reflection occurs and vice-versa in the other position. :smile:

Thanks @TheNirEast, @bko, @BDub and @peekay123.
I will try your ideas when I am convenient.


Instead of using a reed switch, you can do everything in the jamb by using a hall sensor. The metal of the deadbolt will change the magnetic field of the magnet by a small amount which you can detect with a ratiometric hall sensor…