You may have heard the term NFC (Near-Field Communications) used when describing iPhone features. NFC has been in each iPhone since iPhone 6. NFC is used for the setup of Apple devices by placing them near each other, as well as for Apple Pay. In this post, I’ll show you how you can do some useful and fun things with inexpensive NFC tags, your iPhone, and an app.
What Exactly Does NFC Do?
Apple’s Developer website has a great explanation of NFC:
Near Field Communication (NFC) enables devices within a few centimeters of each other to exchange information wirelessly. iOS apps running on supported devices can use NFC scanning to read data from electronic tags attached to real-world objects. For example, a user can scan a toy to connect it with a video game, a shopper can scan an in-store sign to access coupons, or a retail employee can scan products to track inventory.Apple Human Interface Guidelines, Near Field Communications
NFC Tags Require An App
NFC requires an app on the iPhone that displays a prompt telling a user to hold the iPhone near one or more NFC tags or devices. The prompt is a “scanning sheet”, and you’ve probably seen one before:
That’s similar to the prompt displayed when setting up an AirTag. The “Near-Field” communications is truly “near”, just 4 cm (1.5 inches) of range. That’s much less than the 10 m (33 feet) range or so provided by Bluetooth. That’s also why you need to come quite close to a payment terminal when using Apple Pay.
Fortunately, there are many third-party apps available for writing and reading NFC tags. You’ll need to write to an NFC tag to get it to do something when the iPhone reads it. We’ll get to the app in a minute. First, let’s look at NFC tags in more detail.
NFC tags are small flexible circuitry stickers containing an antenna and memory. The tags do not require power of any sort. The reading and writing device (in this case, an iPhone) initiate communications. The tags are very inexpensive, costing as little as $0.10 each in large quantities. For the purpose of this article, I bought 11 tags for about $0.73 each. Here’s an Amazon link to those tags.
The most common tags at this time are called NTAG215, although there are three other types available. These tags are all pre-formatted to store NDEF messages. NDEF stands for NFC Data Exchange Format, which is a basically a message consisting of a header and a payload. The header defines the length and type of the message, while the payload is the data to be transferred.
Tag Actions (Records)
When an iPhone running an NFC app is brought near an NFC tag, it recognizes the existence of the tag and reads the NDEF message on the tag. It then performs an action – what our app refers to as a record. What kind of actions are there? Here are just a few:
- Text – displaying text
- URL/URI – displaying and then opening a web address
- Wi-Fi network – log into a secure Wi-Fi network with SSID and password
- Social Network – send others to your social media accounts when the tag is read
- Email Message – send an email message to someone with a tap
- Shortcut – run an iOS Shortcut
- Contact – get contact info (name, company, address, phone, email, and website) with a tap
- Location – Get location info from a tag
There are more actions, which really opens up the power of these little tags!
As I mentioned there are a number of NFC read/write apps in the App Store. The one I finally selected after playing with a few was NFC Tools. The screenshots and instructions are from this app; if you use a different app, the instructions will be similar.
Example: Go to The Rocket Yard
As a first example, let’s create an NFC tag that takes a user to The Rocket Yard when it is scanned. Now, it’s probably a lot easier to use a QR code to do this type of action, but this is just an example.
We want to write a URL/URI action to the tag so that when it is read, a dialog appears telling the iPhone user that the tag opens a page in Safari. Here’s how we do that using NFC Tools.
- Launch the app:
The app is pretty straightforward. You can read an NFC tag, write one, do other things (erase, lock, format, set passwords, etc…), and save tags for writing to multiple physical NFC tags. We want to write to a tag, so we tap Write.
- Under Write, we have the choice of adding a record, some options (including pulling info from another NFC tag or QR code), and actually writing the contents of the tag:
- Tap Add a Record. A list of NFC actions appears, and it’s useful to scroll through the list to see what’s available. Here, we want to “Add a URL Record” (button highlighted in red below):
- We’ll type in the URL (web address) for The Rocket Yard, which is https://eshop.macsales.com/blog/. Once completed, tap the OK button:
- Now that we’ve defined the URL we want to write to the NFC tag, we need to write that data to the tag. From the Write screen, tap Write (the button actually shows Write / 29 bytes, which is the size of the data we’re writing to the tag). The following dialog appears:
- The NFC Tools app provides haptic and visual feedback of a successful write. If the write is not successful, you’ll also get feedback. Just try again, and keep the iPhone near the tag for a few seconds after receiving the positive feedback.
Reading the Tag
You don’t need to have the NFC Tools app open to read the tag! Just bring the top of the iPhone near the tag. The iPhone vibrates (haptic feedback) and the following dialog appears:
You’ll need to tap that dialog in order to open the website. If there’s one thing I would like to see added, it would be the ability to have the action run immediately upon reading the tag without the intervening tap.
How A Website NFC Tag Could Be Used
This is a pretty simple example, but you can see where it could be useful in getting people to tap their iPhone (or Android phone) on a tag to be sent to an explanatory web page.
Imagine going to an outdoor sculpture garden, tapping an NFC tag on a sign, and being able to read more about the sculpture you’re viewing and the artist. There are a ton of uses! See the last section of this post for more ideas.
Example: Tag Items to Read an Owner’s Manual
When I started playing with NFC tags, it occurred to me that they could be very useful for viewing owner’s manuals for the various items in my RV. I have PDF versions of the owner’s manuals for things like the furnace, microwave oven, power distribution center, the trailer hitch, you name it. All of those PDFs are stored in iCloud Drive. My idea was to put an NFC tag in an inconspicuous place on each item so that if I needed to read up on use or maintenance, I could just tap the tag and immediately have the PDF visible without any searching.
How do we do this? One of the actions runs an iOS Shortcut. To do this involves a rather obtuse URL scheme and a “Scripting” action in Shortcuts.
The URL scheme uses the following format:
shareddocuments:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/PATH TO DOCUMENT
For example, let’s say I have a folder in my iCloud Drive named RV in which I’ve stored a document named “Dometic Tank Level Indicator”. That’s a PDF file with all the gory details about how the black tank (sewage) level indicator in the RV bathroom works. The URL we’d need the shortcut to open is:
Those “%20” strings add spaces to the URL.
Adding the Shortcut
Launching the iOS Shortcuts app, I add a new shortcut and name it “Open Tank Level Indicator Manual”. I don’t need to show it on my Share Sheet or add it to my Home Screen. Next, I tap Add Action, then tap on Scripting. Scrolling down through the vast list of scripting actions, I finally find one that is called “Open X-Callback URL” and tap it.
Next, I tap the X-Callback URL and either type or paste in the URL. At this point I can tap Done to save the Shortcut:
To test the shortcut, I can just tap the “play” ( ▶︎ ) button and sure enough, the PDF opens.
Writing the Shortcut to the NFC Tag
We’re almost there! Now we just need to write this shortcut to the NFC tag. Launching NFC Tools, I tap on Write, then Add a Record (see earlier steps for details). Scrolling all the way down to the bottom of the list of actions, we see “Shortcut”. Tapping that shows the following dialog:
As in the earlier instructions, tap OK to save the record. Next, tap Write (75 bytes), then bring the iPhone close to the NFC tag:
Once the tag has been successfully written, close NFC Tools, then bring the iPhone near the tag to read it:
Tap that dialog, and immediately the PDF file opens! Note that this even works when you don’t have an internet connection provided that you’ve downloaded the documents to your iPhone by tapping them at least once when you do have a connection.
What Else Can You Do With NFC Tags?
These are just two example that I’ve shown here, but there is a lot you can do on your own with NFC tags. Some ideas:
- Marking collectibles with a tag on the bottom or back that brings up descriptive information about the item (shortcut or URL record)
- Placing a tag on those AC adapters that tells you what they’re used for (text record)
- Set up a tag that guest to your home can tap to be added to your Wi-Fi network (Wi-Fi network record)
- Use a tag to connect an elderly or disabled relative to you on FaceTime with a tap (FaceTime record)
- Let customers download your app from the App Store by tapping a tag (Application record)
- Creating a game where those playing have to tap a tag to get a clue to the next tag… (text record)
All it takes is a handful of NFC tags, an NFC app, an iPhone, and your imagination. Have fun experimenting with NFC!
Leave a Reply