Skip to main content
Version: FILS English

Dual-Mode Access Control System

Dual-Mode Access Control System with RFID and Keypad using Raspberry Pi Pico 2W

info

Author: BÎTLAN Adrian-Gabriel
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-Bitlee1407

Description​

This project implements a smart, dual-mode access control system using the Raspberry Pi Pico 2W. It allows entry through either RFID authentication or a PIN code entered via a keypad. A successful authentication unlocks a servo motor simulating door access, lights up a green LED, and plays a confirmation beep. Unsuccessful attempts trigger a red LED and a warning tone. The system is built entirely in Rust using the Embassy asynchronous framework, ensuring efficient multitasking and responsive hardware control.

Motivation​

In an increasingly connected world, secure and flexible access control solutions are essential. Traditional keys are inconvenient and often insecure. RFID and PIN-based systems offer better control, and combining both in one embedded system offers even greater flexibility and security. By using the Rust programming language and the Embassy async framework, this project demonstrates modern embedded development with safe concurrency, targeting real-world problems. The use of both keypad and RFID readers adds redundancy and versatility, making the system ideal for shared workspaces, maker labs, or educational facilities.

Architecture​

Raspberry Pi Pico 2W
β€’ Role: Acts as the "brain" of the system β€” it controls all components: handles input from the RFID reader and keypad, updates the LCD display, drives the LEDs and buzzer, and sends signals to the servo motor.
β€’ Connections:
β€’ I2C (GP20 = SDA, GP21 = SCL) to LCD
β€’ SPI (GP16 = MISO, GP17 = CS, GP18 = SCK, GP19 = MOSI) to RFID
β€’ GPIO (GP2–GP9) to keypad
β€’ PWM (GP15) to servo
β€’ GPIO (GP14) to buzzer
β€’ GPIO (GP26 = Green LED, GP27 = Red LED)

LCD1602 Display (I2C)
β€’ Interface: I2C
β€’ Role: Displays prompts, user greetings, and access status messages.
β€’ Connections:
β€’ SDA to GP20
β€’ SCL to GP21
β€’ VCC to 3.3V
β€’ GND to GND

4x4 Matrix Keypad
β€’ Interface: GPIO
β€’ Role: Accepts numeric PIN input from the user for access control.
β€’ Connections:
β€’ Rows to GP2, GP3, GP4, GP5
β€’ Columns to GP6, GP7, GP8, GP9
β€’ Powered from 3.3V and GND

RFID Reader (MFRC522)
β€’ Interface: SPI
β€’ Role: Reads the UID from RFID cards or tags for identity verification.
β€’ Connections:
β€’ SDA/CS to GP17
β€’ SCK to GP18
β€’ MOSI to GP19
β€’ MISO to GP16
β€’ RST to GP22
β€’ VCC to 3.3V
β€’ GND to GND

Green & Red LEDs
β€’ Interface: GPIO
β€’ Role: Visual feedback β€” green for access granted, red for access denied.
β€’ Connections:
β€’ Green LED to GP26 (with 330Ξ© resistor to GND)
β€’ Red LED to GP27 (with 330Ξ© resistor to GND)

Passive Buzzer
β€’ Interface: GPIO
β€’ Role: Emits a tone as sound feedback when access is granted or denied.
β€’ Connections:
β€’ Signal to GP14
β€’ VCC to 3.3V
β€’ GND to GND

Servo Motor
β€’ Interface: PWM
β€’ Role: Simulates door movement when access is granted.
β€’ Connections:
β€’ Signal to GP15
β€’ VCC to External 5V battery
β€’ GND to Shared GND with Pico

External 5V Battery
β€’ Role: Powers the servo motor which requires more current than the Pico’s 3.3V rail can provide.
β€’ Connections:
β€’ +5V to Servo VCC
β€’ GND to Pico GND (shared ground reference)

Log​

Week 5 - 11 May​

In the first week, I bought all my components for the project, including the Raspberry Pi Pico 2W, MFRC522 RFID reader, LCD1602 I2C display, 4x4 keypad, LEDs, passive buzzer, servo motor, and jumper wires. I organized and connected them on a breadboard, preparing for testing and prototyping.

Week 12 - 18 May​

In the second week, I connected the MFRC522 RFID reader and the LCD1602 I2C display to the Raspberry Pi Pico 2W and successfully displayed messages on the screen after scanning RFID cards. I also tested the green and red LEDs β€” they turn on based on access permission status from RFID scanning.

Week 19 - 25 May​

Integrated all components: RFID, keypad, LCD, LEDs, servo, and buzzer. Finalized logic and behavior for access granted/denied. System fully functional and stable.

Hardware​

β€’ Raspberry Pi Pico 2W β†’ Acts as the central controller, coordinating all inputs and outputs for access control.
β€’ LCD1602 Display (I2C) β†’ Displays access prompts, user greetings, and authentication status.
β€’ 4x4 Matrix Keypad β†’ Captures user-entered PIN codes for authentication.
β€’ RFID Reader (MFRC522) β†’ Reads RFID card UIDs to identify authorized users.
β€’ Green LED β†’ Lights up to indicate access has been granted.
β€’ Red LED β†’ Lights up to signal that access has been denied.
β€’ Passive Buzzer β†’ Emits an alert sound based on access result (granted or denied).
β€’ Servo Motor β†’ Simulates a door unlocking mechanism when access is granted.
β€’ External 5V Battery β†’ Provides sufficient power for high-draw components like the servo motor.

LateralStanga

CentruSus

LateralDreapta

Schematics​

KiCadScheme

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2 WThe main board40 LEI
Raspberry Pi Pico WUsed as debug probe40 LEI
MFRC522 RFID ReaderReads RFID tags10 LEI
LCD1602 with I2CDisplays prompts and status17 LEI
4x4 Matrix KeypadPIN input method7 LEI
SG90 Servo MotorUsed to move the barrier12 LEI
Buzzer PasivEmits sound feedback2 LEI
GREEN LedIndicates "Access Permitted."0.40 LEI
RED LedIndicates "Access Denied."0.40 LEI
BreadboardPut components on it30 LEI
Female-to-Male WiresFor wiring3 LEI
Male-to-Male WiresFor wiring30 LEI

Software​

LibraryDescriptionUsage
embassy-executorAsync task executor for embedded systemsRuns concurrent tasks like keypad scanning, RFID polling, and feedback control
embassy-rpHardware abstraction layer for the RP2040Interfaces with peripherals like SPI (RFID), I2C (LCD), GPIO (LEDs), and PWM (Servo)
embassy-timeTimers and delays for async codeImplements non-blocking delays and timeout logic
embassy-syncAsync synchronization primitivesCoordinates shared access to peripherals across tasks
embedded-halUnified hardware interface traitsDefines abstract traits for embedded drivers
embedded-hal-asyncAsync traits for embedded-halEnables async I2C, SPI, and GPIO interfaces for peripheral drivers
defmtLightweight logging for embedded systemsUsed to debug the system without printing over serial
defmt-rttLogging backend via RTTSends logs through debug probes to the host for analysis
hd44780-driverDriver for HD44780-based character LCDsControls the LCD1602 display to show messages via I2C (like access granted/denied)
mfrc522Driver for MFRC522 RFID readersReads and interprets RFID card UIDs over SPI for access control logic
  1. link
  2. link ...