RFID based access control system with ESP32 card

ESP32 19-03-25
134 0

Tutorial plan

1- What is an access control system ?

2- Presentation of RFID based access control system by ESP32

3- Required Components

4- Circuit Connections of system

5- Micropython program to control our system

 

 

What is an access control system ?

An Access Control System (ACS) is a security mechanism that regulates who or what can view, enter, or use resources within a system, building, or network. It ensures that only authorized individuals or devices can access specific areas or data while preventing unauthorized access.

Types of Access Control Systems

1- Physical Access Control – Restricts access to physical locations such as buildings, rooms, or secure areas using:
- Key cards or RFID badges

- PIN codes or passwords

- Biometrics (fingerprint, facial recognition, etc.)

- Mobile apps or NFC technology

2- Logical Access Control – Manages access to digital systems, networks, and data using:

- User authentication (passwords, two-factor authentication)

- Role-based access control (RBAC)

- Encryption and security policies

Components of an Access Control System

- Authentication Devices – RFID readers, keypads, biometric scanners

- Control Panel – Processes access requests and grants or denies access

- Locks & Barriers – Electronic locks, turnstiles, or gates

- Access Control Software – Manages user permissions and logs access events

- User Database – Stores authorized user credentials

Benefits of an Access Control System

- Enhanced security and reduced risk of unauthorized access

- Improved tracking and monitoring of entry and exit

- Convenient and flexible access management

- Integration with security cameras and alarms for better surveillance

 

Presentation of RFID based access control system by ESP32

This project demonstrates an RFID-based access control system using an ESP32 microcontroller. The system reads RFID cards or badges, verifies access permissions, and provides feedback through an LCD I2C display, a buzzer, and an RGB LED module. This type of system is commonly used in offices, schools, and secure areas to restrict unauthorized access.

1- The RFID-RC522 module continuously scans for RFID cards/badges.

2- When a card is placed near the reader, the ESP32 retrieves the Unique Identifier (UID) of the card.

3- The ESP32 compares the UID with a predefined list of authorized users stored in the code or EEPROM.

4- Based on the verification result:

a) If authorized, the system displays "Access Granted", turns the RGB LED green.

b) If unauthorized, the system displays "Access Denied", turns the RGB LED red, and activates the buzzer (long beep).

 

Required Components

ESP32 Microcontroller

The ESP32 is the main controller of the system, responsible for reading the RFID card data, verifying access permissions, and controlling outputs such as the LCD display, buzzer, and RGB LED.

It supports multiple GPIO pins, making it suitable for interfacing with different modules like the RFID-RC522, LCD, buzzer, and LED.

RFID RC-522 Module

The RFID-RC522 module is responsible for reading RFID cards and tags using radio frequency identification (RFID).

It operates at 13.56 MHz and supports reading and writing to RFID cards.

The module communicates with the ESP32 via SPI protocol.

When a card is scanned, the module retrieves the Unique Identifier (UID) and sends it to the ESP32 for processing.

RFID Card/Badge

The RFID card or badge is used as an authentication key.

Each card has a unique ID (UID) stored in its memory.

The RFID-RC522 module reads this UID when the card is brought close to it.

If the UID matches a predefined list of authorized users, access is granted.

LCD I2C Display (16x2 or 20x4)

The LCD display provides real-time feedback to the user.

It shows messages such as “Scan Your Card”, “Access Granted”, or “Access Denied”.

The I2C interface reduces the number of required pins, making it easier to connect to the ESP32.

Buzzer

The buzzer provides audio feedback based on access status.

It produces a long beep when access is denied.

RGB LED Module

The RGB LED module provides visual feedback:

- Green LED: Access granted

- Red LED: Access denied

 

Circuit Connections of system

Connection of RFID-RC522 module

RFID-RC522 Pin

ESP32 Pi

VCC

3V3

RST

GPIO 2

GND

GND

MISO

GPIO 19

MOSI

GPIO 23

SCK

GPIO 18

SDA (SS)

GPIO 5

Connection of I2C LCD display

LCD I2C Pin

ESP32 pin

VCC

5 volt

GND

GND

SDA

GPIO 21

SCL

GPIO 22

Connection of Buzzer

Buzzer pin

ESP32 pin

(+) pin

GPIO 17

(-) pin

GND

Connection of RGB LED module

LED RGB pin

ESP32 pin

Red pin

GPIO 16

Green pin

GPIO 4

GND pin

GND pin

 

Micropython program to control our system

Before running the code, install the necessary libraries:

- MFRC522 (for RFID module)

- i2c_lcd and lcd_api for I2C LCD screen

Explanation of the Code

1- Initializing Components

The ESP32 SPI pins are configured for the RFID-RC522 module.

The I2C communication is set up for the LCD display.

The Buzzer and RGB LED are initialized for feedback.

2- Scanning for RFID Cards

The program continuously scans for RFID badges.

When a card is detected, it extracts the UID and converts it into a string.

3- Checking Authorization

If the UID matches the predefined list, access is granted.

Otherwise, access is denied.

4- Providing Feedback

The LCD screen displays messages like “Authorized access” or “Access Denied”.

The RGB LED turns Green (granted) or Red (denied).

The buzzer beeps differently for each outcome.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info