Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino Nano RC522 RFID: Unlock a Servo Cat Door | ShillehTek

May 27, 2026 13 views

Arduino Nano RC522 RFID: Unlock a Servo Cat Door | ShillehTek
Project

Build an Arduino Nano RC522 RFID cat door that unlocks a servo latch only for allowed tags, giving secure pet access without a subscription from ShillehTek.

3 hr Intermediate5 parts

Project Overview

Arduino Nano + RC522 RFID + servo cat door: Build an RFID-controlled cat flap where an RC522 reads a 13.56 MHz tag and an Arduino Nano drives a servo to unlock the latch only for allowed UIDs.

Your cat wears an RFID tag on a breakaway collar. When the tag approaches the reader, the Arduino checks it against an allow-list. If it matches, the servo unlocks the door for a short time; otherwise it stays locked.

  • Time: ~3 hours
  • Skill level: Intermediate
  • What you will build: A motorised cat door that only opens for tagged cats.
Arduino Nano RFID cat door using an RC522 reader and servo latch mechanism
RC522 + servo + Arduino = cat-only access, no subscription.

Parts List

From ShillehTek

External

  • Standard cat flap (the door itself)
  • 5V power supply
  • Mechanical latch + linkage to the servo arm

Note: Use a tiny lightweight RFID fob attached to a breakaway collar. Never attach anything heavy to a cat.

Step-by-Step Guide

Step 1 - Build the latch mechanism

Goal: Create a reliable physical lock that the servo can move between locked and unlocked.

What to do: Mount the MG995 so its horn/arm can pull or push a sliding bolt (or similar latch). Confirm the bolt fully blocks the flap when locked, and fully clears it when unlocked.

MG995 servo mounted to a cat door latch mechanism pulling a sliding bolt
MG995 servo arm pulls a sliding bolt: locked = bolt across the door; unlocked = bolt retracted.

Expected result: Moving the servo arm by hand (or temporarily powering the servo) cleanly locks and unlocks the door.

Step 2 - Wire the RC522 and servo to the Arduino Nano

Goal: Connect the RC522 over SPI and connect the servo to a PWM-capable pin.

What to do: Wire the RC522 to the Arduino Nano SPI pins and power it correctly. Wire the servo signal to D6 (PWM), plus 5V and GND to your power supply and common ground.

Arduino Nano wired to an RC522 RFID reader on SPI and an MG995 servo on D6 PWM
RC522 on SPI (3.3V), servo on D6 (PWM).

Expected result: The RC522 powers up at 3.3V and the servo has stable power with a shared ground to the Arduino.

Step 3 - Read your cat's RFID tag UID

Goal: Get the UID from the fob so you can add it to the allow-list.

What to do: Use the MFRC522 library and run its ReadUIDSimple example. Present the cat's fob to the RC522 and write down the 4-byte UID shown in the serial output.

RC522 RFID reader connected to Arduino reading a 13.56 MHz key fob UID
Use the MFRC522 library's ReadUIDSimple example to grab the fob's 4-byte UID. Write it down.

Expected result: You have a 4-byte UID you can paste into the sketch as hex bytes.

Step 4 - Upload the Arduino sketch

Goal: Make the Arduino unlock the servo when an allowed UID is detected.

What to do: Paste your UID into the ALLOWED array, compile, and upload. The sketch keeps the door locked (servo at 0 degrees) until an allowed tag is seen, then unlocks (90 degrees) for 8 seconds.

Code:

#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
const int RST_PIN = 9, SS_PIN = 10;
MFRC522 rfid(SS_PIN, RST_PIN);
Servo lock;
const byte ALLOWED[][4] = {
  {0x12, 0x34, 0x56, 0x78}    // replace with your cat's UID
};
void setup() {
  SPI.begin(); rfid.PCD_Init();
  lock.attach(6); lock.write(0);   // locked
}
bool isAllowed(byte* uid) {
  for (auto& tag : ALLOWED) {
    if (memcmp(uid, tag, 4) == 0) return true;
  }
  return false;
}
void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
  if (isAllowed(rfid.uid.uidByte)) {
    lock.write(90); delay(8000); lock.write(0);   // 8 seconds to slip through
  }
  rfid.PICC_HaltA(); rfid.PCD_StopCrypto1();
}

Expected result: Presenting an allowed tag moves the servo to unlock for about 8 seconds, then returns to locked.

Step 5 - Install and test on the real door

Goal: Validate the latch movement and RFID read distance on the installed flap.

What to do: Mount the electronics and servo mechanism on the cat flap. Present the allowed fob near the RC522 and confirm the latch retracts long enough for the cat to pass through. Try a non-allowed tag to confirm the door stays locked.

RFID-enabled cat flap installed with servo latch and electronics mounted
Mounted on a real cat flap; servo arm latches and unlatches the door.
Cat approaching an RFID cat door as the RC522 reads the fob and the servo unlocks
Cat approaches, fob detected, door unlocks for 8 seconds.

Expected result: Allowed fob unlocks the door consistently; non-allowed tags do nothing.

Step 6 - Where to take it next

Goal: Extend the same RFID access-control idea for additional features.

What to do: Consider these upgrades:

  • Log every entry to microSD with a timestamp (track your cat's nightly schedule)
  • Multi-cat support - add each cat's UID to the ALLOWED array
  • Wi-Fi notifications (ESP32) - "Mittens just came home" to your phone
  • Time-locked mode - cat door only opens during daytime hours

Expected result: A clear list of next improvements you can add without changing the core wiring concept.

Conclusion

You built an Arduino Nano RFID cat door using an RC522 reader and a servo latch, so only tags in your allow-list can unlock the flap. It is the same core idea as commercial units, but you control the behavior and do not need an app.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.