Smart door access control using ESP32 and RFID card

ESP32 24-04-25
9 0

Tutorial plan

1- Introduction

2- Description of ESP32 Smart Door Access

3- Required Components

4- Circuit Connections of system

5- Micropython program of system

 

 

Introduction

A Smart Door Access Control System using a reader card is an electronic security system that restricts or grants access to a building or room based on the authentication of a card. It is widely used in homes, offices, schools, hospitals, and industrial facilities to enhance physical security.

Key Components (General)

1. Reader Card System (RFID/NFC/Magnetic Stripe Reader):

Scans or reads a card that contains user identification data.

Most commonly uses RFID (Radio Frequency Identification) or NFC (Near Field Communication).

Can be contactless or swipe-based.

2. Identification Card/Tag:

A card (e.g., RFID card, NFC tag, smart ID) containing a unique ID number.

Acts as the user's key.

3. Access Control Unit (Controller):

The central processor (microcontroller, computer, or cloud-based system).

Compares the card’s ID with a list of authorized users stored in memory or database.

Makes decisions (grant or deny access).

4. Door Lock Mechanism:

Typically an electromagnetic lock, electric strike lock, or servo/solenoid-based system.

Unlocks automatically when access is granted.

5. Power Supply:

Provides necessary voltage and current to all components.

Usually includes backup battery support for power failures.

6. Feedback Mechanisms (Optional):

Display (LCD/OLED): To show messages (e.g., Access Granted/Denied).

Buzzer: For audible feedback.

LEDs: For visual status indication.

How It Works – Step-by-Step

1- User presents their card near the reader or swipes it.

2- Card reader reads the unique ID from the card.

3- Controller receives and verifies the ID against a list of authorized users:

4- Stored locally in memory (microcontroller systems) or remotely in a cloud-based or database system.

5- Based on the result:

a) If Authorized:

- Controller activates the lock to open the door.

- Feedback is provided (e.g., green LED, beep, “Access Granted” on screen).

b) If Not Authorized:

- Access is denied.

- Red LED or buzzer alerts user.

- The door is automatically relocked after a certain time (usually 3–10 seconds).

Features and Benefits

Security

- Prevents unauthorized access.

- Tracks entries with time logs (optional).

Convenience

- Fast and contactless access with just a card swipe or tap.

Automation

- Reduces human involvement in access management.

Scalability

- Supports addition/removal of users easily.

- Can be extended to multiple doors or zones.

 

Description of ESP32 Smart Door Access

This system allows or restricts access to a door using an RFID card. The ESP32 microcontroller reads the card's unique ID via the RC522 RFID reader, compares it with stored authorized IDs, and opens the door (via a servo motor) if access is granted. A message is displayed on an LCD I2C display to inform the user of the result.

How It Works

1- Initialization

On startup, the ESP32 initializes all components: RFID reader, LCD, and servo.

The LCD displays a message like “Scan your card”.

2- Card Scanning

When a card is brought near the RC522 reader, it captures the card’s UID (Unique Identifier).

3- UID Comparison

The UID is compared with a list of authorized UIDs stored in the ESP32’s memory (e.g., in code or EEPROM).

4- Access Decision

a) If UID matches an authorized user:

LCD displays “Access Granted”.

Servo rotates to unlock the door (e.g., 20°).

The user approaches the RFID card to the RC522 reader again, the servomotor close the door (e.g., 90°).

b) If UID is unauthorized:

LCD displays “Access Denied”.

Servo remains in the locked position.

5- Repeat

The system loops, waiting for the next card scan.

 

Required Components

ESP32 Microcontroller

Role: Acts as the central control unit for the entire smart door system

RFID-RC522 Reader Module

Role: Reads the UID (Unique Identifier) from an RFID card or tag.

RFID Card / Tag

Role: Provides a unique digital key that identifies a user.

Servo Motor (e.g., SG90 or MG90S)

Role: Physically acts as the door lock actuator by rotating between locked and unlocked positions.

LCD I2C Display

Pinouts of 1602 LCD display with I2C

Role: Displays system status and user prompts (e.g., “Scan Card”, “Access Granted”).

Breadboard

Breadboard

Role : is used for prototyping and connecting components without soldering.

Jumper Wires

Fils de connexion

Role: are used to make connections between components on the breadboard, Micro:bit, and GPIO extension card.

Wooden house prototype

A miniature wooden house represents a real-world structure.

The door mechanism is attached to a servo motor, which rotates to open or close it.

The wooden prototype provides a stable frame for installing components like the IR sensor and LCD screen.

Circuit Connections of system

Connection of I2C LCD display

LCD I2C Pin

ESP32 pin

VCC

5 volt

GND

GND

SDA

GPIO 21

SCL

GPIO 22

Connection of servo motor

Servo motor

ESP32

Brown wire (-)

GND

Red wire (+)

5V

Yellow wire (Signal)

GPIO 23

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

 

Micropython program of system

Before running the code, install the necessary libraries:

- MFRC522 (for RFID module)

- i2c_lcd and lcd_api for I2C LCD screen

- Servo (for servo motor)

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