NFC: Control LED Based on NDEF Message
by NFCRenCS in Circuits > Arduino
49 Views, 0 Favorites, 0 Comments
NFC: Control LED Based on NDEF Message

This project is about controlling the built-in LED on the PTX105R NFC shield, based on the NDEF text message read from a card. It's a great example of triggering some action upon reading an NFC tag.
Supplies
- Arduino IDE
- Arduino Uno R4 WiFi or Minima
- Renesas PTX105R NFC shield
- 2 NFC cards of Type 2, 3, 4 or 5 containing specific NDEF text records (detailed in next steps)
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 only one of the interfaces is installed at a time, and the shield's interface configuration and the installed library match.
Prepare NFC Cards
In order to control the LED (D1) on the shield, 2 cards with an NDEF text message need to be prepared:
- One card with the text "ON", which will trigger the LED to be turned on.
- One card with the text "OFF", which will trigger the LED to be turned off.
Follow this article to write the NDEF text records to the cards, using the PTX105R shield.
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 use 115200 baud rate.
- Upload the project to the board
Downloads
Control the LED


Approach the ON or OFF card to the antenna and the LED will be turned on or off accordingly. The NDEF text message will also be printed to the Serial Monitor upon reading a card.
Additional Infromation
This project might serve as a basis for much more sophisticated and practical applications. The shield's built-in LED can easily be substituted with anything, which can be controlled by the Arduino, opening a wide-range of possibilities.