diff --git a/Images and Videos/Images/Final circuit diagram.png b/Images and Videos/Images/Final circuit diagram.png new file mode 100644 index 0000000..7f49a96 Binary files /dev/null and b/Images and Videos/Images/Final circuit diagram.png differ diff --git a/Images and Videos/Images/PCB Design 1.png b/Images and Videos/Images/PCB Design 1.png new file mode 100644 index 0000000..360c3e8 Binary files /dev/null and b/Images and Videos/Images/PCB Design 1.png differ diff --git a/Images and Videos/Images/PCB Design 2.png b/Images and Videos/Images/PCB Design 2.png new file mode 100644 index 0000000..8c01000 Binary files /dev/null and b/Images and Videos/Images/PCB Design 2.png differ diff --git a/Images and Videos/Images/PCB Design 3.png b/Images and Videos/Images/PCB Design 3.png new file mode 100644 index 0000000..6d81612 Binary files /dev/null and b/Images and Videos/Images/PCB Design 3.png differ diff --git a/Images and Videos/Images/PCB Design 4.png b/Images and Videos/Images/PCB Design 4.png new file mode 100644 index 0000000..6c51206 Binary files /dev/null and b/Images and Videos/Images/PCB Design 4.png differ diff --git a/Images and Videos/Videos/Working Video.mp4 b/Images and Videos/Videos/Working Video.mp4 new file mode 100644 index 0000000..9187311 Binary files /dev/null and b/Images and Videos/Videos/Working Video.mp4 differ diff --git a/Poster and Report/Poster.jpg b/Poster and Report/Poster.jpg new file mode 100644 index 0000000..48e70cc Binary files /dev/null and b/Poster and Report/Poster.jpg differ diff --git a/Poster and Report/Report.pdf b/Poster and Report/Report.pdf new file mode 100644 index 0000000..31059b6 Binary files /dev/null and b/Poster and Report/Report.pdf differ diff --git a/README.md b/README.md index 28f3c7b..e2eeb01 100644 --- a/README.md +++ b/README.md @@ -1 +1,76 @@ -# Smart-door-locking-system \ No newline at end of file +# Smart-door-locking-system + +#### Open Project 2022 + +## Abstract + +The aim of this project is to open a Smart door lock from any where in the world by using IOT cloud or by using Keypad. The goals of this project was to build a modern, easy-to-use, smart door lock that allows for accessible unlocking and adds convenience, utility, and security to your home. + +## Motivation + +Ever felt lazy to go and open the door when you listen to door bell? Or tired of carrying keys all over and afraid of loosing them ?. To provide an easy and convenient method for unlocking a door by removing the need for the old-fashioned key. And the time that is requires to open the door using IOT is less than time required to open with normal key. And it also ensure more security for our lock. + +## Mechanical Aspect of the Design + +The actuator used in this project s a 12V Solenoid Lock Actuator. It is a ready-made lock like desin which just as to be fitted in the casing. A case for this has to be made. This need to be done on Solidworks and get it 3D printed. The casing has to be as compact as possible and must fit the PCB, actuator ,etc. Due to time constraints it has not been made. + +## Electronics Aspect of the Design + +### Components + +* Nodemcu ESP 8266 - ESP 8266 : This is used as Wi Fi module to connect the door lock through IoT. It is used to connect to Arduino IoT cloud and send the data from Cloud to Arduino (or vice versa). +* Arduino UNO - This is used to control the door lock and take input through keypad and act on the lock. This is main controlling unit of lock. +* Solenoid Lock Actuator - Linear solenoids basically consist of an electrical coil wound around a cylindrical tube with a ferro magnetic actuator or “plunger” that is free to move or slide “IN” and “OUT” of the coils body. They are useful in many applications that require an open or closed (in or out) type motion. In this case it moves IN when power is supplied and is in OUT state when there’s no power. +* Keypad - Keypad : This is to use ‘password’ based unlocking. Who wants to take out mobile if one is at the door!? We’ve used 4*4 keypad. +* 5V Single relay module +* 12V rechargeable Li-ion Battery +* 12V Charger +* Some diodes, Resistors, Connecting wires +* PCB designing + +

Final ckt

+ +### Working + +First of all, a request to open door lock is sent from Arduino IoT cloud Dashboard. The request is then sent to Nodemcu ESP 8266 via internet. For this Nodemcu must be connected to Wi Fi with internet. Nodemcu then transfers the request to open the door to Arduino UNO by serial communication through Rx and Tx pins. Arduino UNO on the basis of request opens or closes the lock. The door lock automatically closes after 10 seconds of opening. + +

Workflow

+ + +## Cost Structure + +|Solenoid Actuator | 500/- | +|:--- |:--- | +|Arduino Uno | 500/- | +|NodeMCU ESP8266 | 350/- | +|Other costs (Adapters, batteries etc)| 700/- | +|Total | 2050/-| + +## Applications + +* This project has various applications in daily life. Now a days people are too busy and they want to make an advantage of resources in various aspects. +* If you are having only one key to a house then the main problem here is other person of the house may not have the keys, so by using this IOT cloud many people can access the door lock. +* Disabled or elder people can easily access the door using their mobile phones.And it also ensures high security to the lock. + +## Limitations + +* The main problem here is if both battery and charging management got failed. Then it is difficult to open the lock. +* Also Hackers can hack the access to get into the house. We need to keep extra access for Guests, during that period our code can be shared to other people. +* Reliance on Smart Phones. If we lost our mobile and if we dont have any back up option, then we may fall into trouble. +* It Costs Heavily and if some problem occurs we need to contact for help. + +## Furter Improvements + +* The circuit could be made compact by PCB printing. Also the casing can be done by printing the solid work model. +* LCD Display can be used to show the status of password, lock and other stuff. +* IOT code can be upgraded to store time of door opening in th cloud. +* The Lock can be integrated mechanically with modern door handle. + +## Team Members + +1. [Manmanth Ashtikar](https://github.com/ashtikarmanmath). +2. [Varanasi Chakradhar](https://github.com/Chakri2507). + +## Mentor + +1. Nishant Kumar diff --git a/src/Arduino code/Arduino code.txt b/src/Arduino code/Arduino code.txt new file mode 100644 index 0000000..521fa60 --- /dev/null +++ b/src/Arduino code/Arduino code.txt @@ -0,0 +1,115 @@ +#include "Keypad.h" +const byte ROWS = 4; //four rows +const byte COLS = 4; //four columns + +char keys[ROWS][COLS] = { + {'1','2','3','A'}, + {'4','5','6','B'}, + {'7','8','9','C'}, + {'*','0','#','D'} +}; + +int data=12; +byte rowPins[ROWS] = {9,8,7,6}; +byte colPins[COLS] = {5,4,3,10}; +Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS); +const int len_key = 5; +char master_key[len_key] = {'1','2','3','4','1'}; +char attempt_key[len_key]; +int z=0; + +void setup() { + pinMode(12, OUTPUT); + digitalWrite(12, LOW); + pinMode(LED_BUILTIN, OUTPUT); + Serial.begin(9600); + while(!Serial); + Serial.println("Serial Mil gya..!"); +} + +void loop() { + if(Serial.available()){ + int state= Serial.parseInt(); + if( state==1){ + Serial.println("State variable changed to 1"); + digitalWrite(12, HIGH); + digitalWrite(LED_BUILTIN, HIGH); + Serial.println("Door is being unlocked"); + } + else { + Serial.println("State variable changed to 0"); + digitalWrite(12, LOW); + digitalWrite(LED_BUILTIN, LOW); + Serial.println("Door is being locked"); + + } + } + + keypadcheck(); + +} +void keypadcheck(){ + + + char key = keypad.getKey(); + + if (key){ + switch(key){ + case '*': + Serial.println("Clicked *"); + z=0; + + break; + case '#': + delay(100); + Serial.println("Checking key"); + // added debounce + + checkKEY(); + Serial.println("Key has been checked"); + break; + default: + attempt_key[z]=key; + Serial.println("Writing element"); + + z++; + } + } +} + + +void checkKEY() +{ + int correct=0; + int i; + for(int i=0;i +SoftwareSerial abc(13, 15); + +void setup() { + // Initialize serial and wait for port to open: + Serial.begin(9600); + // This delay gives the chance to wait for a Serial Monitor without blocking if none is found + delay(1500); + + // Defined in thingProperties.h + initProperties(); + + // Connect to Arduino IoT Cloud + ArduinoCloud.begin(ArduinoIoTPreferredConnection); + + /* + The following function allows you to obtain more information + related to the state of network and IoT Cloud connection and errors + the higher number the more granular information you’ll get. + The default is 0 (only errors). + Maximum is 4 + */ + setDebugMessageLevel(2); + ArduinoCloud.printDebugInfo(); + abc.begin(9600); +} + +void loop() { + ArduinoCloud.update(); + onLockChange(); + // Your code here + + +} + +/* + Since Lock is READ_WRITE variable, onLockChange() is + executed every time a new value is received from IoT Cloud. +*/ +void onLockChange() { + // Add your code here to act upon Lock change + //int i=0; + if(lock==true){ + //i=1; + abc.write("1"); + Serial.println("Request to open sent"); + //i=0; + + delay(10000); + lock= false; + Serial.println("IoT variable lock set to false after 10s"); + + abc.write("0"); + Serial.println("Request to close sent now"); + + } + else if (lock==false) {abc.write("0"); + + } +} \ No newline at end of file diff --git a/src/NodeMCU code/Untitled_jun16a/ReadMe.adoc b/src/NodeMCU code/Untitled_jun16a/ReadMe.adoc new file mode 100644 index 0000000..99fbfdb --- /dev/null +++ b/src/NodeMCU code/Untitled_jun16a/ReadMe.adoc @@ -0,0 +1,58 @@ +:Author: manmathashtikar +:Email: +:Date: 16/06/2022 +:Revision: version# +:License: Public Domain + += Project: {Project} + +Describe your project + +== Step 1: Installation +Please describe the steps to install this project. + +For example: + +1. Open this file +2. Edit as you like +3. Release to the World! + +== Step 2: Assemble the circuit + +Assemble the circuit following the diagram layout.png attached to the sketch + +== Step 3: Load the code + +Upload the code contained in this sketch on to your board + +=== Folder structure + +.... + sketch123 => Arduino sketch folder + ├── sketch123.ino => main Arduino file + ├── schematics.png => (optional) an image of the required schematics + ├── layout.png => (optional) an image of the layout + └── ReadMe.adoc => this file +.... + +=== License +This project is released under a {License} License. + +=== Contributing +To contribute to this project please contact: + +=== BOM +Add the bill of the materials you need for this project. + +|=== +| ID | Part name | Part number | Quantity +| R1 | 10k Resistor | 1234-abcd | 10 +| L1 | Red LED | 2345-asdf | 5 +| A1 | Arduino Zero | ABX00066 | 1 +|=== + + +=== Help +This document is written in the _AsciiDoc_ format, a markup language to describe documents. +If you need help you can search the http://www.methods.co.nz/asciidoc[AsciiDoc homepage] +or consult the http://powerman.name/doc/asciidoc[AsciiDoc cheatsheet] diff --git a/src/NodeMCU code/Untitled_jun16a/arduino_secrets.h b/src/NodeMCU code/Untitled_jun16a/arduino_secrets.h new file mode 100644 index 0000000..b690772 --- /dev/null +++ b/src/NodeMCU code/Untitled_jun16a/arduino_secrets.h @@ -0,0 +1,3 @@ +#define SECRET_SSID "" +#define SECRET_PASS "" +#define SECRET_DEVICE_KEY "" diff --git a/src/NodeMCU code/Untitled_jun16a/sketch.json b/src/NodeMCU code/Untitled_jun16a/sketch.json new file mode 100644 index 0000000..52d84f8 --- /dev/null +++ b/src/NodeMCU code/Untitled_jun16a/sketch.json @@ -0,0 +1,22 @@ +{ + "cpu": { + "fqbn": "esp8266:esp8266:nodemcuv2:baud=115200,dbg=Disabled,eesz=4M,exception=disabled,ip=lm2f,lvl=None____,vt=flash,wipe=none,xtal=80", + "name": "NodeMCU 1.0 (ESP-12E Module)", + "type": "serial" + }, + "secrets": [ + { + "name": "SECRET_SSID", + "value": "" + }, + { + "name": "SECRET_PASS", + "value": "" + }, + { + "name": "SECRET_DEVICE_KEY", + "value": "" + } + ], + "included_libs": [] +} \ No newline at end of file diff --git a/src/NodeMCU code/Untitled_jun16a/thingProperties.h b/src/NodeMCU code/Untitled_jun16a/thingProperties.h new file mode 100644 index 0000000..1673820 --- /dev/null +++ b/src/NodeMCU code/Untitled_jun16a/thingProperties.h @@ -0,0 +1,24 @@ +// Code generated by Arduino IoT Cloud, DO NOT EDIT. + +#include +#include + +const char DEVICE_LOGIN_NAME[] = "bd95aeec-8969-4784-8675-a7cdd2077f8d"; + +const char SSID[] = SECRET_SSID; // Network SSID (name) +const char PASS[] = SECRET_PASS; // Network password (use for WPA, or use as key for WEP) +const char DEVICE_KEY[] = SECRET_DEVICE_KEY; // Secret device password + +void onLockChange(); + +bool lock; + +void initProperties(){ + + ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME); + ArduinoCloud.setSecretDeviceKey(DEVICE_KEY); + ArduinoCloud.addProperty(lock, READWRITE, ON_CHANGE, onLockChange); + +} + +WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);