If you’re an Elektor subscriber, you will have received with your January-February 2016 edition an “Electronic business card” containing an ST25TA02K NFC tag from STMicroelectronics.

In each tag is written a URL and a 7-byte ID number. To participate in the competition organised by Elektor and STMicroelectronics, you have to read the UID with an application on your Android smartphone… that’s if it is NFC compatible.

So what do you do if it’s not?

When he received his copy of Elektor magazine, our friend Patrick Gueulle thought about all those who are interested in the principles of NFC (Near Field Communication) and who would like to read their UID but are not owners of a fairly recent Android phone. And those who have an iPhone…we know that Apple has a very restrictive view of NFC…

If you are concerned with these restrictions, or just curious as to where to find such short cuts, Patrick Gueulle offers us a small program in ZCBasic language which can display the UID on a PC equipped with a non-contact PC/SC reader like the model ACR122 (which is becoming widely available).

And here is the source code:
Declare Command &HFF &HCA UID(S$)
CLS:Call WaitForCard:ResetCard(S$)
Print:Print "UID : ";
Call UID(P1P2=&H0000,Lc=0,S$)
For F=1 TO Len(S$)
IF LEN(C$)=1 then C$="0"+C$
Print C$;" ";
Next F
Call WaitForNoCard

Marvel at the astounding simplicity of application development with the BasicCard kit in comparison with “Steam-driven” Android* ! This short program shows how easy it is to read the UID of any compatible NFC Tag with the PC/SC reader referred to. It simply uses the command “GET UID” ( FF CA 00 00 00) as per the PC/SC specifications.

To compile this code into a stand-alone executable for Windows, you only need to use the BasicCard software kit, which is completely free. An excellent opportunity to discover it if you haven’t already done so!

A note for users of the Omnikey 5321 reader (which is also common): The line ComPort = 101 must be changed to ComPort = 102, because this is a bi-mode reader (for contact and contactless tags).

As he always thinks of everyone, Patrick Gueulle has prepared, for those who do not want to compile their own files, a Zip file (link below) containing the two variants of the executable (ComPort = 101 et 102) as well as the corresponding source codes. Thanks, Patrick!

* But don’t forget that the STMicroelectronics app does lots more than just read the UID!