Nikunj Patel
Published © MPL-2.0

Lock & Unlock Door

Easy way to unlock and Lock door with Blynk app. Also, I will add code for to Lock & Unlock door by RFID and fingerprint sensor. 3 in 1.

BeginnerProtip1 hour2,759
Lock & Unlock Door

Things used in this project

Hardware components

ESP8266 ESP-12E
Espressif ESP8266 ESP-12E
×1
Servos (Tower Pro MG996R)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Blynk
Blynk

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

Blynk app setup

Servo has 3 pin, GND (Brown), 5V (Red), and PWM (Orange)
V1 pin for both lock and Unlock button, Motor rotation setting for Unlock (180 - 0), set at V1 pin.

Blynk app setup

Motor rotation setting for Lock (0 - 180), set pin V1.

Code

Blynk Unlock and Lock

C/C++
Virtual pin don't matter as long as you define servo pin correct in the code. I am using esp8266 module
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
#include <ESP8266WiFi.h>


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).

char auth[] = "YourAuthToken";

Servo servo;  


void setup()  
{
  Serial.begin(115200);
  Blynk.begin(auth, "YourNetworkName", "YourPassword");
  servo.attach(16); //ESP8266 pin D0 or GPIO16 // V1 
}
BLYNK_WRITE(V1)  
{
  servo.write(param.asInt());  
}
  
void loop()  
{ 
  Blynk.run();
}

Credits

Nikunj Patel

Nikunj Patel

6 projects • 19 followers
Electromechanical Engineer

Comments