Xadow - NFC
Near Field Communication (NFC) is a set of short-range wireless technologies. It's behind daily applications such as access control system and mobile payment system.
Xadow NFC features a highly integrated transceiver module PN532 which handles contactless communication at 13.56MHz. You can read and write a 13.56MHz tag with this module or implement point to point data exchange with two Xadow NFCs. Xadow NFC is designed to use I2C, SPI or UART communication protocols, and I2C is the default mode. In addition, we assign an independent PCB antenna which can easily stretch out of any enclosure you use, leaving more room for you to design the exterior of your project.
- Working Voltage: 3.3V
- Working Current:
- Static Mode: 73mA
- Write/Read Mode: 83mA
- Support host interface: I2C(default), SPI, UART.
- Serve for contactless communication at 13.56MHz.
- Support ISO14443 Type A and Type B protocols.
- Max operating distance for detecting NFC tags is 28mm depending on current antenna size.
- Support P2P communication.
- Dimensions: 25.43mm x 20.35mm
Xadow NFC has many capabilities which integrates a PN532 NFC controller, our Arduino library supports reading/writing tags, phone-to-Xadow NFC communication, tag emulation at this time, it's a 3-in-1 allstar.
!!!Note: When Xadow NFC is using SPI communication protocols, there is an existing library which supports phone-to-Xadow NFC communication. The default communication mode for this product is I2C, so the library cannot use directly.
Before reading/writing tag, what you need to prepare is the hardware installation and the libraries.
- The hardware installation as shown below:
!!!Note: When connect Xadow - NFC to Xadow - Main Board, you should concern about the connection direction. The connection method is that the unfilled corner of one Xadow module need to connect to the right angle of another module (see four corners of each Xadow module).
- Download PN532 library and NDEF Library. Do not forget to install these libraries into Arduino Library. If you haven't knew clearly the operation, please refer here for a closer look.
!!!Note: Make sure that you have folders - PN532, PN532_SPI, PN532_I2C, PN532_HSU and NDEF (from NDEF Library) in your Arduino Library folder.
Demo 1: Write messages to tag
- Open the code directly by the path:File -> Example ->Ndef_dev->WriteTag.
In this code, the function message.addUriRecord("https://arduino.cc") is used to write message to tag. You can replace the message "https://arduino.cc" with new message. For example, we input "do you happy?" and "hello, world" using this function.
- Upload the code and open the Serial Monitor, It prompts you to place a NFC tag on the NFC antenna. After a successful operation, it will prompt you to read the tag.
Demo 2: Read tag
If you want to know whether the writing operation you have just done is successful, you can use the code:ReadTag for checking.
- Open the code:ReadTag directly by the path:File -> Example ->Ndef_dev->ReadTag and upload it to your Xadow Main Board.
- Open the Serial Monitor to see the tag information. Following figure shows the reading result:
It is essential to explain a NDEF message in order to have a clear recognition about the above picture. There can be multiple records in a NDEF message. For our analysis purposes we use only one NDEF records.
TNF(001) - The TNF field value indicates the structure of the value of the TYPE field. The value 0x01 (NFC Forum well-known type) indicates that the TYPE field contains a value that follows the RTD type name format defined in the NFC Forum RTD specification).
Type Length - The TYPE_LENGTH field is an unsigned 8-bit integer that specifies the length in octets of the TYPE field. The TYPE_LENGTH field is always zero for certain values of the TNF field.
Pay load Length - The PAYLOAD_LENGTH field is an unsigned integer that specifies the length in octets of the PAYLOAD field (the application payload). The size of the PAYLOAD_LENGTH field is determined by the value of the SR flag
Type(55) - The value of the TYPE field is an identifier describing the type of the payload, The URI record type (“U”)
Pay Load - The rest of the string in UTF-8