Skip to main content

58. Door Lock System V4.0 - Using Keypad and RFID system

Hello everyone!
Today I am going to explain you about making another version of my door lock system. I have already taught you about making three versions of door lock system, and this version will have two layers of security - RFID system and Keypad.

Please refer to the links below to learn about the previous versions of my Door lock system.

Hardware components used in this project

  • Arduino Uno
  • USB Type A/ B cable (for Arduino Uno)
  • Solderless Breadboard - Half+
  • Breadboard Power supply module - 3.3/ 5 V
  • MFRC522 RFID reader
  • RFID tags - Card tag and Key tag
  • Keypad matrix - 4x4
  • LCD display module with I2C interface - 16x2
  • Relay module - 5V single channel
  • Solenoid door lock - 12V
  • Male-to-Male Jumper wires
  • Female-to-Male Jumper wires
  • Voltage Regulator/ 12V DC power adapter

Setup




Your hardware setup must look somewhat similar to those in the photos above.

Connections

Keypad matrix - 4x4

  • Row1 - A0
  • Row2 - A1
  • Row3 - D7
  • Row4 - D6
  • Column1 - D5
  • Column2 - D4
  • Column3 - D3
  • Column4 - D2

MFRC522 RFID reader

  • SDA/ SS - D10
  • SCK - D13
  • MOSI - D11
  • MISO - D12
  • IRQ - Not connected
  • GND - Ground
  • RST/ RESET - D9
  • 3.3V - 3.3V

LCD display module with I2C interface - 16x2

  • GND - Ground
  • VCC - 5V
  • SDA - A4
  • SCL - A5

Relay module - 5V single channel

  • S - D8
  • (+) - 5V
  • (-) - Ground

Coding

For this project, you will be needing the following libraries:
Open the 'DumpInfo' example sketch from the MFRC522 library and upload it to your Arduino microcontroller board to scan the UID of your RFID tags. 
Create MFRC522 instance and set the LCD address to 0x27 for 16 chars and 2 line display. You can use the I2C scanner to get the address of your LCD display module. Create variable to store your PIN. You will need to use the char data type to create this variable, and create another variable to store the PIN entered. Create a variable using the 'int' data type to store the number of counts, and a global variable for the relay module. Define the number of rows and columns in your keypad by using the 'const byte' data type. 

const byte rows = 4;
const byte columns = 4;
char hexaKeys[rows][columns] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte row[rows] = {A0, A1, 7, 6};
byte column[columns] = {5,4,3,2};
Keypad key = Keypad( makeKeymap(hexaKeys), row, column, rows, columns);

Within void setup( ), use the pinMode( ) function to configure the relay pin as OUTPUT. Initiate SPI bus, MFRC522 and LCD display.
void loop() {
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  ...
}
If the authorised tag is placed, the LCD display module must show that the tag is identified and then ask you to enter the PIN. Afterwards, you must type in the PIN using the Keypad matrix and during this process, the LCD display module will show '*" in places of these characters. If the correct PIN is entered, the relay module will be switched on and the LCD will show that the Access is granted. 
If the unauthorised tag or incorrect PIN is entered, the relay module won't be switched on and the Access will be denied.
If anyone has any questions with the coding, please feel free to comment below or send me an email at arduinoprojectsbyr@gmail.com.

Final Look

If anyone has any questions, or suggestions, about this project, please feel free to comment below or send me an email at arduinoprojectsbyr@gmail.com.

Comments

Post a Comment

Popular posts from this blog

51. Buzz wire game using Arduino

Hello everyone! This is my first Arduino project in 2020 and it is going to be a fun and simple project. You would have heard of the Buzz Wire, a steady hand game, and today you will be learning to make one using Arduino. Hardware components used in this project Arduino Nano USB Type A to mini B cable (for Arduino Nano) Solderless Breadboard - Mini and Full-size LEDs (x2) - Green and Red Resistors (x2) - 220 Ω  Active Buzzer module (KY-012) LCD display module with I2C interface - 16x2 Male-to-Male Jumper wires (x4) - 10cm Female-to-Male Jumper wires (x5) - 20 cm Jumpers (x5) - to reduce the usage of wires Copper wire  Tape (or any form of insulation)  Setup Your hardware setup must look somewhat similar to the ones in the images above. The beginning and end of the copper wire maze must be taped to prevent conductivity between the wire loop and maze. Connections LCD display module with I2C interface GND - Ground VCC - 5V SDA - A4 SCL - A5

71. Buzz Wire Game ( Version 2.0 ) using Arduino

Hey Everyone! I hope that everyone's safe during this pandemic. Today I am going to explain you about the second version of my Buzz wire game. People who are bored of staying indoors can find this game pretty interesting and fun to play.  If you are a beginner, you can start off with my first version of this project :  51. Buzz wire game using Arduino   Hardware components used in this project Arduino Uno Solderless Breadboard (x2) - Full/ Full+ LCD display module with I2C module - 16x2 Potentiometer - B20K Push-buttons (x3) Resistor - 220 Ω Active Buzzer module (KY-012) LED - Red Copper Wire - 19/ 20 gauge thick Male-to-Male Jumper wires - 10cm and 20cm Wire - Long enough to connect the loop of copper wire to ground Other tools required for this project Cutting pliers - To cut the right amount of copper wire Round-nose pliers - To bend the copper wire and make a maze and loop Hardware setup Connections Wire Maze - D2 Wire loop - Ground (GND) B20K Potentiometer S - A0 (+) - 5V (-)

86. RFID Health tag (Arduino and Python)

 Hey everyone, Sorry I have not uploaded in a while. Today, I will be sharing an interesting project with all of you. This RFID Health tag project is useful when it comes to keeping track of vaccinated individuals, their biodata and their health conditions and medications. For this project, you will be needing Arduino and Python. Read on further to see how I did this project. Hardware components used in this project Arduino Uno Solderless Breadboard - Half+ MRFC522 RFID reader RFID key tags (x5) Push-buttons (x2) Male-to-Male Jumper wires (x12) USB Type A/ B cable (for Arduino Uno) Software required Arduino IDE - latest version recommended Python 3.8 Schematic MFRC522 RFID reader SDA/ SS - D10 SCK - D13 MOSI - D11 MISO - D12 IRQ - Not connected GND - Ground RST/ RESET - D9 3.3V - 3.3V Push-buttons Submit button - D4 Retrieve button - D5 Coding Arduino For this project, you will be using the following libraries: MFRC522 by miguelbalboa -  https://github.com/miguelbalboa/rfid SPI - In-bu