Michael StewartNate Rumph

WiFi Connected Door Lock

Modifies existing door locks to be controlled via servo and Mobicle.io. This is a working prototype used for demonstration purposes.

BeginnerFull instructions provided3 hours2,245
WiFi Connected Door Lock

Things used in this project

Hardware components

Servos (Tower Pro MG996R)
Link for updated servo: https://www.amazon.com/DS3218-update-digital-Waterproof-Control/dp/B01MU7TQV8
Jumper wires (generic)
Jumper wires (generic)
Particle Photon
AA Batteries
AA Batteries
Rechargeable batteries are preferred.
4xAA battery holder
4xAA battery holder
Generic Plastic Housing
This component can be essentially any appropriately sized housing that can be mounted.
Mounting Adhesive
This is just recommended but proper mounting hardware is also suggested. This can also be used to attach the bracket for the servo lever arm
Zinc Fastener
These were what we used to construct the bracket for the servo arm.
Adafruit Tiny breadboard
The smaller the breadboard, the better and this quarter size board is perfect for small projects. The one shown in the photos came with the Maker Kit but the Adafruit Tiny board is the optimal choice.

Software apps and online services

ControlEverything.com Mobicle

Hand tools and fabrication machines

This tool is by no means required but is recommended if a slot in the housing is not already present.


Read more

Custom parts and enclosures

Servo Arm Bracket

This a Creo file that can be used if a 3-D printer is available and replaces the zinc fasteners that could be glued on the servo arm. Inner Diameter fits most locks and 8-32 UNC holes are tapped.


Circuit Diagram

Any pin will work but this particular example chose A7 for the servo.
The battery pack will also be grounded with the servo and the positive wire goes into the Vin Pin.
Sourced from http://diotlabs.daraghbyrne.me/6-controlling-outputs/servo/


WiFi Connected Lock

This code with buttons created on Mobicle will allow users to unlock/lock doors and publish event data. Argument parameters for the buttons:
Unlocked = -90
Locked = 90
// Mike Stewart
// Lock Setup & Configuration
// MEGR 3171
// Variable & integer declarations
int servoPin = A7;
// servo name declaration
Servo EMax;
int servoPos = 0;
int boardLed = D7;
// flag used to trigger if we have a new status for the event
bool lockActivated = false; 
void setup() {
// the onboard LED is our output as well as the servo
// enables the servo as an output of the function
pinMode( servoPin,OUTPUT);
// attaches the servo on the A7 pin to the servo object
EMax.attach( servoPin );
    // register our particle to control the servo
    Particle.function("servo", servoControl);
    // keep a cloud variable for the current position
    Particle.variable( "servoPos" , &servoPos , INT );
// The subscribe function allows our photon to receive data from another person's photon
Particle.subscribe("Lock Activation", myHandler);
void loop(){
// Loop for publishing lock events to the Particle Console
if (servoPos = -90){
        Particle.publish("Lock Activation","Locked",60,PRIVATE);
        // Otherwise this status isn't new and nothing should be done
    if (lockActivated==false){
        Particle.publish("Lock Activation","Unlocked",60,PRIVATE);
// command for servo over the cloud
int servoControl(String command)
{   int newPos = command.toInt();
    // Parameters for servo degrees of rotation
    servoPos = constrain( newPos, -180 , 180);
    EMax.write( servoPos );
    return 1;
// the myHandler function is called when the cloud tells us that our friend's event is published
void myHandler(const char *event, const char *data)
    if (strcmp(data,"Locked")==0) {
        // if your friend's Lock is engaged, then the board LED will turn on 
    else if (strcmp(data,"Unlocked")==0) {
        // if the Lock is disengaged, then the board LED will turn off
    // data shouldn't be anything but the two options listed above


Michael Stewart

Michael Stewart

1 project • 0 followers
Nate Rumph

Nate Rumph

0 projects • 0 followers


Add projectSign up / Login