Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2023:avaduva:locker [2023/05/28 23:49]
robert_nicu.enuta
pm:prj2023:avaduva:locker [2023/05/28 23:59] (current)
robert_nicu.enuta
Line 82: Line 82:
  
 LiquidCrystal_I2C.h:​ The LiquidCrystal_I2C library is used to interface with the LCD display module through the I2C protocol. It simplifies the process of displaying information on the LCD by providing functions for writing text, setting the cursor position, and controlling the backlight. This library significantly reduces the complexity of communicating with the LCD module over I2C, making it easier to display relevant prompts, messages, and status updates to the users. LiquidCrystal_I2C.h:​ The LiquidCrystal_I2C library is used to interface with the LCD display module through the I2C protocol. It simplifies the process of displaying information on the LCD by providing functions for writing text, setting the cursor position, and controlling the backlight. This library significantly reduces the complexity of communicating with the LCD module over I2C, making it easier to display relevant prompts, messages, and status updates to the users.
-<​code>​ 
-#include <​Keypad.h>​ 
-#include <​Servo.h>​ 
-#include <​Wire.h>  ​ 
-#include <​LiquidCrystal_I2C.h>  ​ 
  
-LiquidCrystal_I2C lcd(0x3F, 16, 2); +Implementation
-Servo myservo; +
-int pos=0;  +
-const byte rows=4; +
-const byte cols=4; +
-  +
-char key[rows][cols]={ +
-{'​1','​2','​3','​A'​},​ +
-{'​4','​5','​6','​B'​},​ +
-{'​7','​8','​9','​C'​},​ +
-{'​*','​0','#','​D'​} +
-}; +
-byte rowPins[rows]={A0,​A1,​A2,​A3};​ +
-byte colPins[cols]={9,​8,​7,​6};​ +
-Keypad keypad= Keypad(makeKeymap(key),​rowPins,​colPins,​rows,​cols);​ +
-char* password="​133A";​ +
-int currentposition=0;​ +
-int redled=10;​ +
-int greenled=11;​ +
-int buzz=8; +
-int invalidcount=12;​ +
-  +
-  +
-  +
-void setup() +
-+
-lcd.init();  +
- ​lcd.backlight(); ​+
  
-displayscreen();​ +I have implemented the following functions:
-Serial.begin(9600);​ +
-pinMode(redled,​ OUTPUT); +
-pinMode(greenled,​ OUTPUT); +
-pinMode(buzz,​ OUTPUT); +
-myservo.attach(9);​ +
-  +
-+
-  +
-void loop() +
-+
-if( currentposition==0) +
-{+
  
-displayscreen();​ +1.setup()
-  +
-+
-int l ; +
-char code=keypad.getKey();​ +
-if(code!=NO_KEY) +
-+
-lcd.clear();​ +
-lcd.setCursor(0,​0);​ +
-lcd.print("​PASSWORD:"​);​ +
-lcd.setCursor(7,​1); +
-lcd.print(""​);​ +
-lcd.setCursor(7,​1);​ +
-for(l=0;​l<​=currentposition;​++l) +
-+
-  +
-lcd.print("​*"​);​ +
-keypress();​ +
-+
-  +
-if (code==password[currentposition]) +
-+
-++currentposition;​ +
-if(currentposition==4) +
-+
-  +
-unlockdoor();​ +
-currentposition=0;​ +
-  +
-+
-  +
-+
-  +
-else +
-+
-++invalidcount;​ +
-incorrect();​ +
-currentposition=0;​ +
-  +
-+
-if(invalidcount==5) +
-+
-  +
-++invalidcount;​ +
-torture1();​ +
-  +
-+
-if(invalidcount==8) +
-+
-torture2()+
-+
-  +
-}+
  
-+2.displayscreen()
- +
  
-  +3.keypress() 
-void unlockdoor() + 
-+4.loop() 
-delay(1000);​ + 
-  +5.armservo() 
-lcd.setCursor(0,0); + 
-lcd.println("​ "); +6.counterbeep() 
-lcd.setCursor(1,​0);​ + 
-lcd.print("​Access Granted"​);​ +The code is uploaded in the download section
-lcd.setCursor(4,1); +
-lcd.println("​WELCOME!!"​); +
-lcd.setCursor(15,​1);​ +
-lcd.println("​ "); +
-lcd.setCursor(16,​1);​ +
-lcd.println("​ "); +
-lcd.setCursor(14,​1);​ +
-lcd.println("​ "); +
-lcd.setCursor(13,​1);​ +
-lcd.println("​ "); +
-unlockbuzz();​ +
-  +
-for(pos = 180; pos>=0; pos-=5)  +
-+
-myservo.write(pos); +
-delay(5); ​ +
-+
-delay(2000);​ +
-  +
-  +
-  +
-delay(1000);​ +
-counterbeep();​ +
-  +
-delay(1000);​ +
-  +
-for(pos = 0; pos <= 180; pos +=5)  +
-{  +
-myservo.write(pos);​  +
-delay(15);​ +
-  +
-  +
-currentposition=0;​ +
-  +
-lcd.clear();​ +
-displayscreen();​ +
-  +
-+
-+
-  +
-//​************WRONG CODE FUNCTION********//​ +
-  +
-void incorrect() +
-+
-delay(500);​ +
-lcd.clear();​ +
-lcd.setCursor(1,​0);​ +
-lcd.print("​CODE"​);​ +
-lcd.setCursor(6,0); +
-lcd.print("​INCORRECT"​);​ +
-lcd.setCursor(15,​1);​ +
-lcd.println("​ "); +
-lcd.setCursor(4,​1);​ +
-lcd.println("​GET AWAY!!!"​);​ +
-  +
-lcd.setCursor(13,​1);​ +
-lcd.println("​ "); +
-Serial.println("​CODE INCORRECT YOU ARE UNAUTHORIZED"​);​ +
-digitalWrite(redled,​ HIGH); +
-digitalWrite(buzz,​ HIGH); +
-delay(3000);​ +
-lcd.clear();​ +
-digitalWrite(redled,​ LOW); +
-digitalWrite(buzz,​LOW);​ +
-displayscreen();​ +
-+
-//​************** CLEAR THE SCREEN!!!*************//​ +
-void clearscreen() +
-+
-lcd.setCursor(0,​0);​ +
-lcd.println("​ "); +
-lcd.setCursor(0,​1);​ +
-lcd.println("​ "); +
-lcd.setCursor(0,​2);​ +
-lcd.println("​ "); +
-lcd.setCursor(0,​3);​ +
-lcd.println("​ "); +
-+
-//​**************KEYPRESS********************//​ +
-void keypress() +
-+
-  +
-  +
-  +
-digitalWrite(buzz,​ HIGH); +
-delay(50);​ +
-digitalWrite(buzz,​ LOW); +
-+
-//​********DISPALAY FUNCTION!!!*************//​ +
-void displayscreen() +
-+
-  +
-lcd.setCursor(0,​0);​ +
-lcd.println("​*ENTER THE CODE*"​);​ +
-lcd.setCursor(1 ,1); +
-  +
-lcd.println("​TO _/_ (OPEN)!!"​);​ +
-+
-//​*************** ARM SERVO***********//​ +
-void armservo() +
-+
-  +
-for (pos=180;​pos<​=180;​pos+=50) +
-+
-myservo.write(pos);​ +
-delay(5); +
-+
-delay(5000);​ +
-  +
-for(pos=180;​pos>​=0;​pos-=50) +
-+
-myservo.write(pos);​ +
-+
-  +
-+
-//​**********UNLOCK BUZZ*************//​ +
-void unlockbuzz() +
-+
-  +
-digitalWrite(buzz,​ HIGH); +
-delay(80);​ +
-digitalWrite(buzz,​ LOW); +
-delay(80);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(80);​ +
-digitalWrite(buzz,​ LOW); +
-delay(200);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(80);​ +
-digitalWrite(buzz,​ LOW); +
-delay(80);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(80);​ +
-digitalWrite(buzz,​ LOW); +
-delay(80);​ +
-+
-  +
-//​**********COUNTER BEEP**********//​ +
-void counterbeep() +
-+
-delay(1200);​ +
-  +
-  +
-lcd.clear();​ +
-digitalWrite(buzz,​ HIGH); +
-  +
-lcd.setCursor(2,​15);​ +
-lcd.println("​ "); +
-lcd.setCursor(2,​14);​ +
-lcd.println("​ "); +
-lcd.setCursor(2,​0);​ +
-delay(200);​ +
-lcd.println("​GET IN WITHIN:::"​);​ +
-  +
-lcd.setCursor(4,​1);​ +
-lcd.print("​5"​);​ +
-delay(200);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(1000);​ +
-//2 +
-digitalWrite(buzz,​ HIGH); +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-lcd.setCursor(4,​1);​ //2 +
-lcd.print("​4"​);​ +
-delay(100);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(1000);​ +
-//3 +
-digitalWrite(buzz,​ HIGH); +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-lcd.setCursor(4,​1);​ //3 +
-lcd.print("​3"​);​ +
-delay(100);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(1000);​ +
-//4 +
-digitalWrite(buzz,​ HIGH); +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-lcd.setCursor(4,​1);​ //4 +
-lcd.print("​2"​);​ +
-delay(100);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN:"​);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(1000);​ +
-// +
-digitalWrite(buzz,​ HIGH); +
-lcd.setCursor(4,​1);​ +
-lcd.print("​1"​);​ +
-delay(100);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.println("​GET IN WITHIN::"​);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(1000);​ +
-//5 +
-digitalWrite(buzz,​ HIGH); +
-delay(40);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(40);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(40);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(40);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(40);​ +
-digitalWrite(buzz,​LOW);​ +
-delay(40);​ +
-digitalWrite(buzz,​ HIGH); +
-delay(40);​ +
-digitalWrite(buzz,​LOW);​ +
-lcd.clear();​ +
-lcd.setCursor(2,​0);​ +
-lcd.print("​RE-LOCKING"​);​ +
-delay(500);​ +
-lcd.setCursor(12,​0);​ +
-lcd.print("​."​);​ +
-delay(500);​ +
-lcd.setCursor(13,​0);​ +
-lcd.print("​."​);​ +
-delay(500);​ +
-lcd.setCursor(14,​0);​ +
-lcd.print("​."​);​ +
-delay(400);​ +
-lcd.clear();​ +
-lcd.setCursor(4,​0);​ +
-lcd.print("​LOCKED!"​);​ +
-delay(440); +
-}+
  
-</​code>​ 
 </​note>​ </​note>​
  
Line 482: Line 142:
 Additionally,​ the Buzzer provides audio feedback to indicate successful authentication or access denied events. Together, these components create a reliable, user-friendly,​ and secure locker system that offers controlled access to the storage compartment. The modular design allows for easy customization and expansion, making it adaptable for various applications and environments. ​ Additionally,​ the Buzzer provides audio feedback to indicate successful authentication or access denied events. Together, these components create a reliable, user-friendly,​ and secure locker system that offers controlled access to the storage compartment. The modular design allows for easy customization and expansion, making it adaptable for various applications and environments. ​
  
-We can develop more this application by using a wifi module to control the password remote, or using nfc to unlock this like interfons. This application in this state we can use itlike ​a normal safe lock from gym for example or camera hotels.+We can develop more this application by using a wifi module to control the password remote, or using nfc to unlock this like interfons. This application in this state we can use it like a normal safe lock from gym for example or camera hotels.
 ===== Download ===== ===== Download =====
  
pm/prj2023/avaduva/locker.1685306963.txt.gz · Last modified: 2023/05/28 23:49 by robert_nicu.enuta
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0