During the last years, I have been working on many different projects relating mag-stripe information and NFC technologies. During this period of time, I went through different struggles running or researching into the NFC code. Some of the main limitations are the ISO14443A emulation configurations in the most libraries that support NFC.

The only library(public that I know) that supports PN532 emulation is the RFIDIot library implementing PCSC which I used initially to learn more about this technology. The price of a device with PCSC support like the Acr122 is around 45 dollars. I thought, “what about a device cheaper than Acr122 such as Arduino with PN532 support and without dependencies?” Arduino was the key because I was able to get these boards from eBay in around 5 dollars.


Moreover, the RFIDIot library was designed in Python. So I was not able to integrated it right away to the Arduino boards (but now with MicroPython could be possible). After I learned how to initialized the PN532 as target in Python, I was able to mimic the same behavior in Arduino devices. Which means that implementation could be use in different technologies such as ESP32, LoRa or any boards with Arduino support.

Then I bought some PN532 boards from Adafruit. Of course, you can find cheaper versions of these boards at AliExpress for testing; try to avoid the small boards because they have low induction. I have to mention that the Adafruit quality environment with its hardware, tutorials and community are very impressive.


So I decided to add these changes to the Adafruit library to support the ISO14443A emulation functionality. Using an open poll as concerned consensus:

I added a script in the examples folder to test it. The main changes are three new functions AsTarget(), getDataTarget(uint8_t* cmd, uint8_t *cmdlen) and setDataTarget(uint8_t* cmd, uint8_t cmdlen):

This is an example of how to use the new functionalities. First, we run the nfc AsTarget then we request the data; after that, we can set data to keep the communication flow.

Screen Shot 2019-02-04 at 3.35.40 PM

Screen Shot 2019-02-04 at 3.34.31 PM

With AsTarget(), we initialized the PN532 as target(emulation mode) to behave as smart card. With the getDataTarget(), we will be able to obtain the communication from the PoS or terminal in a short period of time. The setDataTarget() is to communicate commands to the PoS or terminal depending of the data of getDataTarget().

Enjoy it!