I said this NFC/keypad lock was going to have a number of uses, and it is. The garage door was the easiest as all I needed to do was simulate a button press. A loftier goal was to make something that fitted my front door. There were a number of rules.
- It must look professional. No dangling wires or bits duct taped to the back of the door.
- It must be possible to still use the normal key to open the door.
- Any electronic failure must mean the door can be operated normally.
As you can probably guess, the is the WAF (Wife Acceptance Factor), but to be honest I don't think these are unreasonable requests. So, how am I going to go about this? I have a "normal" UK lock or nightlatch on the front door. They work pretty well, but I think are a little trickier to attach a motor to that what appears to be a more common lock in the US - the deadbolt. What are my options?
An electric strike plate
You're probably familiar with these if you've ever been in an apartment block with a remotely operated door. It's not the lock that opens, but the strike plate that the lock connects to. It often operates with a loud buzz.
This would certainly do the job. I'm sure i could probably make it look reasonably neat, but ideally I'd like to run this from batteries. There's not really an easy way to neatly get power to my front door. I could do it, but it would mean a lot of messy DIY afterwards. These strike plates use a 12V solenoid which draws a fair bit of current whilst in the unlocked state. Not particularly battery friendly. It's an option, but one I'm gong to put to one side for now.
Adding a motor to a nightlatch lock
You know how sometimes you're drawn to the cooler but perhaps less practical option? Well, I think this is one of those times. Whilst looking at strike plates, I saw a nightlatch that looked reasonably chunky. I thought about a small gearmotor I had in the parts box. An idea formed in my head. Would it be possible to hide a motor an limit switches inside the lock itself? I had to give it a try. This is the exact model of lock I purchased.
After much dismantling, tinkering, poking with a micrometer, etc. I decided that I thought I'd be able to get some limit switches in there and maybe the motor. Worst case, the motor could got externally with a small cover. The task was on!
The motor
Motor was first. I struggled to find a way to get a cam to pull back the frame on which the lock tang was mounted, so I decided to go the minimum viable product route first of all and mount the motor externally using a thin wire to pull the lock open. I mucked around with various versions of the motor that had different rotational speed. I considered different sizes of wheel to wind the wire round. In the end I went with a medium speed motor and decided that the perfect size would be the diameter of the 4mm shaft itself! All I needed to do was drill a hole through the shaft and feed some wire through.
Was the motor strong enough and fast enough? Yes. Was the wire flexible enough? No. I swapped it out for some fishing line and that seemed to do the trick.
The limit switches
I has some cheap tactile buttons that looked like they would fit in a small space alongside the lock mechanism. I designed a 3D printed bracket to hold them in place... and version 2... and version 3... and version 4. It took a few attempts but I finally managed something that wouldn't foul the lock or the M3 nylon screw I'd added to operate the switches. Once again I used my preferred CAD tool of OpenSCAD.
{gallery} Limit switches |
---|
Limit switch bracket: It took a few attempts, but this is what I came up with |
Limit switches in place: Note the fishing line to pull back the lock. |
Now the lock is reseated |
Lock reassembled: You'd never know anyone had been poking around in there! |
A small gearmotor: Note the hole drilled in the shaft |
Time to test it out
So - the theory is OK, but will it work? There's only one way to find out. The motor is just taped to the back of the lock for this initial test. I knocked up some simple code that starts the motor on a button press and stops when the appropriate limit switch in hit. At this point there's only a transistor (and flyback diode) driving the motor so it can only go one way at a time. Obviously a H-bridge will be needed for bi-directional control. Let's prove it's worth the trouble first, though...
Well, I'd call that a success. The lock opened and stopped at the limit of travel. The fishing line didn't break or stretch too much. As the limit switches are on the lock mechanism itself, it should automatically adjust for this. If it looks like I can spin the motor both ways then that's because I sneakily swapped the wires round. There was a current draw of about 80mA whilst the motor was spinning, so powering from 4xAA batteries might be possible. I'm pretty happy with the outcome.
So, what next?
Well, after my issues with battery power for the garage door, I'll probably do some more testing before committing it to the door. I'm wondering whether some mains power might be a sensible idea, despite it being tricky to route. I definitely prefer this options to an electric strike plate. Whilst it may need a little more work before it passes WAF, I'm happy with the result so far.
Top Comments