The Origins
When we decided to throw a party in LA (which became know as The Gathering) I wanted it to be more than just free t-shirts and beer. Laser Graffiti popped to mind and I was glad that Ben was willing to take the lead on that project. But I figured there should be more; something that people could take home with them. I had under one month to pull it together so custom PCBs would be a stretch. The idea for NFC tags sprouted up mainly because we don't see them in very many hacks. Why? After all, the tech is pretty cool. I discovered it's because there aren't any easily found hardware libraries that are NFC standard compliant. More on this in a bit. Here's an image of the 500 custom printed cards I ordered for The Gathering.
Library Failure
In my mind I figured I'd study the specification and datasheet for the PN532 card reader and write my own library. After an hour of trying to control the reader with my Bus Pirate I realized this was a good way to spend months on a project when all i had was a couple of weeks (sixteen days to be specific). I switched to getting a proof-of-concept put together using an Arduino and known code from the good folks at SeeedStudio by way of our friends at Adafruit. Had I know that ElecFreaks was using the code examples from these other two companies I would have order from them instead just to support their open source efforts. Oh well, next order!
The Library can read the hardware Unique ID from the NTAG203 hardware, but that's it. It can't read or write a data payload to the cards. It does support the Mifare cards, which I understand are a deprecated protocol and not standards compliant (which is why I opted to order NTAG203 instead).
This is a huge issue that the Hackaday community should address. I know that libnfc supports these tags. So porting the code to a manufacturer-agnostic microcontroller library should be fairly trivial given enough time! At some point I'll put out a call on Hackaday to do this, and offer up free cards and shirts to readers who want to work as a team toward open sourcing such a project.
Changing the Plan
To get around this I hacked my own project before I even built anything. As I mentioned previously, the cards have a UID which is a feature from their RFID origins. I coded a proof-of-concept that read the 7-byte UID and printed it to the terminal. Later, this was turned into a jumper-enabled mode that prints the UIDs as a C header file. When the 500 cards arrived it only took me about 10 minutes to scan all of them, save the output as a header file, and write it back to the Arduino as a lookup table to ensure that each card could be used just once for voting.
To save space in EEPROM I used a bit-packed array to track the tokens. When the card is read, the lookup table is searched...
Read more »
Need some help please!