LATEST VERSION 1.1 (23.05.2017)


RFID is an acronym for “radio-frequency identification” and refers to a technology whereby digital data encoded in RFID tags or smart labels (defined below) are captured by a reader via radio waves. RFID systems consist of three components: an RFID tag or smart label, an RFID reader, and an antenna. RFID tags contain an integrated circuit and an antenna, which are used to transmit data to the RFID reader. The reader then converts the radio waves to a more usable form of data. Information collected from the tags is then transferred through a communications interface to a host computer system, where the data can be stored in a database and analyzed at a later time. 
The tag is composed of a protective material that holds the pieces together and shields them from various environmental conditions. The protective material depends on the application. For example, employee ID badges containing RFID tags are typically made from durable plastic (or even in form of paper stickers), and the tag is embedded between the layers of plastic or papers. RFID tags come in a variety of shapes and sizes and are either passive or active. Passive tags are the most widely used, as they are smaller and less expensive to implement. Passive tags must be “powered up” by the RFID reader before they can transmit data.
URfid module was implemented to work with modular W20-USB (or compatible) reader 13.56 MHz. WARNING!!! The library (URfid) doesn't work with simple readers that are recognized by the device manager as a USB input device (keyboard). The reader can be used in many RFID applications such as personal identification, logistics, access control, attendance control, and process control industry. When connecting the USB cable to your PC or Lap, the RFID reader-USB module is detected by any Windows 10, 8 or 7 system, installing his driver automatically. 


Additionally, a module was tested using ISO-14443A S50 tags. The technology of these ISO-14443A tags was developed by NXP Semiconductors and the full technical specifications can be seen here LINK.


ISO-14443A S50 TAGS

These tags are sold commercially as stickers, cards or keychain. There are ISO-14443A tags with 1 Kb and 4 Kb of EEPROM.

The tag basically contains two electronic components: a specialized microcontroller known as 'chip' and an antenna for transmission and reception of data at a frequency of 13.56 MHz, which is the standard used in RFID radio link systems.

The microcontroller or 'chip' contains a read-write EEPROM, which is where the tag information is stored. All tags have a serial number, known as NUID (Non Unique Identification Number) of 4 bytes which is factory prerecorded. Some recent manufactured tags feature a serial number of 7 bytes, called UID (Unique Identification Number).

The tags do not have their own power supply, and are energized from the electromagnetic field generated by RFID reader antenna to establish the radio link. To this end, it is necessary to bring the tag to a distance of about 2-4 cm of the RFID module and remain in that position until the read/write cycle of the tag has been concluded.

The communication between the tag and the RFID reader module is handled, as mentioned, by radio link, at a frequency of 13.56 MHz and through a proprietary protocol. During the exchange of data between two devices, 16-bit CRC protection codes are managed to ensure the integrity of the stored and read information from the EEPROM. The speed of data transmission between the tag and the RFID device reaches about 100 kbits/sec.

Memory organization

For the ISO-14443A 1 Kb tag, the total capacity in the EEPROM is 1024 bytes. However, because of the locations used for security codes, the number of user available locations for data storage is 768 bytes. The memory of the 1 Kb EEPROM is organized in 16 sectors of 4 blocks each, for a total of 64 blocks. Each block in turn is constituted by 16 bytes.


Sector 0, block 0, serial number NUID and BBC byte

In sector 0, block 0, the first 4 bytes store the tag's serial number (NUID) and manufacturer information. This block is protected and can only be read. The byte number 4 is known as BCC (Block Check Character) and is a checking value for the serial number, calculated with the logical operation 'Exclusive OR' of the previous 4 bytes.


Sector Trailer

Each sector, as mentioned, has 4 blocks. The fourth block is called "Sector Trailer" and has the function of setting permissions and access codes for reading / writing data from that sector. In this block, 2 security codes called Key A and Key B are included as well as 4 bytes "Access bits" for configuration management to be given to the data in that sector. The Key A code can be written but not read.

The Key B code is optional and may be used or not, to the convenience of the system programmer. Data can only be read or modified in any sector only if the Key A and / or Key B are known. Both keys provide a safety mechanism for the protection and integrity of data in each sector.

The ISO-14443A purchase a new card, by default, both Key A and B have values


and the "Access bits" have values

​​0x07 0x80 0x69 0xFF.

This initial settings in ISO-14443A tags, are called 'transport configuration'.

The 16 blocks called "Sector Trailers" are identified with the numbers: 

3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59 and 63,

and can not be used by the user to store information, but only for the purposes outlined above, ie, select the configuration and security settings of each sector.


Access bits

The so called "Access bits", are arranged as shown in the table below. The base is formed by 3 bits, C1, C2 and C3, which define permissions for each of the 4 blocks of the sector. To identify the function of each bit, subscripts are used, for example, for the configuration of block 3, bits C13, C23 and C33 would be used.

In total, 12 bits are used for the configuration of the 4 blocks. As shown in the figure, the 12 bits of access are stored, including its complement, to provide a verification of the integrity of this data.


The settings options of the access bits on read /write data of the tag are very numerous. For complete usage information of access bits for ISO-14443A tags, please read documentation LINK.


ISO-14443A S70 TAGS

These tags are very similar to S50, but have bigger memory and slightly different memmory organization. The 4 kByte EEPROM memory is organized in 32 sectors with 4 blocks (as S50) and in 8 sectors with 16 blocks. One block consists of 16 bytes.



Module functions

Main slots; - initialize module
URfid.IsCard(); - check if card exist, this function always fills cardSerial variable,

0 - no card,
1 - is card,
2 - is more than one card,

URfid.cardSerial; - card serial number, [sn0,...,sn3], read if IsCard() returns true;
URfid.requestMode; - set request mode,

0 - idle,
1 - all,

URfid.keyType; - set access key type,

0 - KeyA,
1 - KeyB,

URfid.SetBlockKey([key0,…,key5]); - set access key, key must be 6-size array.

Read functions

URfid.ReadCard(startBlock, numberBlocks); - read data from card, returns true if success,

startBlock - 0..(cardMemorySize/16 - 1),
numberBlocks - 1..4,

URfid.cardData; - read data in array form, [data0, data1,..,data15],
URfid.cardString; - read data in string form, "text"

Write functions

BE CAREFUL to not write Sector Trailer if not intend, recommend to write data block by block - size not longer than 16!

URfid.WriteCardData(startBlock, [data0, data1,..,data15]); - write data to card, returns true if success,

startBlock - 1..(cardMemorySize/16 - 1), 0 can NOT be written,
data - size must be 1..64, function writes multiple of 16, ie. [0,1,2,3,4,5,6,7,8,9] will write whole block [0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0]

URfid.WriteCardString(startBlock, "0123456789ABCDEF"); - write text to card, returns true if success,

startBlock - 1..(cardMemorySize/16 - 1), 0 can NOT be written,
text - size must be 1..64, function writes multiple of 16 characters, ie. "abcdefghij" will write whole block "abcdefghij\0\0\0\0\0\0"

Other functions

URfid.Buzzer(freq, duration); - turn on buzzer,
URfid.LED(freq, duration); - turn on/off LED blinking.


Urbiscript example

var Global.Rfid =;
Rfid.Buzzer(3, 2);
Rfid.LED(10, 2);
t:every (500ms) {
   if (Rfid.IsCard()) {
      Rfid.Buzzer(2, 1);
      Rfid.LED(10, 1);
      echo("[" + Rfid.cardSerial[0] + " " + Rfid.cardSerial[1] + " " +Rfid.cardSerial[2] + " " + Rfid.cardSerial[3] + "]");




Optional tool: USB RFID reader v1.0 - simple application to read and write S50 cards.



EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 1.0, 04.04.2018

FLASH Documentation