Home
About Us
Achievement
Home
Raspberry-Pi Projects
_Raspberry Pi 4 Complete Guide
Arduino Project
_All Projects
Esp8266 Project
_All Projects
Esp32 Project
_Automation-with-feedback
OTP Based Door Lock Using Arduino And SIM800L
Just Do Electronics
January 15, 2022
Circuit Diagram :-
Code :-
//Prateek //wwww.prateeks.in //https://www.youtube.com/c/JustDoElectronics/videos #include
#include
#include
#include
#define relay 4 #define red 16 #define green 15 const byte ROWS = 4; const byte COLS = 4; char hexaKeys[ROWS][COLS] = { {'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'} }; byte rowPins[ROWS] = {13, 12, 11, 10}; byte colPins[COLS] = {9, 8, 7, 6}; Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); LiquidCrystal_I2C lcd(0x27, 16, 2); SoftwareSerial sim800l(3, 2); int irsensor = A0; int otp; String otpstring = ""; int i = 0; void setup() { pinMode(irsensor, INPUT_PULLUP); sim800l.begin(4800); Serial.begin(115200); lcd.init(); lcd.backlight(); Serial.print("Welcome to SIM800L Project"); sim800l.println("AT"); updateSerial(); pinMode(relay, OUTPUT); pinMode(red, INPUT); pinMode(green, INPUT); digitalWrite(relay, LOW); delay(500); sim800l.println("AT+CSQ"); updateSerial(); delay(1000); } void updateSerial() { delay(500); while (Serial.available()) { sim800l.write(Serial.read()); } while (sim800l.available()) { Serial.write(sim800l.read()); } } void loop() { lcd.setCursor(0, 0); lcd.print(" OTP Based"); lcd.setCursor(0, 1); lcd.print(" Door Lock"); if (digitalRead(irsensor) == LOW) { otp = random(2000, 9999); otpstring = String(otp); Serial.println(otpstring); while (digitalRead(irsensor) == LOW) {} lcd.clear(); lcd.setCursor(0, 0); lcd.print(" OTP Sent to"); lcd.setCursor(0, 1); lcd.print(" Your Mobile"); Serial.print("OTP is "); delay(100); Serial.println(otpstring); delay(100); SendSMS(); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Enter OTP :"); getotp(); } } void getotp() { String y = ""; int a = y.length(); while (a < 4) { char customKey = customKeypad.getKey(); if (customKey) { lcd.setCursor(0, 1); y = y + customKey; lcd.print(y); a = y.length(); } } Serial.print("Entered OTP is "); Serial.println(y); if (otpstring == y) { lcd.setCursor(0, 0); lcd.print("Access Granted"); lcd.setCursor(0, 1); lcd.print("Door Opening"); digitalWrite(relay, HIGH); digitalWrite(red, HIGH); digitalWrite(green, LOW); delay(5000); digitalWrite(relay, LOW); digitalWrite(red, LOW); digitalWrite(green, HIGH); } else { lcd.setCursor(0, 0); lcd.print("Access Failed"); lcd.setCursor(0, 1); lcd.print("Try Again !!!"); delay(3000); } } void SendSMS() { Serial.println("Sending SMS..."); sim800l.print("AT+CMGF=1\r"); delay(100); sim800l.print ("AT+CSMP=17,167,0,0\r"); delay(500); sim800l.print("AT+CMGS=\"+91xxxxxxxxxxx\"\r"); delay(500); sim800l.print("Your OTP is " + otpstring + " Just Type OTP And Unlock The Door"); delay(500); sim800l.print((char)26); delay(500); sim800l.println(); Serial.println("Text Sent."); delay(500); }
Video :-
2 Comments
Anonymous
29 June 2023 at 20:41
price?
Reply
Delete
Replies
Reply
Anonymous
19 September 2023 at 01:10
workin g of the project
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer
Older
Build Your Own Gps Tracking System using Arduino
How To Make RFID & Keypad Based Door Lock
IoT Based Fingerprint Biometric Attendance System Using NodeMCU (Esp8266)
NRF Based Servo Motor Control
ESP32 And Fingerprint Sensor Based Biometric Door Lock Security System
Ultrasonic Sensor as a Counter with Arduino
IoT Based Smart Pulse Oximeter With NodeMCU & MAX30100 Sensor
GPS Tracker Using Nodemcu
IoT Based Patient Health Monitoring System Using Blynk App
YouTube
Like on Facebook
Follow on Twitter
Follow on Google+
Follow on Instagram
Subscribe on Youtube
Hi WelCome To My Website If you have a creative mind and want to learn Electronics even without studying it then FRIENDS this Website And Youtube Channel is for you, I am crazy creators who love making Electronics things. I have a bunch of more than 130 Tutorial Videos on My YouTube Channel and I upload a new Tutorial every Sunday.
Tags
Arduino Project
Esp32 Project
Esp8266 Project
2 Comments
price?
ReplyDeleteworkin g of the project
ReplyDelete