Posted in HomePets

Introduction: Cat-a-log

My wife was always worried when she had not seen all of our cats daily, and sometimes stayed up late to see them all in the house.

All of our cats have a RFID chip implanted to identify them, so the idea was to build a RFID reader in the catflap. The data is collected in a database and made available on the Internet. This was already foreseen when we built the house, so there is a CAT5 cable from the front door to a patch panel.

Every time a cat passes the catflap, the RFID is read, stored in a database and published on the Internet as shown above

Step 1: Software

The data is collected and made available on a Linux box with an Apache web server

Data collection

The MySQL database schema consists of 2 tables; "entry" with the chip-id and the date-time and "name" with chip-id and the name of the cat. The data is gathered with a small Perl program:


use strict;

use warnings;

use Device::SerialPort;

use DBI;

my $con = DBI->connect("dbi:mysql:dbname=cats","username","password",{RaiseError => 1},) or die "Connect DBI::errstr";

my $port = new Device::SerialPort("/dev/ttyUSB0");

print "open err " unless ($port);







$port->are_match("\r", "\n");


my $resp='';

while (1)


until ( $resp ne '')



sleep 1;


if (length($resp) ge 14)


#filter out disturbances on the serial connection which can upset the SQL server

if ($resp =~ m/^[0-9]{15}$/)


print $resp . "\n";

my $sth = $con->prepare("INSERT INTO entry (zeit,chip) VALUES (now(),\"" . $resp . "\")") or warn "Prepare DBI::errstr";

my $rc = $sth->execute() or warn "Excecute DBI::errstr";



$resp = '';





Data presentation

The data is presentend as a table of the 4 most recent events per cat using a simple php program.

Please look at the screenshot of the code as well, writing about HTML on a HTML pages does not always work..

query('SELECT * FROM name') or die(' select name');

if ($names->num_rows > 0)


while ($namerow = $names->fetch_assoc() )


echo ""; $name = $namerow["name"];

echo '';

$sel = 'SELECT zeit FROM entry WHERE chip=' . '\'' . $namerow["chip"] . '\'' . ' ORDER BY zeit DESC LIMIT 4'; $times = $mysqli->query($sel) or die('Error select entry');

if ($times->num_rows > 0)


while ($timerow = $times->fetch_assoc() )


$time = date_create($timerow["zeit"]);

echo '";





echo "";


echo "";





die('No names');




Step 2: Hardware

At first I tried the sytem according to the thesis from Leonid Kuritsin, but with an EM4095 in stead of the U2270, but I could not get reliable readings. After that I decided for the RFIDLOG from Priority 1 Design which has all the required functions and is not too expensive.

The antenna consists of about 100 turn of 0.2 mm enameled wire around the catflap. With the command "MOF" of the reader the number of turns is adjusted till the frequency show 134 kHz.

Beside logging the serial number and the time, the reader also sends the serial number over the serial port as soon as a tag is read.

A warning to the readers in the US: this system uses an ISO 11784 /ISO 11785 reader. Please check that your reader supports the US animal tags which commonly use another protocol.



    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Spotless Contest

      Spotless Contest
    • Trash to Treasure

      Trash to Treasure

    We have a be nice policy.
    Please be positive and constructive.




    So adorable and caring. I love it

    Very nice! I'm always glad to see other kat lovers at work.

    That's a very interesting application of real-world tech. Great job!

    This is brilliant! Excellent idea, thank you for sharing the details.

    My dear old mother would have loved to have something like this for me and my siblings ;)