I wanted to create an attendance capturing system using NFC tags. I was unable to find a decent document on the internet to resolve my issues. So I did researches my own and was able to achieve what I wanted. This document contains what I have done, and thought to share with you if you are struggling to get started with NFC readers.
I’ve used ACR122u as the NFC reader and Mifare Classic 1K cards as tags. I programmed with C# language with WPF interfaces and winscard.dll library which contains functions to expose Personal Computer/Smart Card (PC/SC) services for using smart cards and smart card readers.
In this article, I'm trying to show how the application would communicate with the reader and card in order to identify the card's UID. The card's chip contains a unique serial number for identification purposes, this is called UID. So we can identify tag from each other.
First of all, we have to create the following class on our solution to include all our NFC card related functions.
Card.csIn my application, when the application starts, the system will detect the connected NFC reader and will establish the context with the reader. See below code (establishContext();)
MainWindow.csNow let's imagine we have an interface like below;
When we press button 1, the system will connect to the card on the reader and start to get the card UID. Here is rest of the main window code:
That is all you have to do. Hope this helps you. Please comment your thoughts. If you have a problem, I'll try my best to help you.
From Next post, I'll guide you to write and read data to the NFC card.