NFC: Control LED Based on NDEF Message
by istvanren in Circuits > Arduino
25 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 there's only one of the interfaces is installed at a time.
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 send a New Line and 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.