Dual-Mode Access Control System
Dual-Mode Access Control System with RFID and Keypad using Raspberry Pi Pico 2W
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.



Schematicsβ
Bill of Materialsβ
| Device | Usage | Price |
|---|---|---|
| Raspberry Pi Pico 2 W | The main board | 40 LEI |
| Raspberry Pi Pico W | Used as debug probe | 40 LEI |
| MFRC522 RFID Reader | Reads RFID tags | 10 LEI |
| LCD1602 with I2C | Displays prompts and status | 17 LEI |
| 4x4 Matrix Keypad | PIN input method | 7 LEI |
| SG90 Servo Motor | Used to move the barrier | 12 LEI |
| Buzzer Pasiv | Emits sound feedback | 2 LEI |
| GREEN Led | Indicates "Access Permitted." | 0.40 LEI |
| RED Led | Indicates "Access Denied." | 0.40 LEI |
| Breadboard | Put components on it | 30 LEI |
| Female-to-Male Wires | For wiring | 3 LEI |
| Male-to-Male Wires | For wiring | 30 LEI |
Softwareβ
| Library | Description | Usage |
|---|---|---|
| embassy-executor | Async task executor for embedded systems | Runs concurrent tasks like keypad scanning, RFID polling, and feedback control |
| embassy-rp | Hardware abstraction layer for the RP2040 | Interfaces with peripherals like SPI (RFID), I2C (LCD), GPIO (LEDs), and PWM (Servo) |
| embassy-time | Timers and delays for async code | Implements non-blocking delays and timeout logic |
| embassy-sync | Async synchronization primitives | Coordinates shared access to peripherals across tasks |
| embedded-hal | Unified hardware interface traits | Defines abstract traits for embedded drivers |
| embedded-hal-async | Async traits for embedded-hal | Enables async I2C, SPI, and GPIO interfaces for peripheral drivers |
| defmt | Lightweight logging for embedded systems | Used to debug the system without printing over serial |
| defmt-rtt | Logging backend via RTT | Sends logs through debug probes to the host for analysis |
| hd44780-driver | Driver for HD44780-based character LCDs | Controls the LCD1602 display to show messages via I2C (like access granted/denied) |
| mfrc522 | Driver for MFRC522 RFID readers | Reads and interprets RFID card UIDs over SPI for access control logic |