How to setup your own NFC lab

NFC is a reality today. A lot of cities in the world want to add this technology to their daily life, using it for transport, payments, access systems and almost all we can think (in some countries, like Japan and Korea, NFC is used years ago). Even reading NFC tags can be used to perform certain actions in our mobile phones like put it in flight mode, synchronize data, etc.

 

 

NFC is based on the ISO/IEC 18092 standard, published at the end of 2003, and it's compatible with other standards like ISO/IEC 14443 A/B (RFID) and ISO/IEC 15693 (FeliCa - Sony). As probably you know, it's a short distance wireless technology (normally < 10cm), high frequency (13'56 MHz) and low speed (normally until 424 Kbps). Unlike RFID, NFC is capable to perform bidirectional communications, and the time to establish the communication is much lower than using Bluetooth.

The aim of this blog post is not explaining how NFC works but giving some advice to setup a lab and start playing with this technology. The first thing we need is a NFC reader/writer. After looking around the most used are the following:

 

 

The first three devices include a PN53x chip, use the PC/SC stack and USB as connection interface. There is another option, the fourth one, and it's buying a board with this chip model, made by Adafruit Industries in this case. This is a more flexible option because we can choose between different ways to connect to our computer and other details you can find out taking a look at its specification. It's important to take into account that our device must be compatible with the most active NFC software projects, like libnfc and nfcpy. We can also use a NFC capable mobile phone like Samsung Galaxy Nexus, of course, but I think if we want to develop our own tools maybe it's easier to work with a reader/writer connected to our computer.

I'm going to focus on the NFC board I've mentioned (PN532). When it's received at home it's not ready to work. Some pins must be soldered to be able to choose between the different communication interfaces (UART, SPI or I2C). If you use a FTDI cable other 5 pins must be also soldered to have something to connect in the board (the 5 left pins in the image below). There are some web sites very helpful to perform these steps and you can always ask questions in the Adafruit forum.

 

 

Now we have the hardware ready, it's time to install the proper software. The most mature project talking about developing NFC tools seems to be libnfc, created in early 2009. If you prefer using Python you can find pynfc and nfcpy, being the latter the most active and recommendable out of the two. We can find a lot of information about installing libnfc in the official web page, but also in other sites and forums. Focusing on Ubuntu the steps we can take to install it are the following (some package versions and names can be different depending on distributions, tested with Ubuntu 10.04):

 

$ sudo apt-get install libusb-dev libpcsclite-dev
$ sudo apt-get install libusb-0.1-4 libpcsclite1 libccid pcscd libftdi1
$ wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz
$ tar -xvzf libnfc-x.x.x.tar.gz
$ cd libnfc-x.x.x
$ ./configure --with-drivers=pn532_uart --enable-serial-autoprobe
$ make clean
$ make
$ make install

 

If it's all right, putting a RFID card or a NFC tag close to the reader and using the nfc-list command we should see something like this:

 

 

Our lab is almost ready. The only missing thing is that we need something to read with our toy. We could choose one of the different RFID cards we use daily at gyms, buses, work, etc., but I think it would be better using a real NFC payment card or similar. If we don't have any of this we can buy some NFC Forum tags to make some tests with our reader or our smartphone. In following blog posts I will show what we can do now we have the lab ready, stay tune! ;)

 

Can this board use to phone??

Can this board use to phone??

No, sorry, just NFC ;p

No, sorry, just NFC ;p

I want to program an NFC tag

I want to program an NFC tag on a computer to do many customized tasks, however, use the tasks in an app. Is this possible?

Mmm, could you explain a bit

Mmm, could you explain a bit more the question, please? You can perform tasks depending on the content of the NFC tag, is that the question?

Thanks!

can this board is compatible

can this board is compatible for data transfer from phone to this board.....

Hi! This board can be used

Hi! This board can be used for that purpose, probably through peer to peer communication, but you need some script/tool/application like libnfc. I have not tested it, so I would suggest to ask in the libnfc forums for more accurate information ;)

Is it possible with the

Is it possible with the ACR122U to open a webpage on the computer with an NFC tag in windows and is it hard to setup?

Hi! I think it depends on

Hi!

I think it depends on the code you have in your computer. The ACR122U is just a device to read and write NFC tags, so you can read any NFC tag with it but then you have to write the specific code to respond to that tag. In your case, opening a web browser and navigate to the URL included in the tag. You can use nfcpy to read the tag and then just any Python module to launch a new process, I think it shouldn't be difficult...

Good luck!

Hi, I want to build my own

Hi,

I want to build my own nfc reader with a chip, as i have already a device, which needed to be integrated to its pcb can you please tell me which chip can be useful for that

Hi! Sorry, but I am not an

Hi!

Sorry, but I am not an expert in the pcb field so I cannot give you any advice about it. However, take a look at this link because it can be useful for you.

Cheers!

I agree to the first

I agree to the first statement itself that NFC is a reality today. Setting up an NFC lab was a nightmare to me. But after reading this post, I feel confident enough to start the process. Thanks for the post. Please keep sharing.

I want to communicate nfc

I want to communicate nfc card with mobile.
But don't know which protocol use for communicate with mobile.???
And is libnfc able to send some KBs of data to phone.??

Hi! I guess you can use also

Hi!

I guess you can use also libnfc from your phone, but probably you want to take a look at the following links:

https://developer.android.com/guide/topics/connectivity/nfc/index.html
https://github.com/grundid/nfctools

Cheers!

Than can be applied across

Than can be applied across multiple platforms

can we interface pn532 chip

can we interface pn532 chip directly with the arduino board or do we need to take the pn532 breakout board and then interface it to the arduino?

Hi! Not sure if I got the

Hi!

Not sure if I got the question, but you need the NFC chip anyway. You can easily connect the PN532 board to Arduino and even buy it with that purpose in mind:

https://www.adafruit.com/products/789

I hope this helps!

Jose

Can RC522 be used ?

Can RC522 be used ?