Skip to content

COD nationwide · Isb & Rwp delivery Rs 400

akCircuit
IntermediateHome & safety 3 hours Arduino Uno

RFID door lock

Tap a card, the door opens

An Arduino reads RFID cards with an RC522 reader, greets you on an LCD and unlocks a 12 V solenoid lock through a relay. Wrong cards get a red light and a buzz. Great for a room, cupboard or drawer.

Every required part

Rs 4,077

Parts list

19 items

  • Every required part in stock
  • Wiring and code included
  • Cash on delivery
RFID door lock: Tap a card, the door opens
From our reel · 9 Dec 2026

Parts list

Everything you need for the rfid door lock

Every part below is in our catalogue at today's price, so the total is what you pay. Required parts are ticked; optional upgrades are not.

Required parts are ticked. Untick anything you already have; the total updates as you go.

Main parts

Power

Wiring & mounting

Optional upgrades

You also need (most homes have these)

  • Phone charger (USB, 5 V)Powers the Arduino, reader and screen.

17 items

Rs 4,077

From our reel

Watch it come together in 12 steps

The reel of this build goes live on 9 Dec 2026, 7 pm. Follow us to watch it:

YouTube Instagram Facebook
  1. Step 1: The parts

    1The parts

  2. Step 2: Wire the RC522 reader

    2Wire the RC522 reader

  3. Step 3: Add the relay

    3Add the relay

  4. Step 4: Connect the solenoid lock

    4Connect the solenoid lock

  5. Step 5: Add the LCD

    5Add the LCD

  6. Step 6: Upload the code

    6Upload the code

  7. Step 7: Right tag → green

    7Right tag → green

  8. Step 8: Click! Unlocked

    8Click! Unlocked

  9. Step 9: Wrong card → red

    9Wrong card → red

  10. Step 10: Mount it by the door

    10Mount it by the door

  11. Step 11: Tap to enter

    11Tap to enter

  12. Step 12: Your own smart lock

    12Your own smart lock

How it works

What each part does

Every RFID card and tag has its own ID number. When you hold one near the RC522, the reader powers the card by radio and reads that ID, and the Arduino compares it with the list of allowed IDs in the code.

For an allowed card, the Arduino shows “Welcome” on the LCD, lights the green LED and switches the relay on for 3 seconds. The relay connects the 12 V adapter to the solenoid, which pulls its bolt in and the door opens. Any other card gets a red light and a buzz.

The relay keeps the 12 V lock circuit completely separate from the 5 V Arduino, so the two are powered by different supplies.

Wiring

Connect it pin by pin

Switch the power off while you wire, and connect every GND together unless the table says otherwise.

RC522 reader (SPI)

FromToNote
RC522 SDA→ Arduino D10
RC522 SCK→ Arduino D13
RC522 MOSI→ Arduino D11
RC522 MISO→ Arduino D12
RC522 RST→ Arduino D9
RC522 3.3V→ Arduino 3.3VNot 5 V
RC522 GND→ Arduino GNDIRQ is not used

Screen, relay, LEDs and buzzer

FromToNote
LCD SDA→ Arduino A4
LCD SCL→ Arduino A5
LCD VCC / GND→ Arduino 5V / GND
Relay IN→ Arduino D7
Relay VCC / GND→ Arduino 5V / GND
Green LED (through 470 Ω)→ Arduino D5
Red LED (through 470 Ω)→ Arduino D6
Buzzer +→ Arduino D8

Lock circuit (12 V)

FromToNote
DC socket red (+12 V)→ Relay COM
Relay NO→ Lock red wire
Lock black wire→ DC socket black (−)Join them in the quick connector
1N4007 diode→ Across the lock's two wiresStriped end to the red (+) wire

The code

Ready-to-upload Arduino code

Copy it into the Arduino IDE, change the settings at the top if your build needs it, and upload.
RFID door lockBoard: Arduino UnoMFRC522 (GithubCommunity)LiquidCrystal I2C (Frank de Brabander)
rfid_lock.ino
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

MFRC522 rfid(10, 9);                 // SDA (SS) pin, RST pin
LiquidCrystal_I2C lcd(0x27, 16, 2);  // try 0x3F if the screen stays blank

const int RELAY_PIN = 7, GREEN_LED = 5, RED_LED = 6, BUZZER = 8;
const int RELAY_ON = LOW;            // most relay modules switch on with LOW

// Card IDs allowed to open the door. Tap a card and read its ID in the Serial Monitor.
const byte ALLOWED[][4] = {
  {0xDE, 0xAD, 0xBE, 0xEF},
};

bool allowed(const byte *uid) {
  for (auto &card : ALLOWED) {
    if (memcmp(card, uid, 4) == 0) return true;
  }
  return false;
}

void showReady() {
  lcd.clear();
  lcd.print("Door locked");
  lcd.setCursor(0, 1);
  lcd.print("Tap your card");
}

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  lcd.init();
  lcd.backlight();
  digitalWrite(RELAY_PIN, !RELAY_ON);  // start locked
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
  pinMode(BUZZER, OUTPUT);
  showReady();
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;

  Serial.print("Card ID:");
  for (byte i = 0; i < rfid.uid.size; i++) {
    Serial.print(" 0x");
    Serial.print(rfid.uid.uidByte[i], HEX);
  }
  Serial.println();

  lcd.clear();
  if (rfid.uid.size == 4 && allowed(rfid.uid.uidByte)) {
    lcd.print("Welcome!");
    lcd.setCursor(0, 1);
    lcd.print("Door open");
    digitalWrite(GREEN_LED, HIGH);
    digitalWrite(RELAY_PIN, RELAY_ON);   // unlock
    delay(3000);
    digitalWrite(RELAY_PIN, !RELAY_ON);  // lock again
    digitalWrite(GREEN_LED, LOW);
  } else {
    lcd.print("Access denied");
    digitalWrite(RED_LED, HIGH);
    digitalWrite(BUZZER, HIGH);
    delay(1000);
    digitalWrite(BUZZER, LOW);
    digitalWrite(RED_LED, LOW);
  }
  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
  showReady();
}

Step by step

Build it

  1. 1

    Wire the reader and screen

    Connect the RC522 to the SPI pins and the LCD to A4/A5 as in the tables. Power the RC522 from 3.3 V only.

  2. 2

    Read your cards' IDs

    Install the two libraries, upload the code and open the Serial Monitor at 9600 baud. Tap each card: its ID prints as four numbers like 0x5A 0x1F 0x9C 0x3B.

  3. 3

    Allow your cards

    Replace 0xDE, 0xAD, 0xBE, 0xEF with your card's four numbers. Add one line per card, then upload again.

  4. 4

    Add the relay, LEDs and buzzer

    Wire the relay's IN to D7 and the LEDs and buzzer on the breadboard. Tap the allowed card: you should hear the relay click.

  5. 5

    Connect the lock

    Build the 12 V circuit through the relay's COM and NO terminals, with the diode across the lock. Only then plug the 12 V adapter in.

  6. 6

    Fit it to the door

    Mount the lock on the inside of the door or drawer, the reader just behind the wood or plastic on the outside (it reads through about 3 cm), and power the Arduino from a phone charger.

Tips & troubleshooting

  • If the lock opens all the time and closes on a valid card, change RELAY_ON from LOW to HIGH.
  • A blank LCD usually means the wrong I2C address (try 0x3F) or the contrast screw on the back needs turning.
  • Never leave the lock powered for long: solenoids heat up. The code opens it for 3 seconds only.
  • Keep a mechanical way in: if the power fails, this lock stays locked.

Stuck on wiring or code?

Send us a photo of your build on WhatsApp. We are makers too, and we will help you get it working.

Ask on WhatsApp

FAQ

Questions people ask

Can I add more cards later?+

Yes. Add one line per card ID to the ALLOWED list and upload again. Extra 13.56 MHz MIFARE cards and key tags work with the same reader.

Can I use it as an attendance system?+

Yes: the same reader and code print every card's ID. Add a real-time clock (DS3231) and an SD card module to log who tapped and when.

Will it work through my door?+

The RC522 reads through about 3 cm of wood or plastic, but not through metal. Mount the reader on the outside surface for metal doors.

Read next

More projects to build

All projects