Pet door that knows your cat
Build it step by step
0 of 7 doneRead your tag
Print the ID.
Build the latch
Servo bolt on the outer side only.
Test unlocking
Hold the tag to the reader.
Add the pass sensor
Relock after the pet passes.
Add the stay-in button
Block entry on request.
Log visits
Count in the sketch or on a card.
Test with the pet
Be present for the first few days.
How do you build a pet door that knows your cat?
An RFID reader on a cat flap lets only your pet in, keeping out strays. You need Arduino Nano, RDM6300 125 kHz RFID reader, 125 kHz RFID cards (EM4100), SG90 Micro Servo, IR obstacle avoidance sensor module, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Tactile push button 6 mm. It takes 7 steps and about 180 minutes.
- Level
- Intermediate
- Time
- About 180 min
- Parts
- 8
Parts list
- Development BoardsBuyArduino Nano × 1
- WirelessBuy
- WirelessBuy
- Motors & ActuatorsBuySG90 Micro Servo × 1
- SensorsBuy
- PowerBuy
- BatteriesBuy
- SwitchesBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| RDM6300 TX | Nano D2 | Tag data (3.3 V serial, safe for the Nano) |
| RDM6300 5V and GND | Nano 5V and GND | Power |
| Servo signal | Nano D9 | Latch |
| Servo plus and minus | Battery holder plus and minus | 6 V supply |
| Battery holder plus | Nano VIN | Power the Nano |
| IR sensor OUT | Nano D3 | Pass-through sensor |
| Stay-in button | Nano D4 to ground | Lock for the night |
| All grounds | Joined | Common ground |
Code
The RDM6300 reads a 125 kHz collar tag from a few centimetres and sends its 10-character ID over serial; first run the sketch with MY_TAG left as zeros, hold your cat's tag to the reader, copy the ID from the Serial Monitor and put it in MY_TAG. The servo latch blocks only the outside of the flap, so your cat can always push out from inside, whatever the electronics do, which means the cat cannot be locked in or trapped; make sure the latch mechanically leaves the inside free. The stay-in button blocks entry, and it is up to you to keep it for the evening only if your cat can sleep safely inside. A 4 AA pack powers the servo directly at 6 V and feeds the Nano's VIN. Keep every connector out of the rain, and check the flap and the latch weekly. Never rely on this to keep a pet safe from dangerous animals or traffic, and ask your vet about the right microchip or tag. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Cat flap: unlock for your pet's tag only. RDM6300 frame: 0x02, 10 ASCII hex characters, 2 checksum characters, 0x03.
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial rfid(2, 8); // RX on D2, TX unused
Servo latch;
const char* MY_TAG = "0000000000"; // run once and read your tag's 10 characters from the Serial Monitor
const int IRPIN = 3, BTN = 4;
bool stayIn = false;
int visits = 0;
char buf[10];
void setup() {
Serial.begin(9600); rfid.begin(9600);
pinMode(IRPIN, INPUT); pinMode(BTN, INPUT_PULLUP);
latch.attach(9); latch.write(0); // 0 = latched
}
bool readTag() {
if (!rfid.available() || rfid.read() != 0x02) return false;
for (int i = 0; i < 10; i++) { unsigned long t = millis(); while (!rfid.available()) if (millis() - t > 100) return false; buf[i] = rfid.read(); }
while (rfid.available()) rfid.read(); // discard checksum and end byte
return true;
}
void loop() {
if (digitalRead(BTN) == LOW) { stayIn = !stayIn; delay(500); Serial.println(stayIn ? "Stay-in ON" : "Stay-in OFF"); }
if (readTag()) {
char id[11]; memcpy(id, buf, 10); id[10] = 0;
Serial.print("Tag: "); Serial.println(id);
if (!stayIn && strcmp(id, MY_TAG) == 0) {
latch.write(90); visits++; // unlock the entry side
unsigned long t = millis();
while (millis() - t < 6000UL) { // stay open for 6 s, or until the pet has passed
if (digitalRead(IRPIN) == LOW) { delay(2000); break; }
}
latch.write(0);
}
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Your tag | Latch opens for six seconds |
| Another tag | Stays latched |
| Stay-in button | Entry blocked |
| Pushing out from inside | Always free |
If it does not work
Tag not read
Hold it flat near the coil.
Servo buzzes
Check the latch travel.
No ID in the monitor
Check D2 and the baud rate of 9600.
Door relocks too early
Lengthen the open time.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the pet door that knows your cat?
Arduino Nano, RDM6300 125 kHz RFID reader, 125 kHz RFID cards (EM4100), SG90 Micro Servo, IR obstacle avoidance sensor module, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Tactile push button 6 mm.
How long does the pet door that knows your cat take to build?
About 180 minutes for a intermediate maker, in 7 steps.
How do I know the pet door that knows your cat works?
Your tag: Latch opens for six seconds. Another tag: Stays latched. Stay-in button: Entry blocked.
Tag not read: what should I check?
Hold it flat near the coil.
Servo buzzes: what should I check?
Check the latch travel.
No ID in the monitor: what should I check?
Check D2 and the baud rate of 9600.
Door relocks too early: what should I check?
Lengthen the open time.
