Types of NFC tags
There are four types of tags described by the NFC forum, all based on RFID protocols. This makes NFC tags partially compatible with many existing RFID systems (eg Mifare and FeliCa). Although these older systems do not support NDEF, they can still recognize NFC tags that are compatible with them.
For example, an RFID reader that is designed to work with Mifare Ultralight tags can read the ID number of an NFC type 2 tag, although it cannot read NDEF encoded information. There is also a fifth type that is compatible with the technology but is not part of the NFC specification.
Types 1, 2 and 4 are based on GOST R ISO/IEC 14443A (consists of four parts: 1, 2, 3, 4), type 3 is based on GOST R ISO/IEC 18092. More details about each of the types can be read under the spoiler.
- Based on GOST R ISO/IEC 14443A;
- Can be either read-only or read/write;
- Contains 96 bytes to 2 kb of memory;
- No data collision protection (note – collisions can occur; when two active sources transmit data at the same time);
- Examples: Innovision Topaz, Broadcom BCM20203.
Type 2:
- Similar to type 1 based on NXP/PhilipsMifareUltralight tags (GOST R ISO/IEC 14443A);
- Can be either read-only or read/write;
- Contains 96 bytes to 2 kb of memory;
- Communication speed 106 kbps;
- Anti-collision support;
- Example: NXP Mifare Ultralight.
Type 3:
- Based on Sony FeliCa tags (GOST R ISO/IEC 18092 and JIS-X-6319-4) without the encryption and authentication support provided by the FeliCa specification;
- Can be either read-only or read/write;
- Communication speed 212 or 424 kbps;
- Anti-collision support;
- Example: Sony FeliCa.
Type 4:
- Similar to Type 1, Type 4 is based on GOST R ISO/IEC 14443A;
- Can be either read-only or read/write;
- 2, 4, or 8 KB memory;
- Communication speed 106, 212 or 424 kbps;
- Anti-collision support;
- Example: NXP DESFire, SmartMX-JCOP.
The fifth type is the property of NXPSemiconductors and probably the most common MifareClassictag today (GOST R ISO/IEC 14443A):
- Memory: 192, 768 or 3584 bytes;
- Communication speed 106 kbps;
- Anti-collision support;
- Example: NXP Mifare Classic 1K, Mifare Classic 4K, Mifare Classic Mini.
How to use on a smartphone?
NFC in the phone: what is it and how to use it? – These are 2 related questions that are directly related to the name of the technology, which in Russian stands for “communication of the field nearby.” The technology is a wireless connection method over a short distance. 2 devices in which this chip is embedded can exchange information with each other. The transmission distance is only a few centimeters. The principle of operation resembles an infrared port in older models of devices.
Today, NFC is installed in almost all mobile devices manufactured by market leaders. Initially, the concept of technology meant its use as a virtual form of debit cards. Additional useful uses that have emerged over time include access to various institutions and personal identification.
Support for the technology began with Android 4.0, mobile platforms have a built-in function – Beam for exchanging files between smartphones.
When the mode is activated, it is necessary to proceed to the next stage – the use of technology for the required purpose (data or payment).
If you plan to transfer data, you need to pay attention to:
- smartphones or tablets must have the NFC mode activated and the Android Beam auxiliary function;
- when locked or in sleep mode, data transmission is interrupted;
- when devices are connected at an optimal distance, a special sound signal will be transmitted, which indicates that the device enters the NFC field of action;
- devices must not be separated until the final transfer of data, which will be announced by a special sound signal.
The transfer process itself is simple and very similar to the standard Bluetooth function. It is possible to transfer data between any devices:
- You need to go to the folder with the corresponding content.
- Connect the devices with the back sides, placing them right next to each other.
- Expect an audible message when the smartphones find each other. On the screen of the smartphone to send, there will be a message that you should click on to start the transfer.
Currently, there are 3 main ways to use the technology, so the question of how to use NFC should not be inconvenient. Equipment owners are offered:
- pay with gadgets in stores;
- launch using application and program tags;
- transmit information using NFS instead of Bluetooth.
Knowing what NFC is in a smartphone, users should understand that there is no need to worry about the security of personal data or finances. If you do not do stupid things and take the protection of personal information seriously, there will be no trouble. And with an irresponsible attitude, even the most reliable and secure system will not help users.
NFC algorithm
NFC, like RFID, has an initiator and target in the exchange, but the new technology allows much more than a simple exchange of an identifier and reading or writing target information. The most significant difference between the two technologies is that NFC targets are often programmable devices such as smartphones. This means that it is possible to exchange not only static data, but also generate a response to the information requested by the initiator each time.
NFC devices have two interaction modes. If the initiator emits radio frequency waves, and the target receives power at the expense of the initiator, then this mode of interaction is called passive. In active mode, the initiator and target have their own power supplies and are independent of each other. These modes are the same as RFID modes.
NFC devices also have three ways of working. They can work in the mode of reading information from the target or writing to it. They can emulate cards by acting like RFID tags when they are in the field of another NFC or RFID device. Or they can work in peer-to-peer (P2P) mode, in which they exchange data in both directions at once.
The first main difference between NFC and RFID is the peer-to-peer interaction method, which is implemented using GOST R ISO / IEC 18092. P2P data exchange is implemented by two protocols – the logical link control protocol (LLCP) and a simple NDEF data exchange protocol (SNEP – simple NDEF exchange format).
Pros and cons of paying by phone
Contactless payment is the most popular. Buying goods and then transferring money through a smartphone has a number of important advantages:
- simplicity of the process;
- the ability not to carry a card;
- reliability and security of financial transactions;
- constant availability of a source of funds at hand.
There are no obvious disadvantages of the electronic payment instrument, since all existing weaknesses are also present in standard bank cards.
NFC architecture
There are several layers in the NFC architecture. The lowest of them is the physical one, which is implemented by the CPU and other hardware complex through which the interaction takes place. In the middle is the packet data and the transport layer, then the layer data format, and finally the software.
At the physical layer, NFC works according to the algorithm described in GOST for RFID (GOST R ISO / IEC 14443-2-2014), which refers to low-power radio signals with a frequency of 13.56 MHz. Then comes the level that describes the breakdown of the data stream into frames (GOST R ISO / IEC 14443-3-2014). Any radio controllers that are used in a phone, tablet, or connected to a computer or microcontroller are separate hardware components.
They communicate with the main processor through one or more standard serial protocols between devices: Universal Asynchronous Transceiver (UART), Serial Peripheral Interface (SPI), Serial Data Bus for Integrated Circuit Communications (I2C), or Universal Serial Bus (USB) .
Above this are several RFID command protocols based on two specifications. N FC tag reading and writing is based on the original RFID GOST R ISO/IEC 14443A. The Philips/NXP Semiconductors Mifare Classic and Mifare Ultralight and NXP DESFire protocols are compliant with GOST R ISO/IEC 14443A. P2P NFC data exchange is based on GOST R ISO/IEC 18092.
They are depicted in the figure above on a par with other control protocols, since they use the same standard.
Functions of NFC technology in everyday life
In everyday life, NFC functions are related to running programs and applications. As a result, technology users are able to:
- instantly launch navigators;
- set up quick access to virtual services;
- turn on a kind of alarm clock, reminding you of important planned actions and affairs;
- speed up the process of launching equipment and programs.
The final appointment depends on the desires and fantasies of the user and has practically no restrictions (within reason and capabilities of phones).
For payment
The most important function, as mentioned above, is the use of mobile as a convenient payment tool. To pay for purchases in the store, you will need:
- link a bank card to a gadget;
- bring the device to the terminal (as a standard “plastic” with PayPass technology)
- wait for the payment information to be read;
- enter the pin code.
- After that, it remains to pick up the paid goods.
In the house
The use of NFS in the home depends primarily on the user’s imagination. Those wishing to take advantage of the system’s capabilities are able to:
- automatically turn off wi-fi when leaving the apartment;
- launch an application with a notebook in the morning;
- turn off unnecessary options before going to bed;
- turn on the alarm.
The list above is just an example, since the full list of possibilities is much wider. The main condition for using this service will be a connection with the phone, without which it is impossible to program the execution of pre-selected tasks and the launch of utilities and useful services.
device with configured service;
with a label located in the right place (they will be discussed below).
To start or turn off wi-fi, you need to do just a couple of actions:
- bring the cell phone to the mark;
- wait for it to be read;
- after which the device will perform the task provided by the settings.
You won’t have to do anything extra, since the connection to the Internet (or the disabling of traffic distribution) will already happen.
In the office
The process of using appliances in the office is not much different from using appliances in everyday life and at home. The main benefit that office workers can get is the automation of part of the work processes. Thus, employees are able to turn on some of the systems that are important for their activities with the help of NFS tags with one touch. As a result, the time required to activate workflows is saved.
An alternative way to benefit is through the transfer of small files and documents. But it is relevant for employees working in close proximity to each other.
In the car
The most obvious benefit from the presence of NFC tags in transport will be the automatic inclusion of navigators on smartphones mentioned above. Drivers and motorists just need to bring the device to the desired point of the car and wait until the system opens the map and builds a suitable route. It is unlikely that such an action will save a lot of time, but it will certainly simplify the life of car owners, saving them from the necessary procedure for launching GPS navigators and giving them the right to use the online service without unnecessary worries.
Creating Common NDEF Records
NDEF is used to format exchange data between devices and tags. This format typifies all messages that are used in NFC, and it does not matter for the card or for the device. Each NDEF message contains one or more NDEF entries. Each of them contains a unique record type, an identifier, a length, and a field for the information to be reported.
There are several common types of NDEF records:
- Regular text entries. Any string can be sent to them, they do not contain instructions for the target, but contain metadata about the language of the text and the encoding.
- URI. Such records contain data about Internet links. A target that receives such an entry will open it in an application that can display it. For example, a web browser.
- Smart recording. Contains not only web links, but also a text description for them, so that it is clear what is located on this link. Depending on the recording data, the phone can open the information in the desired application, be it SMS or e-mail, or change the phone settings (sound volume, screen brightness, etc.).
- Signature. It allows you to prove that the information that has been transmitted or is being transmitted is reliable.
You can use multiple record types in one NDEF message.
You can think of a message as a paragraph and notes as sentences. A paragraph is a specific unit of information that contains one or more sentences. Whereas a sentence is a smaller unit of information that contains just one idea. For example, you can make birthday invitations in the form of a paragraph and write information about the date, time and place of the event in separate sentences, and use NDEF messages to send friends a reminder of this event, where there will be a text message describing the event, a smart entry with a place and a web link on how to get to that location.
The second main difference between NFC and RFID is the NFC data exchange format (NDEF). N DEF defines the format of data in messages, which in turn consist of NDEF records. There are several types of records, which will be discussed in more detail below. N DEF makes it possible to use code to control the process of reading and writing NFC tags, peer-to-peer communication, and card emulation.
NDEF contains information about the byte representation of messages that can contain multiple entries. Each entry has a header that contains metadata (type, length, etc.) and information to send. If we return to the analogy with the paragraph, then the paragraph is formed from sentences related to the same topic, and in NDEF messages – it’s good when all entries relate to the same topic.
NDEF messages are mostly short, each exchange consists of one message, each label also contains one message. Since the exchange of NFC data occurs when one device is touched by another or by a label, it will be inconvenient to transmit the text of an entire book in one message, so the length of an NDEF message is comparable to the length of a paragraph, but not the entire book.
An NDEF record contains information to forward and metadata on how to interpret this information. Each entry can be of a different type, which is announced in the title of that entry. The header also describes what place the record occupies in the message, after the header information follows. The figure below shows complete information about the location of bits and bytes of information in the NDEF record.
The space for information in an NDEF record is limited to 2^32-1 bytes, but you can chain records within a message to send larger information. In theory, there are no restrictions on NDEF messages, but in practice, the message size is limited by the capabilities of the devices or tags involved in the exchange of information.
If only devices are involved in the exchange, then the length of the message will be limited by the computing power of the weakest of the devices, but it is worth considering that the devices will have to be kept nearby for a long time to send all the data. When the smartphone and the card interact, the length of the message will be limited by the memory size of the card.
In general, data exchange via NFC is quite fast. The person brings the mobile device to the tag, there is a brief exchange of information, and the person moves on. This technology was not designed for long exchanges of information, because the devices literally have to be a couple of centimeters apart.
In order to transmit a large amount of information, the devices will have to be kept next to each other for a long time, which can be inconvenient. If you need a long interaction between devices, then you can use NFC to quickly exchange data about the capabilities of devices and then turn on one of the more suitable data transfer methods (Bluetooth, Wi-Fi, etc.).
When an Android phone reads an NFC tag, it first processes and recognizes it, and then transfers the data about it to the appropriate application for the subsequent creation of an intent. If more than one application can work with NFC, the application selection menu will appear. The recognition system is defined by three intents, which are listed in order of importance from highest to lowest:
- ACTION_NDEF_DISCOVERED: This intent is used to start an activity if the label contains an NDEF message. It has the highest priority and the system will run it first.
- ACTION_TECH_DISCOVERED: If no activity is registered for an ACTION_NDEF_DISCOVERED intent, then the recognition system will try to launch an application with that intent. Also, this intent will be fired immediately if the found NDEF message does not match the MIME type or URI, or the label does not contain a message at all.
- ACTION_TAG_DISCOVERED: This intent will fire if the previous two intents failed.
In general, the recognition system works as shown in the figure below.
When possible, the ACTION_NDEF_DISCOVERED intent is fired because it is the most specific of the three. Moreover, with its help it will be possible to launch your application.
If the activity is launched due to an NFC intent, then you can get information from the scanned NFC tag from this intent. Intent may contain the following additional fields (depending on the type of scanned tag):
- EXTRA_TAG (mandatory): Tag object describing the scanned tag.
- EXTRA_NDEF_MESSAGES (optional): Array of NDEF messages calculated from the label. This extra field is specific to the ACTION_NDEF_DISCOVERED intent only.
- EXTRA_ID (optional): Low-level label ID.
Below is an example that checks the intent ACTION_NDEF_DISCOVERED and gets NDEF messages from the extra field.
Kotlin
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
.
if (NfcAdapter.ACTION_NDEF_DISCOVERED == intent.action) {
intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)?also { rawMessages -{amp}gt;
val messages: List = rawMessages.map { it as NdefMessage }
// Processing the array of messages.
.
}
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
.
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
Parcelable[] rawMessages =
intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
if (rawMessages != null) {
NdefMessage[] messages = new NdefMessage[rawMessages.length];
for (int i = 0; i {amp}lt; rawMessages.length; i ) {
messages[i] = (NdefMessage) rawMessages[i];
}
// Processing the array of messages.
.
}
}
}
Kotlin
val tag: Tag = intent.getParcelableExtra(NfcAdapter. EXTRA_TAG)
Tag tag = intent.getParcelableExtra(NfcAdapter. EXTRA_TAG);
There are several methods for creating an NDEF entry: createUri(), createExternal() and createMime(). It is better to use one of them in order to avoid errors that may occur when creating a record manually. All examples below should be sent as the first message when writing a tag, or by pairing with another device.
Kotlin
How do I know if my phone supports NFC?
How to check if NFC is available in the phone? There are several ways:
- Remove the back cover of the smartphone and inspect the battery, it should have the inscription “NFC”.
- In the settings, find the “Wireless networks” tab, click on “More”, if the technology is available, a line with the name of the technology will appear.
- Swipe your hand across the screen, open the notification curtain, where this option will be written.
Having dealt with the benefits of NFC technology in everyday life, you should return to its usual purpose – use as a payment instrument. In order to pay by cellular in stores and pay for services with one touch, several conditions must be met:
- the device must have a special chip;
- the operating system must support the operation of the utility;
- binding of a bank card is obligatory;
- the bank must join the financial system and allow contactless transactions for customers.
Google Pay is the most common version of the mentioned online financial service, which works on devices with the Android operating system. They are closely connected to the Google app store and use all the extensions and additions provided by the digital corporation. At the same time, the payment process does not have obvious differences and important characteristic features, and therefore the main detail that distinguishes it from the general background will be compatibility with the Android platform.
Apple Pay is a full-fledged analogue of the online service from Google, which differs from it only by the manufacturer – Apple Corporation and compatible devices where the utility is used. Similar devices, as indicated by the name of the manufacturer, will be the iPhone and other similar devices. The principle of payment, despite the change of the developer, will remain unchanged. It is enough to attach an iPhone to the terminal and wait for the transfer of financial information.
Samsung Pay is the third type of online financial system that allows you to pay for goods and services in stores. Looking at the name, it is not difficult to guess what its most important distinguishing feature is. Samsung Corporation uses its own developments in the manufactured equipment, which include Samsung Pay.
Microsoft Pay
Not much different from what Google and Microsoft Pay offer. And the most important distinguishing feature is again associated with the manufacturer. The mentioned online system is used on devices where the Windows platform is used as the basis. Naturally, differences in approaches give rise to other distinctive nuances and details that distinguish programs from different developers. But most of the differences are “cosmetic” in nature and will not affect the process of transferring funds.
It makes no sense to list banks and financial organizations that allow you to pay for purchases without using “plastic”. The list is huge and includes not only the flagships of the banking sector, such as Sberbank, but also regional institutions, such as Ak Bars. Therefore, those who hope to get rid of the card are advised to call the contact center of the institution they need and clarify the required information with support operators.
Tags
As mentioned above, the app requires NFC tags to work. They are small sticker devices that store a small amount of information and transmit it to a nearby device. They work from the magnetic field generated by the telephone. This is what makes them “near field” communication devices. They become active only when the magnetic field approaches, which surrounds a small area around the cell.
In general terms, a description of the main principles of operation is presented above. To the above, it should be added that the circuits used for data exchange are tuned to a certain frequency, which allows them to work with maximum efficiency. And the amount of energy received limits the scope of their action to 10 centimeters (often the distance is even less).
Types of tags
Currently, there are 4 types of NFC tags, differing in basic operation parameters. They do not have a specific name, while a brief description of each contains:
- the first one – 48 bytes of memory and transmission at a speed of up to 106 Kbps;
- second – 2 Kb and transmission level limit – 106 Kb;
- the third stands out with an increase in bandwidth to 212 Kbps;
- the fourth with 32 Kb memory and 424 speed.
To set a task on an NFS tag, you will need:
- turn on the application on the phone to use the technology;
- read the mark by bringing a gadget to it;
- select the action to be taken when a connection is established in the future;
- save the set work pattern.
Conclusion
NFC technology adds promising functionality to RFID technology. The most significant innovation is the NFC Data Interchange Format (NDEF), which provides the ability to format regular data into one of four NFC tag technologies. N DEF can be used both for data exchange between a device and a tag, and for exchange between devices. This makes NFC suitable not only as a method of identification, but also as a means of exchanging short blocks of data.
For more information about NFC or NDEF, see Tom Igoe, Don Coleman, and Brian Jepson Beginning NFC. Near Field Communication with Arduino, Android, and PhoneGap.