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.
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.
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).
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.
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.
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.
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
Role: Displays system status and user prompts (e.g., “Scan Card”, “Access Granted”).
Breadboard
Role : is used for prototyping and connecting components without soldering.
Jumper Wires
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.
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 |
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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
import machine from machine import Pin, SPI,SoftI2C from time import sleep from servo import Servo from lcd_api import LcdApi from i2c_lcd import I2cLcd from mfrc522 import MFRC522 # ==== LCD Setup ==== I2C_ADDR = 0x27 totalRows = 4 totalColumns = 20 i2c = SoftI2C(scl=Pin(22), sda=Pin(21), freq=10000) #initializing the I2C method for ESP32 lcd = I2cLcd(i2c, I2C_ADDR, totalRows, totalColumns) # ==== RFID RC-552 module Setup ==== sck = Pin(18, Pin.OUT) mosi = Pin(23, Pin.OUT) miso = Pin(19, Pin.OUT) sda = Pin(5, Pin.OUT) spi = SPI(baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso) # ==== Servo Setup ==== motor=Servo(pin=17) motor.move(90) # rotate the servo to close the door position_door=90 lcd.clear() lcd.move_to(0,1) lcd.putstr("Scan your card") #print "Scan your card" on LCD display lcd.move_to(0,2) lcd.putstr("to open the door") while True: rdr = MFRC522(spi, sda) uid = "" (stat, tag_type) = rdr.request(rdr.REQIDL) if stat == rdr.OK: # Look for new RFID cards (stat, raw_uid) = rdr.anticoll() if stat == rdr.OK: uid = ("0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3])) # Read the UID of RFID card print(uid) if uid=="0x2334a703" or uid=="0x717ab601" : # verify if the ID card belongs to the list of authorized identifiers if position_door==90: # if the door is closed lcd.clear() lcd.move_to(1,1) lcd.putstr("Authorized access") lcd.move_to(1,2) lcd.putstr("The door opens") for i in range(91,19,-1): motor.move(i) # rotate the servo to open the door sleep(0.1) position_door=20 lcd.clear() lcd.move_to(1,1) lcd.putstr("Poor open") sleep(5) lcd.clear() lcd.move_to(0,1) lcd.putstr("Scan your card") lcd.move_to(0,2) lcd.putstr("to close the door") else: if position_door==20: # if the door is open lcd.clear() lcd.move_to(1,1) lcd.putstr("Door closes") for i in range(20,91): motor.move(i) # rotate the servo to close the door sleep(0.1) position_door=90 lcd.clear() lcd.move_to(1,1) lcd.putstr("Door closed") sleep(5) lcd.clear() lcd.move_to(0,1) lcd.putstr("Scan your card") lcd.move_to(0,2) lcd.putstr("to open the door") else : if the ID card doest not belongs to the list of authorized identifiers lcd.clear() lcd.move_to(1,1) lcd.putstr("Card refused") lcd.move_to(0,2) lcd.putstr("impossible to open ") lcd.move_to(0,3) lcd.putstr("the door !!!") sleep(5) lcd.clear() lcd.move_to(0,1) lcd.putstr("Scan your card") lcd.move_to(0,2) lcd.putstr("to open the door") |
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.
Zaouiet Kontech-Jemmel-Monastir-Tunisia
+216 92 886 231
medaliprof@gmail.com
Robotic site created by MedAli-Teacher info