The other day I found on my desk what looked like a credit card from one of those semi-cafeteria style restaurants. At this restaurant you present the card at each station when you order something and then present the card to the cashier when you leave. I turned the card over expecting to find a mag stripe or bar code on the back, but there was not one. I wondered if this was an RFID card. Instead of tossing the card in the trash, I became intrigued by the idea of reading the card. After some emails on the HacDC email list and some google searches for RFID readers, I decided to order the "PN532 NFC/RFID controller breakout board - v1.3" from AdaFruit.
I should have done some actual research, like reading through the specs for the chip on the breakout board. I thought I could plug this into a serial port, wave a card over it, and out would pop some info. I found products that did that when I was doing my searches, but this is not one of them. I knew I would have to solder on some connectors, but I did not realize I would have to write, or, at least, compile some code.
The thing is, the chip on this board can not only read RFID tags, but it can read and write NFC cards. So if I can get over the initial hurdle of communicating with the chip, I will be able to explore both RFID and NFC tags or cards.
There are three separate things to answer or solve. First, how to connect to it? The chip (and breakout board) supports I2C, SPI, and UART (at TTL levels). Second, what should I connect to it? My options are an iPad or iPhone (with the RedPark serial cable), a Windows laptop, Mac desktop, or a Microchip PIC. The third question is what code to write or run? AdaFruit provides Arduino code to communicate with the PN532, but I do not have an Arduino. There is also libnfc (link). I tried to compile this on my Mac, but I do not a compiler set-up at the command prompt (I think is something to do with my latest XCode installation).
I am most familiar with UART, and this works on all of the hardware I am considering, so I decided to go with that for now. For the connectors, I added a 5-pin header to the UART holes, and I soldered on the jumper headers, so I could select between the communication options (UART, SPI, I2C).
This leaves the following possibilities...
- libnfc on the Mac. I had given this a quick try and found that I did not have a compiler set-up. At the moment, I am more interested in very basic connectivity, so I might get back to this later.
- new code on an iPad. The RedPark serial cable I have supports a UART rate of 57.6Kb/s. From what I can tell, the default for the PN532 is 115.2Kb/s. I am going to pass on this at the moment, since it looks like this might not work at all (unless I can lower the rate of the PN532 and keep that as the default).
- new code on a PIC. The upper limit of the PIC UART speed, when not using a crystal on the PIC, might be too low. I would have to understand that first. Then, if I did have connectivity, I would not have a simple way to show the results.
- new code on a Mac. This is what I am going to try first. I have worked with serial ports on the Mac OS X before, where the serial port was a BlueTooth device, so I have some code to start with.
Hopefully I will get something working eventually. I will post an update when I do.