How to Make an RFID Door Lock

An RFID door lock works by powering a passive card or tag with radio waves rather than a battery: the reader module emits a 13.56MHz field, the card borrows enough energy from that field to answer back with its unique ID, the microcontroller checks that ID against a stored list of authorized cards, and — if it matches — the microcontroller drives a servo or solenoid to move the bolt. Nothing about the card is "read" in the sense of decrypting a secret; the reader is simply asking "who are you," and the firmware is the part deciding what to do with the answer.

What parts does an RFID door lock need?

A basic version of this build needs five active parts and some wire. Soldr, Compoden's storefront assistant, picked exactly this set of parts when asked to build one:

  • Arduino Uno — runs the firmware, reads the RFID module over SPI, and drives the servo with a PWM signal.
  • MFRC522 RFID reader module — the part that actually powers and reads the card. It talks to the Uno over SPI and runs on 3.3V logic, not 5V.
  • MIFARE Classic RFID card or tag — the credential. It's a passive chip with no battery; it only responds when it's inside the reader's field.
  • SG90 micro servo — the actuator. A cheap hobby servo is enough to rotate a bolt or latch a fraction of a turn; a heavier deadbolt would need a solenoid or a geared motor instead.
  • Breadboard wire and a 5V power supply — for prototyping the circuit before it goes into an enclosure.

The one part worth double-checking before buying is the reader. Some RFID listings are passive tags, not reader modules — they can't power a card or talk SPI to the Arduino at all, and a project built around one alone won't work. A genuine MFRC522 reader module is priced around Rs.150-250; RFID cards and tags are the cheap Rs.10-75 accessory, not the part that does the reading.

How do you find your RFID card's unique ID?

Every MIFARE card has a UID burned in at manufacture, and the firmware's authorized-card check is nothing more than a string comparison against that UID. To find it, upload a UID-dump sketch first — the MFRC522 Arduino library ships one in its examples (usually called DumpInfo or ReadNUID) — wave the card in front of the reader, and read the UID printed to the Serial Monitor, typically four bytes shown in hex like DE AD BE EF. That value gets hardcoded into an array in the door-lock firmware as the "authorized" list; scan any card not in that array and the servo doesn't move. Repeat the dump step once per card you want to authorize.

How do you wire the MFRC522 to an Arduino Uno?

The MFRC522 communicates over SPI, which on an Uno means four of its connections are fixed by the hardware SPI bus and only two are configurable in firmware:

Arduino Uno pin MFRC522 pin Signal
3.3V VCC Power — 3.3V only, do not connect to 5V
GND GND Ground
Digital pin 10 SDA (SS) SPI Slave Select — configurable
Digital pin 13 SCK SPI Clock — fixed by hardware SPI
Digital pin 11 MOSI SPI data out — fixed by hardware SPI
Digital pin 12 MISO SPI data in — fixed by hardware SPI
Digital pin 2 RST Reset — configurable
— (not connected) IRQ Unused in polling-based firmware

The MFRC522's logic runs at 3.3V and it is not 5V-tolerant, which is the single most common way this module gets damaged: wiring VCC to the Uno's 5V rail instead of its 3.3V pin. The IRQ pin only matters if the firmware waits on a hardware interrupt for card detection instead of polling; most Arduino MFRC522 sketches, including the one generated for this build, poll the reader in the main loop and leave IRQ disconnected. The servo's signal wire is separate from all of this and connects to its own PWM-capable digital pin — pin 3 in the firmware generated for this build — with the servo's power leads going to the 5V supply, not through the Arduino's onboard regulator, since a servo under load can pull enough current to brown out the board.

Is this secure enough for a real door?

Be clear-eyed about what this build actually protects against. A MIFARE Classic UID check is authentication by "does this number appear in my list," not encryption — the UID is broadcast in the clear every time the card is scanned, and cheap RFID card duplicators sold for a few hundred rupees can clone a MIFARE Classic UID onto a blank card in seconds without ever touching the original owner. That's fine for a bedroom door, a project box, a cabinet, or a hobby demonstration of access control. It is not equivalent to a deadbolt with a real key, a smart lock with rolling codes, or anything a bank, an office with real assets behind it, or a front door with valuables behind it should rely on as the only line of defense. If real security matters, this circuit is better used as one layer — logging entries, triggering a camera, or gating a less-important door — alongside a physical lock, not replacing one.

Watch it built live

We typed this into Compoden's storefront assistant, Soldr, exactly as a customer would:

"I want to build an RFID-based door lock that unlocks with a servo motor when an authorized card is scanned, using an Arduino Uno"

Compoden storefront AI assistant Soldr building an RFID door lock parts tray with Arduino Uno, MFRC522 reader, MIFARE card, and SG90 servo

Soldr assembled a six-part tray on the first pass and explained the build in plain language: "This build creates a security system for a door. When you scan an authorized MIFARE Classic 1K RFID Card, a small motor will turn to unlock the door. This system uses radio waves to read information from the card and decide if it should open the lock." On the reader specifically, it noted: "The MFRC522 RFID Module is the part that reads the RFID cards. It uses the SPI interface to communicate with the Arduino. This module operates at 3.3V logic, meaning its signals are at 3.3 volts, and it needs a 3.3V power supply." It also flagged the exact wiring risk covered above unprompted: "The MFRC522 RFID Module and the MIFARE Classic 1K RFID Card operate at 3.3V logic and require a 3.3V power input. Connecting them directly to the 5V output of the power supply or the 5V logic of the Arduino Uno can damage them."

Watch the firmware get generated

We then took the same project to Compoden's VoltIQ code assistant and asked it to write working firmware:

"I'm building an RFID door lock with an Arduino Uno, an MFRC522 RFID reader, and a servo motor. Write the full firmware to check a scanned card's UID against an authorized list and rotate the servo to unlock if it matches."

VoltIQ PWA generated Arduino firmware for MFRC522 RFID door lock showing SPI pin definitions and servo library includes

VoltIQ described its own plan before the code appeared: "The sketch will read RFID UIDs, compare them to a hardcoded authorized list, and control an SG90 servo on pin 3 to unlock/lock." The generated sketch includes SPI.h, MFRC522.h, and Servo.h, and opens with the same SPI pin assignments used in the wiring table above, spelled out in its own comments: #define SS_PIN 10 for the MFRC522's Slave Select and #define RST_PIN 2 for Reset, followed by a wiring block confirming SCK on pin 13, MOSI on pin 11, and MISO on pin 12 as fixed hardware-SPI pins. The build instructions were explicit about the one manual step this project needs before it will compile: "Upload this sketch to your Arduino Uno using the Arduino IDE. Install via Library Manager: MFRC522, Servo" — neither library ships with the Arduino IDE by default.

Get everything in this build

These are the exact parts Soldr selected for this build, with live prices and direct add-to-cart links.

Part Price Add to cart
Arduino Uno R3 CH340G ATmega328P Board Rs.230 Add to cart
MFRC522 RFID Module Rs.180 Add to cart
MIFARE Classic 1K RFID Card Rs.75 Add to cart
SG90 9g Micro Servo Motor Rs.120 Add to cart
23 AWG Multi-Strand Breadboard Wire Rs.10 Add to cart
USB-C 5V 3A Power Supply Adapter Rs.180 Add to cart
Total Rs.795 Add all 6 to cart

The reader listed above is a genuine MFRC522 module, not a passive tag mislabeled as one — it's a separate line item from the MIFARE card itself, priced and specced the way an actual reader is. A real deadbolt-grade solenoid lock is a heavier, separate purchase than the SG90 servo above; the servo is the right choice for a demonstration or a light latch, and swapping in a 12V solenoid lock module and relay is the natural upgrade path for a build meant to control an actual door bolt.

Built and Backed by Compoden

Every part listed above ships from Compoden's India stock, so there's no long international shipping wait on an RFID module or a servo. Parts are checked for compatibility with the boards they're paired with before they're listed together in a build like this one. Orders typically arrive in 3-7 days, Cash on Delivery and UPI are both supported at checkout, and Compoden's support team is available if you run into wiring or firmware issues while building.

Frequently asked questions

Do I need to buy the RFID reader and RFID cards separately?
Yes. The MFRC522 module is the reader — it does the powering and reading of cards — and the MIFARE card or tag is the credential it reads. They're two different products at two very different price points (roughly Rs.180 for the reader versus Rs.15-75 for a card or a pack of cards), and a build needs at least one of each.

Why does the MFRC522 need 3.3V when the Arduino Uno runs on 5V?
The MFRC522's internal chip is only rated for 3.3V logic and is not 5V-tolerant, so its VCC pin must connect to the Uno's dedicated 3.3V output pin, not the 5V pin. The SPI data lines (SCK, MOSI, MISO, SS, RST) are commonly wired directly from the Uno's 5V-logic pins without a level shifter in most hobbyist builds, but the power pin itself has to stay on 3.3V or the module can be damaged.

How do I authorize more than one card?
Dump the UID of each card using a UID-reading sketch, then add each UID as an entry in the firmware's authorized-list array. The comparison logic checks the scanned UID against every entry in that array, so the list can hold as many cards as the Arduino's memory comfortably allows.

Is a MIFARE Classic card-based lock secure against someone cloning my card?
Not against a determined attacker. MIFARE Classic broadcasts its UID in the clear, and inexpensive RFID duplicators can copy that UID onto a blank card without needing the original. This build is appropriate for a hobby project, a bedroom door, or a demonstration of access control — not as the sole lock on a door protecting anything valuable.

Back to blog