Animal ID
Animal ID
ID
Reading animal tags with Bascom
by 868MHz
The idea to read animal tags with Bascom was born about 2007 when a alien cat regularly stole the
food of my cat. I wanted a cat flap that only would let my cat enter the house. While I was
experimenting with readers, antennas, Bascom programs and my cat, a commercial cat flap with the
ability to read the FDX-B tags came into market and the alien cat stopped its visits (hopefully he
found a new home). So, in the end, my cat flap was never finished, but a Bascom library to read the
animal tags came out.
The ISO standards 11784 and 11785 describe the data protocol for animal identification RFID
transmissions. There are two different types of encoding the transponder transmission, FDX and
HDX.
FDX means full duplex, this is the type the library can decode and the one common reader ICs, like
the EN4095 in the MCS-RFID Reader, can communicate with. FDX transponders are used to tag e.g.
cats, dogs and horses.
HDX transponders are used for cows, pigs, sheeps..., also there are FDX transponders for these
animals too. The communication principle is the same as for the 125kHz RFID Reader - the reader
antenna sends a magnetic alternating field and the transponder gets its energy out of this field (it
has no own energy source). The transponder can drain more or less energy out of this magnetic
field and can this way modulate the amplitude of the readers antenna voltage. This small modulation
is detected by the RFID IC, filtered, amplified and feed to a processor.
30mm Eartag with Country Code 900 (manufacturer Code) and the ID 032500057385
animals
With an antenna coil of around 860uH you should replace CRES with 1,5nF and CRES1 with 100pF.
If the frequency is over 134,2kHz, replace CRES1 with 150pF (depending on the tolerances of the
components other combinations could be necessary). When the frequency is below 134,2kHz you
can fine tune the frequency by decreasing the number of turns of the antenna coil. A frequency
between 131 and 138kHz will be OK, but try to get as close to 134kHz as possible. The further the
frequency is away from the tags resonance frequency, the smaller the reading distance will be. Also
the timing in the library will eventually fail. Then change the capacitor CDC2 into 22nF. This will
increase the receivers bandwidth. The data rate for the animal tags is about 4kHz, that is higher
than in the 125kHz RFID applications with e.g EM4102 Cards.
To optimize the reader you can change the resistor RSER into a 22R and a 100R trimmer in series
and adjust it to maximum reading distance. The EM4095 antenna driver has no overload protection,
so be careful not to draw too much current out of it. With a good adjusted reader and a antenna coil
of about 70mm diameter you can achieve a reading distance of 20...50mm with the small 2.1x12mm
tags used in cats and dogs (good enough to read the number out of a friendly cat or dog) and
40...90mm with the larger eartags. A good power supply (free of drops and spikes) is needed to
achieve the maximum reading distance.
Every disturbance of the power supply will be seen on the antenna voltage and will superimpose the
modulation, thus decreasing the signal to noise ratio.
With the reader used for the pictures below, the reading distance was: -with a 2.1x12mm tag, power
supply 5V via USB (disturbed power supply) about 20mm -with a 30mm ear tag, power supply 5V via
USB (disturbed power supply) about 70mm -with a 2.1x12mm tag, power supply 5V (undisturbed
power supply) about 50mm -with a 30mm ear tag, power supply 5V (undisturbed power supply)
about 95mm
Antenna coil voltage of a EM4095 reader, Coil inductance is 1.4mH, the diameter 70mm. All
measures were made with this antenna. Supply voltage was a good 5V power supply and RSER (33R
and a 100R trimmer in series) was adjusted for maximum reading distance.
Modulation of the antenna voltage with the small tag, reader supplied via USB.
Sync frame and three lsb bytes of the ID 032500037385. Eartag at 35mm distance, supply over USB.
A larger coil diameter will increase the reading distance, but the transponder needs a minimum
magnetic field for a given distance, and with the larger diameter you need more energy in the
resonance circuit to get this. But with more energy in the circuit, the modulation depth of the
antenna voltage will be smaller, making it harder to detect the wanted signal. Also the current drain
out of the power supply will be higher, what can cause more disturbances on the supply voltage.
This makes it hard to easily increase the reading distance by increasing the antenna coil diameter.
The library and the sample code are well commented (so I hope), to understand it, one should read
also the data sheets of the reader ICs and the tags.
http://www.priority1design.com.au/fdx-b_animal_identification_protocol.html
The EM4005.pdf data sheet from EM Microelectronic has also a description of the protocol. I can not
find it on the EM Microelectronic site anymore, but you can find it elsewhere on the Internet. And
there is a application note from Atmel "Using ATA5577 in Animal ID Application" that details the
ISO11784 code structure and gives an example:
http://www.mcselec.com/pub/an/Atmel-9114-ATAN0086-Using-ATA5577-in-Animal-Identification-
Application_Application-Note.pdf
The AnimalID_em4095.lib can be used with the EM4095 chip or the U2270 reader chip. The
MLX90109 should work too (MODE pin floating), but I have never tested this and took only a quick
look into the data sheet. The HTRC110 (successor HTRC11001) can be used with the
AnimalID_HTRC110.lib, suitable crystal frequencies are recommended in the library and the sample
program.
For first tests with the reader and the program I recommend to use eartags and not the small glass
transponders, the signal is much stronger, making it easier to adjust the hardware. In Germany the
2.1x12mm tags are sold via on-line auctions (search for ISO Transponder) for around 5Euros, the
eartags can be found there too, search for "RFID Ohrmarke".
Make sure to get ISO FDX-B transponders with a frequency of 134.2kHz, HDX transponders will not
work with the library and the reader ICs.
http://www.mcselec.com/pub/an/an404.pdf
http://www.mcselec.com/pub/an/an411.pdf
http://www.mcselec.com/pub/an/00678b.pdf
http://www.mcselec.com/pub/an/doc4684.pdf
http://www.mcselec.com/pub/an/doc4661.pdf
U2270B Antenna Design Hints search Internet for "U2270B Antenna Design Hints.pdf" HTRC11001T
HITAG reader chip Data Sheet at
http://www.mcselec.com/pub/an/HTRC11001T.pdf
http://www.mcselec.com/pub/an/037031.pdf
Click here for download archive with source code and schematic
Sample code:
$hwstack = 64
$swstack = 64
$framesize = 64
$regfile = "m8def.dat"
$crystal = 7372800
$baud = 9600
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'You need a string with 12 characters if you want to convert the binary id into a decimal ascii id
'The id of the animal transponder is given in decimal, e.g. your cat could have a transponder
'with the id "094190000056", this would be in Hex "15EE2957B8". In your "Certification of
'Vaccination" for your cat you would find that number in decimal (276094190000056). The 276 in that
'number is the country code, in this case the code for Germany.
Dim Str_tagid As String * 12
'with _HTRC_FRAME=1 the timing of the received signal will stricter be proved, this
'needs more program space, but avoids false "sync received" states (Basic HTRC Error code 1)
'the "valid tag received" state is not affected, but the receiving range can be a bit shorter
Const _htrc_frame = 1
'The function "ID2String" will convert the 5 byte ID from the tag into a ascii string. You need a s
tring
'with a length of min. 12 bytes.
$external Id2string
Declare Function Id2string() As String
'
'-------------------------------------------------------------------------------------------------
'END of "Use of the AnimalID EM4095 Library"
Do
Tag_err = Readhitag(tagdata(1)) 'try to receive an id
Str_tagid = Id2string() 'convert the received bytes into decimal