Picture of RFID cat door
This is a cat door/flap that can only be opened by the animal that wears the appropriate RFID tag. Arduino controls the process. It features a custom made antenna large enough to function as a gate, which makes it easy for the animal to activate and quite reliable. Some methods and techniques are borrowed from my previous project, the RFID cat feeder. Whereas the feeder controls access to a food bowl, the door controls access to an entire room. The latest code can also distinguish between tags to allow the system to behave differently for different individuals.  

How it works:
1. In the beginning the door is locked, cat is outside
2. Cat walks up to the gate, RF tag gets read within about 4 inches
3. Door unlocks and a light comes on. 
4. Timer ensures that door stays unlocked long enough to give cat a chance to respond
5. Cat pushes open the flap and enters
6. Flap falls back, activates Hall effect sensor, and the door locks
7. Going from the inside out, an infrared proximity sensor detects the presence of an animal if within about 10 inches and unlocks the door.

Most animals will quickly learn to push the flap in response to the click (lock) and the light. Make sure that the edges of the door and the doorway are padded with soft material for when the tail gets caught! A few painful experiences may be enough to make the cat never want to go in there again. 

 The electronics are shown without enclosure, but it is advised to put an enclosure around the electronic parts once you're done. It is not further discussed in this Instructable however.  

Remove these adsRemove these ads by Signing Up

Step 1: Parts list

Picture of Parts list
- Arduino Duemilanove
- 5V RF reader module (Seeed Studio 125Khz UART or equivalent. Most readers come with a small antenna. To use the custom made antenna discussed here, you need a reader that allows connecting an external antenna)
- RF tag (I used these 35mm disc shaped ones)
- About 86 feet of 24 gauge magnet wire (longer than the piece shown in the photograph)
- Sharp GP2D12 infrared proximity sensor
- Two 12V electronic cabinet locks (Nordson electronic). Solenoids, basically.
- One 12V DC power supply
- Two TIP120 Darlington transistors
- One Hall-effect sensor
- One or more magnets to activate Hall-effect sensor over a range of about 2cm
- One 100 Ohm resistor
- Four 2 KOhm resistors
- Two pushbuttons
- One LED
- One hinge (one that moves easily but without much lateral movement, for precision)
- One 6" x 9" piece of 1/8" thick Plexiglas and perhaps another piece of about 6" x 3"  to mount the locks
- Hookup wire, including about 27" extra thin (26 AWG or thinner)
- Nuts, bolts and serrated washers
- Rubber isolation strip or other soft material for padding the edges of the door and door post

The system comprises several 'modules' (solenoids, RF reader, and so on). One of the pictures here shows the basic plan with the modules connected to the Arduino (the electronics). In the next steps the mechanical parts and each of the modules will be discussed in detail. 

Step 2: Make the door

Picture of Make the door
The door is a Plexiglas flap hanging on a hinge. At the bottom, the doorpost will have two solenoids, one on each side of the flap, to block unauthorized animals from getting in. Pretty straightforward. Just a few things to keep in mind: 

Make sure that in the resting state, the flap is centered in between the two solenoids. In the picture that is in the red area around the dotted line down the middle. To achieve this it helps to have no heavy things hanging on one side, and to use a hinge with little friction. 

It helps to have a hinge without much lateral movement (sideways movement within the plane of the wall). This will help to make the hall-effect sensor (a magnet-actuated switch) work. I will discuss this more in detail in step ... 

The door needs to be rigid but light-weight so that it is easy to push it open and doesn't hurt when a tail gets caught. Make the corners smooth and add padding on the edges and the door post to minimize tail tribulations. 

Step 3: Make an antenna

Picture of Make an antenna
The antenna is nothing more than a coil of magnet wire connected to the RF reader. Most RF readers come with an antenna, but some allow the use of an external antenna. For this project I made a square antenna of 10 x 10 inches by winding 24 gauge magnet wire 24 turns around a sawed off bucket to make it sturdy. The distance between turns has to be as small as possible. I mounted the thing on the plywood with two pieces of wood as spacers to make it stand off from the wall a bit so the cat could activate it farther from the wall. The 35mm disc tags that I use are read up to 4 inches of the plane of the coil. The RF reader and antenna are powered with the 5v from the Arduino. Even though the Arduino works fine with just the USB cable, the RF reader works better when the Arduino is plugged into the wall with the 9v power adapter

More info about coil antennas:
Microchip Inc. Antenna circuit design for RFID applications (pdf)

Step 4: Hook-up the RF reader

Picture of Hook-up the RF reader
This project consists of several 'modules' that you need to hook up to the Arduino and test in advance. First hook-up the RF reader. You can use the 5v output of the Arduino to power it, and a digital port (I used 2) to get the signal. The RDM630 that I used also has pins for a led that I don't use. It also has an RX pin to send info back to the RF reader, but I don't use that either. Hook-up your antenna, get a tag and use the serial monitor of the Arduino to see if it's detected. Now you can also start working on improving the antenna by trying adding or removing turns, trying different shapes et cetera. Power the Adruino with the 9v power supply, not just USB because at least in my case that didn't work. You can download the file named 'rfid3.pde' to test. The code requires NewSoftSerial.h which can be obtained here

Step 5: Add solenoids

Picture of Add solenoids
Hook-up the solenoids up to the Arduino as in the schematic: connect the TIP120s to digital ports 5 and 6 with 2k resistors in between. One pin goes to ground, the other goes to the solenoid, with a diode across it (make sure you get the polarity right), and to the 12v supply in the end. The other wire of the power supply is ground. Connect that to the other grounds. Just connect all grounds of all components including the Arduino together. Over here you can download code to specifically test the two solenoids. 

Step 6: Add Hall effect sensor

Picture of Add Hall effect sensor
hall effect range.jpg
The Hall effect sensor is for detecting whether the door is in the center, i.e. within the range that closing the locks makes sense. There are other solutions possible, such as mechanical/optical rotary encoders, contact sensors, beam break sensors. The main reasons for choosing a Hall effect sensor were that it does not add friction, it can be covered entirely, and I also was just curious how they work.

I did not want to put magnets on the door because that would make it heavier, so instead I put the switch on the door and the magnets in the door post. I had to use thin, very flexible wire otherwise the rigidity of it would push the flap off center. The sensor and wire is simply taped to the Plexiglas. I have two little magnets in the door post. At the closest point the sensor and magnets are 5mm apart. The range is about 3cm.    

Connect the signal pin of the Hall sensor to pin 4 and to through a 100 ohm resistor to 5v. Connect ground pin to the other grounds and the vcc pin to 5v. Add an LED to digital pin 7 with the appropriate resistor (used a green one with a 220 ohm resistor). 

Download Hall_effect.pde to test this part of the system.

Step 7: Add proximity sensor

Picture of Add proximity sensor
For this system I only cared about which cat enters, and any creature may exit. Thus, I only needed RFID on one side. The door should open to any animal that approaches from the other side. An IR proximity sensor works well. 

Connect the out-pin of a Sharp GP2D12 to Analog port 0, the ground pin to the other grounds and the vcc pin to 5v. 

Download IR_test_analog.pde to test this part of the system

Step 8: Add two buttons and load final code

Picture of Add two buttons and load final code
Finally you can add buttons to open the locks manually (see schematic). .

In the final code downloadable here, I stored the value of two tags worn by the our animals, one with and one without access. When the animal without access tries to get in, the door is locked immediately.   

byte goodcode[6] = {0x1C, 0, 0xFC, 0xB2, 0x90};
byte badcode[6] = {0x16, 0, 0x78, 0xE7, 0xFE};

You have to find the code of the tags you are using and put those values into the arrays 'goodcode' and 'badcode'. The values are hexadecimal which need '0x' in front of it in this programming language. 

If you don't want to tag the other cat, shortening the open time (smaller value for variable 'open_time') can help, although that puts the burden on the cat with access to respond faster.   

It is a good idea to put an enclosure around the electronics, but that will not be discussed in this instructable.  

On a final note, if your antenna has a large range extending into the secured area, you may need to calibrate the positioning of the antenna and the proximity sensor a bit to make sure the RFreader is not activated from the inside. If the cat is inside and wants to go out, the proximity sensor has to detect the cat first. Once that happens, it is okay because in that part of the program, the RF reader is not checked. 

1-40 of 57Next »
MichaelL421 month ago

Hi! I'm trying to build the cat flap. I have almost everything finished, except for one step: I tried to make an equivalent antenna, as described, by wrapping 30 gauge magnetic wire around a 26x17 cm PVC box (I need 26.5 loops). I even bought an LC meter, to make sure the inductance is the same. The antenna that came with the RFID module is 477uH, and the one I made around 472uH (It seems somewhat dependent on where and how exactly the exit wires go), but I get nice strings from the original antenna, and nothing from the one I made. I checked the resistance, and it is almost the same - 6 ohm (original) vs 8 ohm (mine).

What could the problem be??? I can't figure it out.

I built another antenna, this time using 21AWG. Same result. However, now I noticed that when I bring the tag very close to the loops - pretty much rubbing the wires, then it is read with both antennas. Now I need to convince the cat to rub her tag on the wire... maybe catnip spray?

cat-trapper2 months ago

Some people have suggested putting the antenna in a tunnel in front of the door. I am thinking of using this design to make a trap for cats which have not been tagged, so that is an attractive option for me. If I do that, is it likely to be sensitive enough to detect implanted microchips?

JakeW46 months ago

Do you have to use the Arduino Duemilanove or can you use others such as Arduino Uno?

But great project!!

NickholasH7 months ago

First and foremost, this cat flap is huge. For a cat you can get away with a square hole 20 cm on a side (though I'll admit that I prefer 25). Second, if getting tails caught is a problem for you I recommend that you make a gap between the door and the wall about 1.5 or 2 cm wide that can pass a tail, but not a limb (there will of course not be a gap on the lock). Then go get some rubber and put and nice gasket around the flap to keep in the heat.


I said "a tail, but not a limb" when I meant to say "a tail, but not an animal."

MirasD8 months ago

Dear creator!

My name is Miras, and I plan to implement the same schem using arduino+ rdm6300. Could you contact with me by email miras.dolayev@gmail.com. I've got some questions about antenna calculation.

Will wait for you friend!

mihk708 months ago

Good instructable, nice job. Most US pet pittag are usually 125 and EU 134.2 although there are some newer ones out there with oddball frequencies these days. On a good day with one of the handheld scanners the vets use I've managed to pull a number off an animal at about 6cm but most days its 2-3cm through skin if I can find it at all. Try moving you coil into a hood over the top of the flap rather than round the flap or even double up on your coils with them 90deg to the flap so that your cat walks into the field first

Akin Yildiz10 months ago

this is soo cool..!

aka_bigred4 years ago
Awesome! - Anyone know how to read the standard implanted pet RFID tags? It would be even better to do this and not need an external RFID tag if your cat was already chipped with an internal implanted RFID tag.
landmanr (author)  aka_bigred4 years ago
Implanted pet tags are usually tuned to 134.2 KHz or 125 KHz (Wikipedia), so it is the right frequency. The implanted tags are really small though, which could make the read range very small.
landmanr (author)  landmanr4 years ago
I have tried a 'Home Again Pet-Tracking Microchip' but I could not get it to work.

For those sharing the frustration about the implanted tags:

Knowing the very real reading distance problem (seeing vets pressing their handheld devices to the skin), a good explanation for the failure of the door setup is still lacking. Can anyone (unfortunately only an electromagnetic fields expert...) tell what factors negate these important things below, making a reading still impossible?

A door

a) has a waaay bigger (stronger) antenna than a handheld reader, and

b) (this feels even more important) the cat PASSES THROUGH the antenna, theoretically decreasing the tag distance (and so the required reading distance) to ZERO! :-o

So, considering these important benefits, what is the real reason for being unable to read those tiny tags? (The physical model behind the equations is invalid at zero-distance? Or certain effects, losses inside the antenna are just ignored at the usual non-zero-distance cases? Or tag position offset from the antenna axis weakens coupling that much?)

Just curious (= still not given up hope... :) ).

Thanks a lot!
Wait, wait! :) Just realized, that in this setup, the cat actually cannot pass through the antenna to open the door, because the closed door stops it too far from "Plane Zero"...

A tunnel-shaped configuration would be required to test the zero-distance case.
There are several issues with the implanted chips. Frequency can be one, although from my reading it appears to be an overrated issue, in that the 134.2 kHz and 125 kHz chips can often be read by the same reader. Another issue is the number of digits being read. I know that one type of pet chip uses 15 digit tags, while many of the readers available to hobbyists only read 10 or 12 digits. A third issue is that some brands of pet chips use encryption.
Those implanted chips are really tiny. When the vet reads the chip with a purpose made handheld reader, it has to virtually be pressed up against the cat's skin/fur. The signal created when excited by the reader just wouldn't be strong enough to be useful.
(below) In case anyone else has this issue, Arduino 1.0 and later doesn't need 'Newsoftserial' added to the library. Instead, insert the code given into Arduino and change 'Newsoftserial' to 'Softwareserial' in the code itself. It is placed in the code twice.
What needs to change on the RFID code? Arduino doesn't seem to like it.. :(
hsadek1 year ago
itncampos2 years ago
First, congratulations for your project.
Secondly, the questions:
1. You said in material that used 4 x 2kohms resistor, I just saw 2 in the schematic, where are the other 2?
2. I didn't understand why the diode in the solenoid part, can you clarify to me?
3. If I use a 6V solenoid, do I have to use a different resistor?
Again great job and when my material arrive from china to brazil I will try to make a bigger wall dog door, if I succeed, maybe I post here my modifications with the right citations to your project.
Thanks in advance
Antenna resonance details are pretty important, more so than, say, the thickness of the wire used for the coil. Please see http://www.instructables.com/id/RFID-Reader-Detector-Easy-to-Build (RFID in Instructables) and you will notice a RFID detector here with an LED that uses both a coil AND a capacitor that matches 125 kHz. The LED on this detector lights at the farthest distance from the RFID reader when the coil and capacitor resonate at the frequency of 125 kHz. Roughly speaking, my handwound coil of about 300 uH with about .005 uF of capacitors in parallel with the coil resulted in the best lighting of the LED at a distance of about 4+ inches and mostly meets the requirements of the formula; freq = 1000 divided by (2 times pi times the square root of L times C) where freq in in kHz, C is in uF and L is in uH. I believe that using a capacitor in parallel with the antenna coil is pretty common practice. The wound coil is "fine tuned" by capacitors hooked up in parallel with the coil...
azzytee3 years ago
Thanks for this, I've been using this instructable to build a similar rfid dog door. One of my final steps is building a bigger antenna, but I can't get it to read anything. Is there a specific number of turns or size of antenna that has to be built?
landmanr (author)  azzytee3 years ago
Yes there are a number of factors that all together determine how well the antenna works. Your antenna is tailored to the frequency you want to use and the number of turns depends mainly on the antenna diameter (more turns required as the diameter gets smaller) and on the thickness of the wire. You can find detailed information here: http://ww1.microchip.com/downloads/en/AppNotes/00710c.pdf
10x10 inches was the biggest I could get with this RF reader. I varied the number of turns as a way to 'tune' it, trying it out with a tag each time.

Please see http://www.instructables.com/id/RFID-Reader-Detector-Easy-to-Build and you will notice a RFID detector here with an LED that uses both a coil AND a capacitor that matches 125 kHz. The LED on this detector lights at the farthest distance from the RFID reader when the coil and capacitor resonate at the frequency of 125 kHz. Roughly speaking, my handwound coil of about 300 uH with about .005 uF of capacitors in parallel with the coil resulted in the best lighting of the LED at a distance of about 4+ inches and mostly meets the requirements of the formula; freq = 1000 divided by (2 times pi times the square root of L times C) where freq in in kHz, C is in uF and L is in uH. I believe that using a capacitor in parallel with the antenna coil is pretty common practice. The wound coil is "fine tuned" by capacitors hooked up in parallel with the coil...
Thanks, I also found more details from your pet feeder project. I've made a working antenna now but it's range is still pitiful. One more question, does it have to be a perfect spiral or can the wire overlap itself?
landmanr (author)  azzytee3 years ago
On my antenna there is overlap, it's not a perfect spiral.
landmanr (author) 2 years ago
Though possible in principle, it would not work with the thing described here (I have tried it). Even if you had the proper reader, the range would likely be in the order of centimeters, so the animal would have to be trained to go to exactly one place to activate it, which might be difficult. I have used a handheld reader and I had to hold it pretty much against the animal right above the chip.
Great 'ible! Is there any way you could use the pet id chip (that both of my cats already have under their skin) instead of using tags?
Many thanks, Duncan
MiguelJAS2 years ago
Any chance this could work with the pet ID microchip implant already on an animal?
fellippe2 years ago
Great project!!! I am myself on the horse feeder system with RFID. I have one question though. Can U tell what is the diameter [in mm] of the antenna wire ?
I tryied to figure it out from the tables and found that 24 gauge is 5,4 mm wich is not exactly what I can see on UR pictures (or mayby I am wrong ;-).
landmanr (author)  fellippe2 years ago
It's AWG so the diameter is 0.511 mm http://en.wikipedia.org/wiki/American_wire_gauge
memorris0272 years ago
Now I kind of wish I had an outdoors cat to try this out with...
LesB3 years ago
I am in the process of building your cat feeder project. I've been to you a couple of times for questions in that regard (thanks!).

This project is next. At one time a possum was coming in thru my cat door on a nightly basis. I had to trap him and transport him in my car to a far-off field. I need one of these to keep away these unwanted guests.
Could this be changed somehow to prevent the door from opening if a particular pet is nearby? I have a very small dog that I do want to be able to go in and out on her own, but I also have a cat that I absolutely do NOT want to be able to go outside. I am one of those firm believers that all cats should be indoor cats (for their safety) unless you have a cat-proof yard. I have been wanting a pet door that will let the dog go in and out but locks securely if the cat goes near the door. Also, could this be altered for a sliding screen door as opposed to a solid door? This is something I'd be willing to pay for.
landmanr (author)  howdotheydothat3 years ago
I am a little busy right now so I could not make it for you but one could simply add a solenoid (B) that is open when not energized and closed when energized. You would give both animals a collar with a tag. And then code should be added to the Arduino to energize solenoid B when cat's tag is detected. It could also be altered for a sliding screen door but I don't know what materials would be best to use. Good luck!
The [minor] issue is that the RFID reader can't read multiple tags at the same time. So, theoretically, if both animals approach at the same exact instant, the reader will not respond to either. Alternatively, maybe the cat is behind the dog, the rfid reader reads the dog but not the cat, and the flap opens, and the cat manages to get outside.

Again, that's a minor issue that you'd have right now anyways, so if that doesn't happen then the above idea is great.
yellowcatt3 years ago
What is the approximate cost of the parts please.

I have just sent a link to this instructble to the Cat Club forum I use.
Do you have any information on what reader would be needed to pick up implanted RFID chips, the commercial electronic cat flaps do this.

landmanr (author)  yellowcatt3 years ago
Cost of parts: I have no idea. $50? The Arduino is probably the most expensive part ($20 on amazon). This door does not work with implanted RFID chips, I have tried it myself. One would need to hack one of those handheld things the vet has. If I knew why this reader doesn't work with implanted tags it would perhaps be easier to fix it, but I don't. It might be that more power should go through the antenna, but my reader module does not deliver more.
studleylee3 years ago
Once again you have done an outstanding article!!!!
The system details aand using the bucket rim to wind the coil points to genius inner mind workings.
1-40 of 57Next »