RFID Pet Feeder

135,363

154

74

Introduction: RFID Pet Feeder

If you have two cats and one of them is on a diet but the other needs free food, you can build a feeder with RFID capability that only opens for the cat that needs free access. The free-food cat wears a collar with an RFID tag.  

Features:
- An old CD-rom player is used as a sliding door
- Timer-controlled open duration
- Proximity sensor (Sharp GP2D120) prevents door from closing while the cat is eating
- Sensors detect whether the door is fully opened/closed. 
- Automatic/manual mode switch (on manual it opens with a pushbutton)
- Arduino controlled

On the downside:
- Mine was made out of cardboard so it is easily broken into by smart/strong animals. One could use a stronger material and add a servo that slides a bar into the door to lock it into place. 
- It doesn't hold a lot of food. 

The first version (shown in the video) used an ID-20 (ID Innovations), which worked, but the range was limited. The cat's tag sometimes hangs on the side, so it did not always activate the reader even when he was in the exact same place every time. Not that big a deal because the cat usually just tried from different angles, but my latest version (shown in the photograph) uses a SEEED studio RDM630 RF-reader with a self-made circular antenna. This antenna is large enough that the cat can poke his head through, which works 100% of the time. The antenna is described in step 7.


Little Cat Toos demonstrates cat feeder from champenoise on Vimeo.
The video shows the first version with the ID-20 as the reader.






Step 1: Materials

- A working CD player tray mechanism+motor from an old cd-rom player
- Sharp GP2D120 Proximity sensor
- 125KHz RFID reader (e.g. ID-innovations ID-20, SEEED studio RDM630, Parallax)
- 1.25" diameter 125KHz RFID tag (or as large as can be worn comfortably on the animal's collar. Tag size influences read range. Bigger is better in most cases)
- Arduino Duemilanove
- 1 adafruit motorshield
- 3 Pushbuttons
- 1 Toggle Switch
- 5  100-220Ω Resistors
- 4  10kΩ Resistors
- 1 Red LED
- 1 Green LED
- The material for the enclosure (such as cardboard, wood or plastic)


Step 2: Find an Old CD-rom Player

Strip an old CD rom player until you have only the tray with the DC motor that moves it back and forth. Alternatively, any other door with a dc motor would work.�

Step 3: Add Open/close Sensors (pushbuttons)

To ensure that Arduino stops turning the motor when an open/close action has been performed, I mounted two pushbuttons in the tray, which get pressed when the door is all the way open/closed. This also helps to keep track of what state the system is in at all times. I have mounted a metal strip on the tray in such a way that when the door is all the way open, the strip pushes on one button, and when it is all the way closed, it pushes the other button.

Put the Adafruit Motorshield on top of the Arduino. Connect the motor to the motor shield. I use m3 (digital pin 5). Connect pushbuttons to Arduino analog channel 0 and 1 (in Arduino code pin 14 and 15). Add a 10K resistor between each button and ground as a pull down resistor (http://www.ladyada.net/learn/arduino/lesson5.html) and a low one (100-220 ohm) between the button and the analog channel just so the resistance is not infinitely small. The button that is actuated when the tray is extended (i.e. door closed) should be on channel 1 and the button actuated when the tray is retracted (door open) should be on channel 0.

More info about the motor shield: http://www.ladyada.net/make/mshield/faq.html.

You can test the mechanism with a bit of Arduino code that is downloadable here:
http://www.writtensound.com/arduino/cat_feeder.htm


Step 4: Add Auto/manual Mode Switch and Open/close Button

You have to be able to open the feeder without a tag, when you want to fill it with food for example. Thus, we add a switch that puts it in 'manual mode' in which the feeder opens by pressing a button. For clarity, the schematic shows only this latest addition without anything else. This can also be tested with the code that can be downloaded over here:
http://www.writtensound.com/arduino/cat_feeder.htm.

Step 5: Add Proximity Sensor

Hook up the IR sensor to analog ch 4, with an LED to show that it works. The schematic shows only this step, for clarity. In your Arduino code you have to set a threshold value above which the sensor output triggers action to keep the door open. With a simple code like below you can test what the output is when you put your hand or other objects at various distances. 

Code for testing the IR sensor can be found here:
http://www.writtensound.com/arduino/cat_feeder.htm


The sensor has an optimal range. Closer to, or farther away than that, the output will be low. The sensor used here (Sharp GP2D120) has a range of 4-30 cm.  Mount it in such a way that when the cat is eating, his head is at a distance that makes the output reliably cross your threshold, and set the threshold at a value that doesn't give a lot of false positives. My sensor output hovers between 50 and 150 with nothing in front of it, and increases to over 230 when anything is within 10cm, so I set the threshold at 200. Also, mount it in a way that the door itself does not activate it. The code is about the same as step 4, but with the IR added. Now the door will never close whenever something is in the way.  

code: http://www.writtensound.com/arduino/cat_feeder.htm

Step 6: Connect RF Reader

If you use a Seeed studio RDM630:

Connect the TX pin of the RDM630 to the RX (pin 0) of the Arduino
Connect the +5V pin of the RDM630 to the +5V of the Arduino
Connect the GND to the GND of the Arduino

I ended up using the RDM630 because I wanted to add my own antenna (see next step). However, I have also used an ID-20 (ID Innovations) which has a built-in antenna. Because of its limited range it is less tolerant to variations in the position of the tag on the animal's collar, but it still works. 

If you use an ID-20 (ID-innovations):

Connect the +5V pin and RES pin of the ID-20 to the +5V of the Arduino
Connect the GND pin and FMT pin of the ID-20 to GND of the Arduino
Connect the D0 pin of the ID-20 to RX (pin 0) of the Arduino

I do not need to communicate anything back to the reader, therefore I only use pin D0.


The code for both readers is the same. I basically copied it from this source: http://www.arduino.cc/playground/Code/ID12
It is not exactly clear who wrote it. Now you can test whether the reader works by first writing an Arduino sketch that has only this function plus something that uses the output value to toggle an LED, as in the code you find here. By the way, for my application I did not need to distinguish between tags, so the door is opened for ANY tag (i.e. when RFID returns a 1), but the code does extract the actual tag value so you could modify it to do more sophisticated processing.

When you put the tag on the animal's collar, try to make it so that the plane of the tag is most likely to be in parallel to the plane of the antenna. 

my code

Useful sites about using RFID readers with Arduino: http://www.tigoe.net/pcomp/code/category/PHP/347http://www.practicalarduino.com/projects/rfid-access-control-system



Step 7: Optional: Build Your Own RF Antenna

If you have a 125KHz RF reader that allows an external antenna, you can build it to fit your needs. In my case the activation tag on the cat's collar is not always hanging nicely down, but sometimes hangs on the side of his head. If your reader has a small range it will not always detect the cat even when he is in the exact same place every time. I chose to make an antenna large enough that the cat can stick his head through, which activates the reader almost 100% of the time. 

Guides for the construction of antennas are available for download on the web (e.g. http://ww1.microchip.com/downloads/en/devicedoc/51115f.pdf). They help quite a bit, but I still ended up just trying a bunch of things to see what worked best.  

An antenna coil is as simple as this: http://img101.imageshack.us/i/coil2sm.jpg/, just a wire wound up a bunch of turns with the two ends connected to the RF reader.
I used 24 Ga magnet wire and a 1.25" diameter tag to test the antenna. 
The following worked well (range is in distance from the plane of the coil):
Circular coil
1.6" diameter, 90-110 turns, no range measurement
3.1" diameter, 75 turns, no range measurement
4.1" diameter, 48 turns, no range measurement
6" diameter, 43 turns, range 3-3.5" 
9" diameter, 35 turns, range 4"
Square coil
10" square shape, 31 turns, range 1"

So the largest range was with a 9" diameter coil. Larger than that, the range first went down to zero and then disappeared from the center. If you draw power from the Arduino, use the 9v adapter, not USB only, because the latter provides less power. Also important is when the coil is complete, the wire should be guided away from the coil.




Step 8: Put Everything Into the Enclosure, Load Final Code

By now you should have an RF reader that reads your tag, a cd tray that opens and closes automatically or manually depending on the mode switch, and a proximity sensor that prevents the door from closing when the cat is eating. Build the enclosure, put everything in  it, make sure no wires are in the way of moving parts. for the animal's protection, make sure the enclosure is shut.  

Final code for this project: http://www.writtensound.com/arduino/cat_feeder7.pde

Step 9: Train Your Cat

This shouldn't be too difficult. Wait until it is dinner time, put food in the feeder and encourage the animal to point his nose where it is likely to activate the reader. You can draw a target on the enclosure. When the animal succeeds, there is instant reward. Even if the door does not open every single time, it is still likely that over time, your pet learns to operate it somehow, just because getting food is a strong motivator. Do monitor your feeder's behavior though. I myself had to do a lot of debugging before it worked flawlessly. It is helpful to have an extra tag at hand just to test the device now and then, without having to bother your cat. Important: if your cat is not used to wearing a collar, he/she will have to get used to it. Over the course of several days, start with putting it on for a short time, then progressively longer. Monitor your cat closely while he/she wears the collar in the beginning. While the animal tries to get it off, the lower jaw can get caught, which is not good. To prevent this, the collar should not be too loose. If you hear strained breathing, loosen it immediately. In my experience it is about right when you can still squeeze in two fingers.  

1 Person Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

74 Discussions

0
TangLB
TangLB

Question 10 months ago on Step 7

A friend help me t debug my code, and so I succeded to do my project like your.
But my antenna is not well, it detect the cat but very close.
I began a new 9" antenna.
Can you explain me specifications to do ?
Thanks.

0
giveandtake.contacts
giveandtake.contacts

Answer 8 months ago

hello can you send me the engine code (from cd rom)?

0
sjcallan
sjcallan

3 years ago

I've been working on a RFID/Wifi controlled cat door for a week - leveraging an existing pet door that already had an RFID system (but wasn't Wifi controlled/had some limitations with the way it operated). So I stripped out the old electronics, and replaced with an Arduino - which meant building my own RFID reader and antenna.

Without this article, I would have never thought of building my own antenna so massive thanks to landmanr.

I originally used an RC522 (built in antenna) and tried to modify it but it did nothing. So I used the RDM630 and built an antenna from 24 AWG wire. It's around 10" with 33 turns and gets me the range I need (you'll see from the video I get about 4"-6" in the center from the edges - perfect for my needs). It took me a little to realize I had to strip off a bit of the red outside coating of the antenna wire to make a good connection to the RDM630.

I've attached a video showing this working - you'll see the new antenna in red wire. I also attach a picture of the old antenna I stripped out.

I'll upload the whole project once I'm done.

51949FA0-C581-44D1-8A90-BA4AEB650210.JPGF5DE592E-86A2-4285-AEE4-DC3FCD98D381.JPG
0
TangLB
TangLB

Reply 10 months ago

Hello,
I tried many times to do my own RFID antenna following he described, but I failed :
I made a polycarbonate support to do it which internal size is 9",
I wrapped my 24 AWG magnet wire around it on 35 turns (thickness 3 mm).

Could you help me ?

Outlook-Image.png
0
TangLB
TangLB

10 months ago

Hi Landmnr,
I did the mechanical design, but I would like a simpler electronic installation.
I used the same RDM6300 and a personal antenna (as you describe).
I used L293D to move my motor (it works well), and I have sensors to detect opened and closed trap.
I use neither proximity sensor, neither nor time control sensor.

Could you help me to simplify your code ?
It's urgent, my cats are becoming big...
Thank you.

1
nsegers1
nsegers1

Question 10 months ago

It looks like writtensound.com isn't accessible anymore. Do you have this code uploaded anywhere else? Thanks! Sincerely, cat parent of a big chonk.

0
Skyewater
Skyewater

1 year ago

So i currently already have a portion control automatic feeder. This one opens and closes everytime is feeding time. It feeds my cats 5x a day. What it doesnt have is an antenna to keep the cats from each others bowl. Does anyone know how i would go about adding only an antenna portion to an already automatic feeder, so that if the wrong cat comes to eat it closes?

0
TangLB
TangLB

Question 1 year ago on Step 7

Hi,
Very interesting projet, i gonna do the same for my cats.
Could you explain me how you made your antenna ? (pictures, drawings....)
Thanks.

0
russmaguss
russmaguss

Question 1 year ago

Hi, I skimmed this quickly so forgive my ignorance if this was covered-- is there a way to program it if my cat is chipped already or does it need to be something that comes with the parts bought for this project that goes on a collar? Thanks for any info! Getting sick of my bigger cat stealing the other's food lol

0
LesB
LesB

7 years ago on Introduction

I completed my catfeeder a few months ago and it is working great. Here's a Vimeo of the cats and feeder in action (poor quality, sorry)

-The first cat comes by and the feeder hatch opens for him and he partakes.

-He leaves and the second cat comes by and sniffs around the feeder.  When she sticks her head in you can see the proximity light go on, but the hatch doesn't open because she doesn't have the requisite RFID tag. 

-After a while the first cat comes by and gently shuttles the second cat away from "his" feeder.

It works great!

http://vimeo.com/70930521

0
xLSDx
xLSDx

Reply 3 years ago

Do you know the specs of the antenna you used?

0
LesB
LesB

Reply 3 years ago

I made my own antenna and used a impedance bridge from where I used to work to tune the antenna to 500 micro-Henries.

0
Jnj30
Jnj30

4 years ago

I'm new to all this, and probably should've started with something more basic...but want to give this a shot. Your patience is appreciated in advance. I want to try a version of this but with 3 doors. Each door would service a different cat. My question is: do I need 3 complete setups or can one or more of the components be used for all doors? I'm thinking that once the ID tag is read, there should be a way to say this is cat A, open door A. But that's as far as I've gotten with it.

0
MarioR16
MarioR16

4 years ago

Dear Landamar,

I have a question regarding the RFID reader connection. As far as I know, the Adafruit motor shield v1 does not have a serial connector. When you say to connect the RFID reader to the RX (0) pin, do you mean to use the 0 pin in the top right corner of the shield?

0
helpme_1
helpme_1

5 years ago on Introduction

nice project. I want to make a same one but could only locate 16AWG wire. At 6" diameter, how many turns should I do?

0
moritz.dapprich
moritz.dapprich

6 years ago

Could someobe who might be interested in building a custom animal feeder for me please contact me? I need a feeder that dispenses wet food, in my case bits of meat, to falcons when they enter a feeding box. Additionally i need it to weigh the birds and record the birds weight and amount of food consumed. The birds would be fitted with rfid leg bands. P

0
kilofeenix
kilofeenix

6 years ago on Introduction

anyway to make this work with the rfid chip in my cats neck? no way in hell she's gonna wear a collar. otherwise i need to make it close when my dogs gets too close and stay open when hes not around. its for a litter box door to prevent my dog was munching down some almond roccas

0
David97
David97

Reply 6 years ago on Introduction

I have the same problem. Build it so that the bowl is constantly open and then closes when the dog gets close enough (the dog wears the tag). I imagine that a CD drive would not be fast enough,so you could use a servo and a flap.
See post above.

0
David97
David97

Reply 6 years ago on Introduction

Like this... it would be easy to add a flap to lock them out