You may have seen many of those smart locks out there, some of which just ran very successful Kickstarter campaigns. Well, it seemed very fitting that we build the same thing with bluz!
To make the hardware, we fired up the 3D printer and made a rather crude but effective harness to hold a servo motor in place over top of the deadbolt. So no replacing the lock, it just grips the deadbolt and turns it.
Next, we hooked that to bluz. The circuit is quite simple, drive the servo with a PWM output, and have a separate AAA battery pack for the servo. To get a little fancier, we could have added a transistor to turn the servo on/off only when we needed it, this would have allowed for extremely long battery life.
For key control, we wrote a node.js app. The app would allow for a homeowner and guests. A guest can request keys, and the owner can grant or revoke them. Keys, at least in this simple example, are Spark Cloud access tokens. So when the homeowner grants a key, it actually generates a new token with the Spark Cloud and hands it to the guest. The guest can then use that through the REST API to open and close the lock. The code on bluz just has a Spark.funciton for lock/unlock that sets the PWM accordingly. The homeowner can revoke the key at any time, meaning they delete the access token.
Because this is bluz, we can use a gateway in the home and the smart lock will always be online. And because this is bluz, it will get amazing battery life. With the previously mentioned transistor to shut off the servo, the battery life would be months with this type of device.
Here is a video showing the smart lock working: