icon

IoT Door Lock Project

Lock your door from anywhere

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
1 Arduino UNO
1 DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
1 Linear Solenoid, 12 VDC

Software apps and online services

Arduino IDE

Blynk

Hand tools and fabrication machines

Soldering iron (generic)

Story

This IoT door lock has one solenoid lock and an MC38 sensor. The sensor gives real-time data of the door and the solenoid is used to lock the door.

 

To make this project we need to follow these steps.

Step1

 

Watch the YouTube video

Step2

 

Installing ESP32 Add-on in Arduino IDE

 

To install the ESP32 board in your Arduino IDE, follow these next instructions:

 

In your Arduino IDE, go to File> Preferences

In your Arduino IDE, go to File> Preferences

 

projectImage

--Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button:

projectImage

Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

--Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Open the Boards Manager. Go to Tools > Board > Boards Manager…

--Open the Boards Manager. Go to Tools > Board > Boards Manager…

projectImage

--Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

projectImage

--That’s it. It should be installed after a few seconds.

projectImage

Step 3

 

1. Install Blynk Library using built-in library manager in Arduino IDE

To install a new library into your Arduino IDE, you can use the Library Manager (available from IDE version 1.6.2). Open the IDE and click on the "Sketch" menu and then Include Library > Manage Libraries.

projectImage

Then the Library Manager will open, you will find a list of libraries that are already installed or ready for installation. Search for Blynk library and in the version, selection choose the latest version to date

projectImage

Finally, click on Install and wait for the IDE to install the new library. Downloading may take time depending on your connection speed. Once it has been finished and Installed tag should appear next to the Bridge library. You can close the library manager.

 

You can now find the new library available in the Sketch > Include Library menu.

Step 4

The PCB was designed using easyeda software and it looks like this.

 

 

projectImage

And it was ordered from jlcpcb website using this link

 

$2 for 1-4 Layer PCBs, Get Free SMT Coupons →https://jlcpcb.com/IYB

Step 5

Now follow the steps provided in the video to download Blynk app and upload the code. Code will be provided in this article. And Enjoy your door lock.

projectImage

Custom parts and enclosures

PCB Gerber

icon gerber_pcb_door_security_system_2021-07-28_6nOI6rnstd.zip 31KB Download(11)

Schematics

Door Lock Schematics

projectImage

Code

CODE
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
  state = digitalRead(15);
  if(state != pstate)
  {
    Blynk.virtualWrite(V1,state);
    pstate = state;
  }
}

The article was first published in hackster, July 28, 2021

cr: https://www.hackster.io/robocircuits/iot-door-lock-project-0601f5

author: RoboCircuits

License
All Rights
Reserved
licensBg
0