Introduction
I decided i wanted to be able to control my door lock and lights through the internet using the photon. My door lock requires a key to lock and unlock from both sides, which gets annoying when trying to lock up and night and you can't just turn the knob. While I'm at it i might as well add some light control as well just for the convenience.
Design
I decided to control the lock with a servo attached to my key , fixed to the door. I bought an HS-311 servo from amazon and modified it for continuous rotation , as the 180 degrees wasn't enough. The mount for the servo, and key coupler I made out of some scrap wood. For the light control I bought an 8 channel DC 5v relay module recommended by John McAlpine which gives easy control over the lights and allows me to expand this project in the future.
Connecting the components to the photon was easy and straight forward. The servo is connected to Vin, GND, and D0. The relay is connected to Vin, GND, and D3.
The code I wrote for this was based off examples i found online customized to suit this application. Since the servo is continuous rotation I coded it to rotate for 2 seconds then stop.. This may not be the best solution but it works for now, I plan on adding a sensor so i know the position of the lock in the future. Using mobicle.io. I have created buttons to call the function i chose for easy control through the internet.
I am also using IFTT to check my location on my phone, If i come within certain distance of my home, my door will unlock. I also have it set to turn on the lights automatically at 8:30pm.
Comments