Automate your home with your smartphone's NFC

Turn on your PC by placing your phone against a chip? Start your navigation app and your favorite playlist when you pick up your smartphone? Your thermostat that turns off when you put your phone on the bedside table? You notice it: the smartphone is central to the automated house that we make. All you need is an Android phone with an nfc chip and some nfc tags, which are available for a few euros.

NFC (near-field communication) is a wireless communication technology that, as the English name suggests, works at a short distance, usually a maximum of ten centimeters. Many of us use NFC on a daily basis without realizing it: the OV chip card contains an NFC chip. Contactless payment with a debit card is also done with NFC. You then hold your debit card against an NFC payment terminal in the store and do not have to enter your pin code if the amount is less than 25 euros.

Less well-known is that you can also get started with NFC at home. You then scan an nfc tag (a small chip with an antenna in the form of a sticker or key ring) with your smartphone to perform all kinds of tasks. In this basic course we show you the possibilities with an Android phone.

01 Scan NFC Tag

The first thing to do is enable NFC in your Android phone. You can find that option in the settings, usually in the category Wireless and networks: toggle the slider there NFC in. Android now shows the nfc icon at the top: a large N. Then you need an app to read the nfc tags (see also the box 'Where to buy nfc tags?') on your phone. We do this in this course with the NFC TagInfo app from NXP, co-inventor of the NFC protocol. Then, hold an NFC tag against the bottom of your phone for a few seconds while the app is open. If all goes well, you will see all kinds of technical information about the tag, such as the manufacturer and the chip type. A tip: scan your OV chip card!

02 InstaWifi

Before we start automating all kinds of things, we first show you some handy apps that do specific things with nfc. A first is InstaWifi. Although the app hasn't been updated for several years, it's still as simple as it is useful. You use it to write the login details of a WiFi network to an NFC tag, so that your friends or family simply have to scan it to connect to your WiFi network. So you no longer have to dictate a long password and they no longer have to type in all kinds of special characters. Your visitors must have the InstaWifi app installed.

Where to buy nfc tags?

You can purchase NFC tags in all kinds of places: Bol.com, local specialized web stores, but also on Chinese websites such as AliExpress and Banggood.com. Usually it is not worth looking for the lowest price on Chinese websites unless you need large amounts of nfc tags. After all, an NFC tag does not cost that much: for a few euros you can find them in all kinds of sizes. They come in the form of key rings, credit card format, stickers, transparent, in color and waterproof. They can also often be found in a pack with five to ten tags for a lower price.

03 Puzzle Alarm Clock

If you have trouble getting up, Puzzle Alarm Clock will help you get rid of that problem. For each alarm, you can specify a puzzle that you must solve before the alarm stops. But what if you are really not a morning person and when your alarm goes off you are not mentally able to solve a puzzle at all? The app also has a solution for those types of people: the obligation to scan in an NFC tag before the alarm stops. That possibility is only in the Pro version, which you buy for 4.59 euros. Select an alarm, press Tap to add a Puzzle and then choose NFC tag scanner. Press Tap to add a tag and hold the nfc tag that you need to scan to turn off the alarm against your phone. Give it a name (for example bathroom) and turn on the slide switch next to it (otherwise you can scan any nfc tag to turn off the alarm). After that put your nfc tag in your bathroom and from now on you have to get out of bed and go to the bathroom to scan the tag before your alarm stops. Then you are definitely awake!

04 Trigger - Task Launcher

If you want to automate more general things using nfc, you need a more general app. There are those that are specifically aimed at linking actions to NFC, such as NFC Tasks. But there are also many more general automation apps for Android that can respond to reading NFC tags as well. In this basic course we will use Trigger - Task Launcher, a handy automation app that supports nfc as a trigger in its free version. You can buy the Pro version with more triggers for 2.99 euros.

05 Your first task

When you start the Trigger app for the first time, the window will show My tasks that you have not defined any tasks yet. Press Try an example now, you will see a preview of a task, such as: turn off Wi-Fi and lower the screen brightness when the battery is low. In the window Suggested tasks find more examples. But now we're going to create our first task: press Create a task and select as trigger NFC. Then press Next one. In the next screen you can add restrictions to determine when the task is activated. Just think of a specific time interval (during office hours), specific days (weekdays), connected to a WiFi network, Bluetooth network, in airplane mode and whether or not your phone is charging. Choose your restrictions (and don't forget to turn on the slide switch next to them) and press Completed.

06 Action!

You can now also add extra triggers, such as WiFi or Bluetooth, by pressing the plus sign. Then press Next one to add actions. Here you now check the actions that you want to perform when your phone scans the nfc tag. Then press again Next one. You then configure the actions you have chosen (for example, for sound profile choose you Quiet) and then press Add to task. Then you can add additional actions by pressing the plus sign. Finally, name your task at the bottom of the screen and press Next one and on Completed. Now place an nfc tag under your phone so that Trigger can write the task to it. Now if you hold your phone against this nfc tag, Trigger will perform your just defined task.

NFC on an iPhone

Apple has equipped its devices from the iPhone 6 with an NFC chip, but until recently this was only used for the payment service Apple Pay. As of iOS 12, Apple has also opened up its NFC chip to developers of other apps. As a result, iPhone owners have the same options as Android enthusiasts. An interesting nfc app for iOS is Decode. NFC TagInfo from NXP also exists for iOS.

07 On and off

As we have now defined the task, Trigger will silence your mobile when you scan the nfc tag attached to the bedside table. But what if you get up in the morning and want to turn your sound back on? Do you have to create a second task in Trigger and hang a second nfc tag on your bedside table? No, luckily Trigger can also handle switching between two tasks with the same nfc tag. You can think of it as "on" and "off" states with a different task for each state. Create an action as in step 6, for example to set the sound profile to silent. Then press Next one and in the last step, before you press Completed press the plus sign at the top and then New task. Then add another action with the plus sign at the top (for example to set the sound profile to normal), enter a name for the task and press Completed. Then describe your nfc tag and from then on the sound on your mobile will be switched on and off alternately when you scan the nfc tag.

08 IFTTT Webhooks

So far, we've stayed on our phone with our nfc tag-triggered tasks, but we can go even further. After all, one of the actions that are possible in Trigger is Open a URL/URI (below Applications & Shortcuts). If you enter a url in it, Trigger will visit it when you scan the corresponding nfc tag. That opens up a lot of possibilities. If you use IFTTT, you can easily link the nfc tags via Trigger. You can with IFTTT Webhooks. Click on that Documentation, then you will see a URL. Copy that to your Android phone and paste the url there into the action of Trigger, replacing {event} by a custom event name.

09 Have IFTTT respond to your nfc tag

Now if you scan your nfc tag with your phone, Trigger calls the IFTTT webhook with your entered event, for example 'sleep' or 'get up'. But on the IFTTT side, nothing is happening with it yet. For that you first have to create an applet, which uses that webhook as a trigger (the If part of If This Then That). At the top left of the IFTTT web interface, click My Applets and then right New Applet. Click on the this and select webhooks. Click on it and then add Event Name enter the name of your event, such as to sleep, and click Create trigger. Then click that to determine what to do when you go to sleep. After configuring the action, click Create action and then on Finish. From now on you can make something happen via IFTTT as soon as you scan the nfc tag with your phone.

10 Domoticz

Just as IFTTT offers a special URL with Webhooks to respond to, many home automation systems offer access to sensors and virtual switches via a special URL. Check the documentation of your home automation system for the correct form of that URL. Finally, we show you how this works with the open source home automation system Domoticz. You can find what the url should look like in the documentation of the Domoticz API. For example, if you have defined a 'Sleep' scene in Domoticz that lowers your shutters, turns off all your lights and turns off your PC, then find the scene in your list of devices and note the value in the column idx. Then enter as url at the action of Trigger //USER:PASSWORD@DOMOTICZURL:DOMOTICZPORT/json.htm?type=command&param=switchscene&idx=ID&switchcmd=On in, with the ID of your scene instead of ID and of course also with the correct username, password, url and port number of your Domoticz installation. You can now do the same for a "Get Up" scene.

Pause at multiple actions

If you are going to perform multiple actions when scanning an nfc tag, you should pay attention. Suppose you want to activate a scene in Domoticz and then put your mobile phone on silent and switch on airplane mode. Then you need to take a break after calling the Domoticz url and before turning on airplane mode, otherwise Trigger may not get enough time to activate the scene. In Trigger you will find the action Pause in the category Applications & Shortcuts.

Recent Posts

$config[zx-auto] not found$config[zx-overlay] not found