This document provides a detailed overview of a Secure Entry Management System designed using an Arduino UNO microcontroller. The system integrates an RFID-RC522 module, a 4x4 membrane matrix keypad, an I2C LCD 16x2 screen, a servo motor, and a buzzer. The system provides real-time feedback and controls a locking mechanism based on user input and RFID authentication.
Arduino UNO
I2C LCD 16x2 Screen
RFID-RC522
4X4 Membrane Matrix Keypad
Servo
Buzzer
/*
* Secure Entry Management System
* This Arduino sketch controls an access system using an RFID-RC522 module,
* a 4x4 membrane matrix keypad, an I2C LCD 16x2 screen, a servo motor, and
* a buzzer. The system provides real-time feedback and controls a locking
* mechanism based on user input and RFID authentication.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
#include <MFRC522.h>
#include <Keypad.h>
// Pin definitions
#define RST_PIN 9
#define SS_PIN 10
#define BUZZER_PIN 7
#define SERVO_PIN 6
// Create instances
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo myServo;
MFRC522 rfid(SS_PIN, RST_PIN);
// Keypad setup
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {2, 3, 4, 5};
byte colPins[COLS] = {A0, A1, A2, A3};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize LCD
lcd.begin();
lcd.backlight();
// Initialize Servo
myServo.attach(SERVO_PIN);
myServo.write(0); // Lock position
// Initialize RFID
SPI.begin();
rfid.PCD_Init();
// Initialize Buzzer
pinMode(BUZZER_PIN, OUTPUT);
// Welcome message
lcd.setCursor(0, 0);
lcd.print("Welcome!");
lcd.setCursor(0, 1);
lcd.print("Scan your card");
}
void loop() {
// Check for RFID card
if (rfid.PICC_IsNewCardPresent() && rfid.PICC_ReadCardSerial()) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Card detected");
// Add your RFID authentication logic here
// For now, we assume the card is valid
lcd.setCursor(0, 1);
lcd.print("Access Granted");
myServo.write(90); // Unlock position
digitalWrite(BUZZER_PIN, HIGH);
delay(1000);
digitalWrite(BUZZER_PIN, LOW);
delay(5000); // Keep unlocked for 5 seconds
myServo.write(0); // Lock position
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Welcome!");
lcd.setCursor(0, 1);
lcd.print("Scan your card");
}
// Check for keypad input
char key = keypad.getKey();
if (key) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Key pressed:");
lcd.setCursor(0, 1);
lcd.print(key);
// Add your keypad handling logic here
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Welcome!");
lcd.setCursor(0, 1);
lcd.print("Scan your card");
}
}
This code initializes the components and provides the main logic for the Secure Entry Management System. The system checks for RFID card presence and keypad input, providing appropriate feedback and controlling the servo motor and buzzer accordingly.