element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
NFC/RFID
  • Challenges & Projects
  • Project14
  • NFC/RFID
  • More
  • Cancel
NFC/RFID
Blog NFC-based Office Visitor Sign-In System for the non-iNDEF’ed** – PART 1 (Introduction & Installation)
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join NFC/RFID to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: BigG
  • Date Created: 26 May 2019 4:46 PM Date Created
  • Views 23901 views
  • Likes 7 likes
  • Comments 3 comments
  • cypress psoc 4 ble pioneer kit
  • pn7150
  • nfc ndef
  • nfcrfidch
  • esp8266
Related
Recommended

NFC-based Office Visitor Sign-In System for the non-iNDEF’ed** – PART 1 (Introduction & Installation)

BigG
BigG
26 May 2019

**   Indeffed (slang): Used to describe a user, account, or IP address that is indefinitely blocked or banned from certain or all actions.

 

1.0     Introduction

image

 

We all know the drill. We arrive, smile at the receptionist and in a friendly voice explain that you’re So-n-So from Company X-Y-Z and have a meeting with Mr. or Ms. You-Know-Who. The receptionist then dutifully instructs you to fill in your details in the Visitor’s Book and then once your meeting is confirmed you would be issued with a Visitors pass etc.

 

Now, unfortunately, with the introduction of General Data Protection Regulation (GDPR) the opportunity to peruse through the list of names while filling in your details is no longer possible. What a killjoy!

 

So, what is the alternative to writing in your name and company details countless times in visitor books, which now have to be GDPR compliant?

 

Well, I’m not the first to look at this problem. You only have to search online for “Visitor Management Systems”, or other similar search terms, to find a range of self service kiosks and touch screen devices (or software for Android tablets or iPads) to essentially do the same thing, which is to provide a GDPR compliant system that allows you to manually enter in your name and company details countless times.

 

Enter the NFC-based Office Sign-In System for non-iNDEF’ed Visitors... a sort-of “fast-track” visitor sign-in process, for visitors that happen to have an NTAG Type 2 card with their VCard details stored on it or have a modern cellular smart-phone with NFC and BLE capabilities.

 

image

 

The new electronic Visitor's Sign-In interface is made up of three key modules:

 

  1. An NXP NFC PN7150 Controller - this provides three tasks:
    1. Reads NDEF messages from NFC Tags
    2. Writes NDEF text type messages to NFC enabled phones
    3. Writes Access Codes to MIFARE cards (for purpose of a pseudo access control system)
  2. A Cypress PSoc 4 BLE module - this provides one task:
    1. a secure means of connecting with an App on a smart-phone to transfer information
  3. An ESP8266 WiFi module - this provides one task:
    1. a wireless means of connecting to an Office LAN for the purposes of communicating with a back-end server

 

 

2.0     Exploiting NDEF Messages (RTD’s) with NXP’s PN7150 NFC Controller Library

 

First, let me briefly explain what I know about NFC NDEF (for sake of completeness).

 

image

Image Source attributed to: By Erik Hubers - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=37867764

 

As can be seen in the above diagram by Erik Hubers, the creation and handling of NDEF messages is all in the Application Layer and NDEF messages can only be stored on NFC tags or cards that are formatted to store these formats. Not all tags and cards have the same data storage capacity so it is up to the developer to check first to ensure that the tag or card is suitable. The total amount of vCard data, for example, can be quite large therefore requiring an NFC Tag Type 2 or better.

 

Using a description found on Wikipedia, NFC Data Exchange Format (NDEF) is a common data format that can store and transport items ranging from any MIME-typed object to ultra-short Signature-based Record Type Definition (RTD) documents, such as URLs, for example.

 

The NFC Forum added a Simple NDEF Exchange Protocol (SNEP) to the spec to allow sending and receiving messages between two NFC devices.

 

According to the NFC global forum, “The Simple NDEF Exchange Protocol (SNEP) allows an application on an NFC-enabled device to exchange NFC Data Exchange Format (NDEF) messages with another NFC Forum device when operating in NFC Forum peer-to-peer mode. The protocol makes use of the Logical Link Control Protocol (LLCP) connection-oriented transport mode to provide a reliable data exchange.”

 

An NFC Record Type Definition (RTD) essentially specifies the format and rules for building standard record type definitions based on the NDEF data format. The NFC-Forum has four specific NDEF Record Type Definitions RTDs, namely:

 

  • Text: used to store text strings in multiple languages. A derivative of the Text RTD would be the implementation of the vCard format.

 

  • URI: used to store Uniform Resource Identifiers (URI).

 

  • “Smart Poster”: combines URI and Test RTD’s put URLs, SMSs or phone numbers on an NFC tag.

 

  • Generic Control now deprecated and superseded by “Verb”: used to encode generic and carrier-specific supported services, such as Bluetooth or WLAN, which can then be used to implement a Connection Handover to seamlessly implement a specific task.

 

For those who want to know more, I suggest reading Adafruit's learning page on the NDEF format for further insight.

 

Now, let’s move onto the NXP PN7150 NFC Controller (otherwise referred to as PN7150).

 

2.1     PN7150 NFC Controller Library

 

For those who are unfamiliar with the PN7150, I recommend reading the recent road test reviews. As mentioned in my review, once you overcome the initial learning curve problems, the PN7150 works rather well and is very versatile – all thanks to the NXP library that is available for use with this module.

 

So how does the PN7150 library handle NDEF?

 

Let' start with the primary function called from main(), which is task_nfc():

image

Depending on the precompiler settings, this function will first register callback functions to handle NDEF message push, if P2P_SUPPORT is defined and NDEF message pull functionality. if P2P_SUPPORT or RW_SUPPORT is defined.

 

It then runs through a number of functions to initialise and then waits until a device is detected. Then when a Discovery Notification is received, this function will respond depending on what precompiler settings were defined.

 

For our application, only P2P_SUPPORT and RW_SUPPORT is required, so any card reader presented to the PN7150, which is associated with CARDEMU_SUPPORT, will get ignored.

 

So, for example, if a NFC enabled phone is presented to the PN7150 the function NxpNci_ProcessP2pMode() will be called first (to handle NCI protocol data packets) before moving onto the next function call task_nfc_reader() if RW_SUPPORT is enabled, while if a MIFARE card or a NFC Tag, for example, is presented then only the function task_nfc_reader() will be called as with cards only RW_SUPPORT applies.

 

As NDEF is related to read and write or pull and push functionality, it is worth looking at the callback functions in more detail.

 

image

As shown in the diagram above, the PN7150 library has placeholders for all the key NDEF message types within the Pull Options callback function and also provides us with the ability to set and send messages to P2P supported devices via the SetMessage function and the Push Option function.

 

This is exactly what I need for my Office Visitors Book application.

 

 

 

3.0     Showcasing my first NDEF use-case: WiFi Provisioning (getting connected)

 

In my opinion, getting a WiFi-based device connected to the Internet via WLAN, when installing the remote device, remains a “thorn in the side” for anyone developing IoT systems as there is no foolproof solution out there. You only have to browse on any IoT product forum or FAQ’s to see that “how to connect to wifi” is up there in the top-5 list of most common queries.

 

So, as a mini-project, I decided to use NFC NDEF as a way to connect my Visitors Book Control device onto my chosen Wi-Fi based Wireless Local Area Network (WLAN).

 

To achieve this goal, I used an NFC TAG (Type 2) to store my WiFi Network details. These details were written to the tag using NXP’s NFC TagWriter App, which is available for free download via Google Play app store.

 

The process, as illustrated here using NXP App screenshots, to choose the WiFi network details, enter the password and then save the dataset and write to an NFC tag is pretty straightforward:

 

image

 

Then all I do is present the NFC tag to the PN7150 controller and the WiFi details are collected and these are then transferred to my ESP8266 via UART.

 

Here’s a short video demonstrating how this is done. As you will notice in the demo video, I now have the library ported across and working on a Cypress PSoC 4 BLE module which is plugged into CY8CKIT-042-BLE-Pioneer baseboard.

 

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

 

4.0     Next steps

 

image

 

This project is a system based Proof of Concept, which focuses on firmware and logic rather than hardware design. If fact, as they are no buttons or screens, all that needs careful consideration going forward would be where to position the NFC antenna within an enclosure. For this project it does not really add value to push the three development modules inside a box and so I plan to leave as is.

 

The next phase of the project will be to capture the vCard information or as will be demonstrated show a derived hybrid BLE method using a smartphone, which in my opinion, is better suited for office visitors and pre-arranged meetings etc.

 

Then, once the visitor’s details have been checked, there is the final stage, which is to use the PN7150 to write to a MIFARE card (this is used merely for demo purposes) an access code for an office access control system (which is outside the scope of this project).

 

 

To read part 2 of the NOVSIS project, CLICK HERE.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 6 years ago +2
    Good start, I look forward to seeing how well your implementation performs. DAB
  • BigG
    BigG over 6 years ago in reply to DAB +1
    Thanks for the comment DAB. Indeed. I too am interested to see how it goes performance wise as I've gone as low as I can go with a PSoC 4 rather than the beefier PSoC 6. Hoping the motto "you learn more…
  • BigG
    BigG over 6 years ago in reply to DAB +1
    DAB, did you know this all along? There is this feature on Android phones called "Android Beam" that is causing me endless sporadic problems (the worst kind). It keeps getting in the way every now and…
  • BigG
    BigG over 6 years ago in reply to DAB

    DAB, did you know this all along?

     

    There is this feature on Android phones called "Android Beam" that is causing me endless sporadic problems (the worst kind). It keeps getting in the way every now and then causing things to lock up or, for example, by curious co-incidence my Fitbit would pair with my phone at about the same time as me tapping on the nfc device thereby blocking my own simple app... so much for P2P.

     

    Thankfully the Gods are smiling and anticipated my requirement for it to disappear image... earlier this month it was announced by Google that it is being deprecated.

     

    So, despite this setback and even though I have it working, this issue has caused me to discover that there may be another way to do this.... using tag type 4 (maybe for another day).

     

    Ah... that strange feeling of success combined with a nagging doubt that you did not quite understand things as well as you thought after all.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • BigG
    BigG over 6 years ago in reply to DAB

    Thanks for the comment DAB.

     

    Indeed. I too am interested to see how it goes performance wise as I've gone as low as I can go with a PSoC 4 rather than the beefier PSoC 6. Hoping the motto "you learn more through failure" doesn't come and bite me on this one...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 6 years ago

    Good start, I look forward to seeing how well your implementation performs.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube