0% found this document useful (0 votes)
28 views9 pages

Animal ID

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 ca

Uploaded by

Shabbir Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views9 pages

Animal ID

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 ca

Uploaded by

Shabbir Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

AN #180 - Animal

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

2.1x12mm Tag used for small

animals

The 2.1x12mm Tag in detail


To use the MCS-RFID Reader with the FDX-B animal tags, there must be made some modifications
on the hardware. The transmitting frequency is 134.2kHz instead of 125kHz, so you have to change
the capacitor CRES to a smaller one or decrease the inductance of the readers antenna coil L.

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.

A good description of the FDX-B protocol can be found at:

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".

http://www.texas-trading.de sells the glass transponders and the eartags.

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.

EM4095 Data Sheet at


http://www.mcselec.com/pub/an/em4095_ds.pdf

EM4095 Application Note at

http://www.mcselec.com/pub/an/an404.pdf

RFID Made Easy AppNote 411 from EM Microelectronic at

http://www.mcselec.com/pub/an/an411.pdf

RFID Coil Design from Microchip at

http://www.mcselec.com/pub/an/00678b.pdf

U2270B Data Sheet at

http://www.mcselec.com/pub/an/doc4684.pdf

U2270B Application Note at

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

Read/write devices based on the HITAG read/write IC HTRC110 -Application Note at


http://www.mcselec.com/pub/an/AN98080.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

'Configure some pins used to control the em4095 chip


Shd_pin Alias Portc.1 'A High level voltage forces the em4095
circuit into sleep mode
Mod_pin Alias Portc.2 'A High level voltage modulates the em4
095 antenna
Config Shd_pin = Output
Config Mod_pin = Output
Reset Mod_pin 'Sleep mode is off
Reset Shd_pin 'No modulation

'Dimension the variables needed to run the readhitag command


'-------------------------------------------------------------------------------------------------
'
'You need 10 bytes to store the tag data
Dim Tagdata(10) As Byte
'The tag id will be in byte 1,2,3,4 and 5 of tagdata (LS-Byte to MS-Byte)

'The Countrycode will be in the 6. and 7. byte of tagdata


Dim Country As Word At Tagdata(6) Overlay

'Readhitag will give a error code back


'You need one byte to store the error code
Dim Tag_err As Byte
'Error code is:
'0 = timeout, no valid id read
'1 = a sync was received but the crc was wrong
'2 = a valid tag id was received, the crc was ok

'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

'Use of the AnimalID EM4095 Library


'-------------------------------------------------------------------------------------------------
'
'Instead of Timer0 you can use Timer2 if the Chip has one.
'To use Timer2 define a constant with "Const _htrc_timer = 2"
'To use Timer0 as in the original library define "Const _htrc_timer = 0" or omit this line.
Const _htrc_timer = 0

'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

'use the AnimalID-Library


$lib "AnimalID_em4095.lib"

'Hitag= 64 -> divider for the used timer


'Type = Htrc110 -> set constants and variables as for the htrc110.lib
'Dout = PIN... -> Pin used to read the em4095 output "Demod_Out"
'Int = @INT0 -> The used interrupt
Config Hitag = 64 , Type = Htrc110 , Dout = Pind.2 , Int = @int0

'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"

On Int0 Checkints Nosave ' PIND.2 is INT0


Config Int0 = Change 'you must configure the pin to work in
pin change intertupt mode
Enable Interrupts
Print
Print "Animal ID Reader with em4095"
Wait 1

Do
Tag_err = Readhitag(tagdata(1)) 'try to receive an id
Str_tagid = Id2string() 'convert the received bytes into decimal

If Tag_err = 2 Then 'sync and crc was ok -> the tag id is ok


Print
'transmit the decimal id
Print Country ; Str_tagid ; " dec "
'and the hex
Print Hex(country) ; " " ; Hex(tagdata(5)) ; ; Hex(tagdata(4)) ; Hex(tagdata(3)) ; Hex(tagdata(2))
; Hex(tagdata(1)) ; " Hex"
Else
If Tag_err = 1 Then 'only sync was ok. crc was false
Print "'";
Else
Print "."; 'Tag_err=0 -> no sync was received, no valid crc, no valid tag id
End If
End If
Waitms 200 'wait a little
Loop

'this routine is called by the interrupt routine


Checkints:
Call _checkhitag 'you must call this label
Return
[ Back ]

You might also like