Evey time I stroll by these electronic deadbolt units at my favorite big box home improvement store I always have 2 thoughts pass through my mind in turn:
‘Man, that would be cool to add to my home security system’ followed shortly by
‘I’m sure it can be easily hacked to directly control the motor from the outside or brute force the 4 digit pin code.’
The latter thought has always prevented me from shelling out the dough for a nice unit that could potentially pose a bigger security risk than a simple keyed lock.
I also did not feel the wifi and z-wave models were worth the $200-300 price range, especially when they add another layer of vulnerability. On a recent weekend, however, I came across a $60 keypad model (no remote control) and decided I would attempt to remotely control the unit using an arduino, raspberry pi, or other embedded system I already have in place for home security.
Initially I envisioned a hard wire from a micro-controller or other device to the embedded controller, motor, or some combination of those. I would have preferred to use the built in circuit and simply send simulated button presses, but for a number of reasons I decided to cut corners and control the motor directly using a simple TIP120 darlington transistor circuit.
There’s no feeling quite like opening a product I just purchased and immediately voiding the warranty. That is my real hobby.
Here you can see the simple TIP120 circuit with a zener diode to protect the controller board from evil kickbacks. You may already be able to tell from the photo of my circuit where this post is going….
Half way through this ill-advised plan I realized this circuit would only have one-way control of the motor direction, unless I used an H-bridge. So basically I could open the lock on the door, but never close it…. or stay locked inside forever.
After much contemplating, googling, and forum trolling, I changed course and decided against building an H-bridge circuit with the darlington transistors I had on hand. I decided instead to use a
TB6612FNG 1A Dual Motor Driver I picked up on the cheap for servo motor control. I would supply the motor driver with voltage from the MCU board while using the deadbolt’s power supply (replaceable AA batteries) for the motor voltage. This solution offered bi-directional control of the deadbolt motor, allowing me to lock and unlock via the web interface and the GPIO pins of the webcontrol board. In addition, I could use other GPIO pins for a position indicator circuit and update the web console with the lock status.
Below you can see the early ‘prototype’ with the TIP120. You can also see the webcontrol board I decided to use for the controller. It was a plug and play solution that was faster than writing arduino code from scratch, and this was obviously a lazy Saturday. I’m still working out the kinks in the lock position sensor, but the lock is functional and I am able to lock and unlock the deadbolt via my phone, when connected to my WiFi. Once I clean this up and finish the sensor wiring, I will post some updates with the motor controller board, web interface, and a nice demo video for PoC.