NFC: Write Custom NDEF Text Message to Card
by istvanren in Circuits > Arduino
31 Views, 0 Favorites, 0 Comments
NFC: Write Custom NDEF Text Message to Card
.jpg)
Storing information on an NFC card can be very useful and fun. Upon reading the card with an NFC reader device, different actions can be triggered by a microcontroller, based on the information - like controlling a light or an IoT device. This project is about writing custom NDEF text messages (or records) to NDEF-formatted cards. NFC Data Exchange Format (NDEF) is a standardized way of information exchange between readers and tags. There are different types of NDEF messages, like URLs for websites, WiFi credentials, contact information and text. Text NDEF records contain information about the encoding, language code and the text content itself. When creating the text record, this project uses UTF-8 character encoding and language code "en" for English. The text content can be provided via the Arduino IDE's built-in Serial Monitor.
Supplies
- Arduino IDE
- Arduino Uno R4 WiFi or Minima
- Renesas PTX105R NFC shield
- NDEF-formatted NFC tag of Type 2, 3, 4 or 5
Configure the Shield

The shield can be configured to use the SPI, I2C or UART interface, by arranging the pin-caps. The out-of-the-box configuration is SPI.
Install the PTX105R NFC Library

Install the library from the Arduino Library Manager for SPI, I2C or UART. Make sure there's only one of the interfaces is installed at a time.
Upload the Project

- Open the supplied .ino file with the Arduino IDE.
- Plug in the Arduino Uno R4 board.
- Open and configure the Serial Monitor to send a New Line and use 115200 baud rate.
- Upload the project to the board
Downloads
Write Text Record to Card



- Make sure the initial instructions are displayed on the Serial Monitor.
- Place an NDEF-formatted card on the antenna.
- Type a text into the Serial Monitor and press Enter.
- Information about the card and the text record will be displayed on the Serial Monitor
Additional Steps and Information

In order to verify the NDEF message, the PTX105R NDEF Read Example can be used to read the card.
Possible troubleshooting:
- If the initial instructions do not appear on the Serial Monitor after uploading, press the reset button on the Uno R4 board.
- If the card cannot be written, make sure it's NDEF formatted. The PTX105R Arduino library does not support formatting. The use of a 3rd-party device/application is necessary in such case.