RFID shield PN532 writing more than 1 line

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ashleyjamesbrown
 
Posts: 48
Joined: Thu Oct 10, 2013 12:37 pm

RFID shield PN532 writing more than 1 line

Post by ashleyjamesbrown »

Hi sorry for the newbie post - lurked for a long time and also on the arduino forum too.

Building 5 Arduino Uno with 5 RFID shields and have all soldered correctly and working with the standard code that writes a URL to a mifare classic 1k sticker as well as the included card.

This tag is readable by the shield in terms of the data but first question is how can i read and extract the data as the URL

My second question is how to write more data - such as a contact tag.

I have a HTC One X with Tagstand Writer and i can write contact cards but due to the format i cant use the PN532 to read.
However usign the PN532 to write a URL and then using my HTC Android device i scan the tag and it auto loads the website so this is great. What i need is how to write a further three lines to the tag using the PN532 so that my Arduino and Processing code can read this information as well as my phone being able to (although this is a bonus)

Its for a creative conference im part of next week and each of the 200 delegates is having a mifare 1k stuck to their lanyards with their name, phone, email on it so that they can use it to swap data with each other via phones but also when they network and meet at one of my 5 stations i can data vis the 2 tags by reading the names from them.

Any help much appreciated - i first thought about the block code nfc.mifareclassic_WriteNDEFURI and use (2,data, phone) and then (3, data2, email)

Thanks muchly

Ashley James Brown

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: RFID shield PN532 writing more than 1 line

Post by ktownsend »

There isn't really much NDEF support in the library right now (it's a LOT of work to implement a proper NDEF stack including read/write support for specific tag technologies, etc.!).

The very basic NDEF example is provided as a proof of concept and it was intended just to show how you can write to a tag and read that tag's URI on a SmartPhone.

You may want to have a look at this project which attempts to implement NDEF on Arduino, though I don't know exactly where they're at in terms of development yet: https://github.com/don/Ndef

User avatar
ashleyjamesbrown
 
Posts: 48
Joined: Thu Oct 10, 2013 12:37 pm

Re: RFID shield PN532 writing more than 1 line

Post by ashleyjamesbrown »

Oh right OK - so you cant actually read the data from a tag using the shield ?? Literally you can just read the ID block ?

This is a shame and also a problem for me.

The other lib you mention doesnt work.

The write tag with url does work writing it - but then you cant actually read it back using the shield to get the url back although it works on the phone. TBH if i had this i could get what i want working.

User avatar
doncoleman
 
Posts: 30
Joined: Sat Feb 09, 2013 12:54 am

Re: RFID shield PN532 writing more than 1 line

Post by doncoleman »

Kevin, thanks for the recommending my NDEF library https://github.com/don/NDEF

The library is pretty stable for reading and writing NDEF to Mifare Classic tags. It's still missing some features like NDEF format.

Installation of the PN532 library to support I2C and SPI is a bit tricky. I'm working with @ashleyjamesbrown to get that sorted out.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: RFID shield PN532 writing more than 1 line

Post by ktownsend »

ashleyjamesbrown wrote:Oh right OK - so you cant actually read the data from a tag using the shield ?? Literally you can just read the ID block ?

This is a shame and also a problem for me.

The other lib you mention doesnt work.

The write tag with url does work writing it - but then you cant actually read it back using the shield to get the url back although it works on the phone. TBH if i had this i could get what i want working.
You can read the raw data from the tag, there just isn't an additional layer to interpret it in NDEF format, which is weeks of development effort to implement. The library provides all of the necessary low level plumbing to treat the Mifare cards as EEPROM, which is what they are intended for. NDEF is just a 'data format' that sits on top of this memory and uses these low level functions. It's like a storage device, where we provide the low level access, but if you want to read/write JPEGs images you still need to implement a layer that understands JPEG and reads/writes appropriately to the storage medium using the low level read/write functions that are provided.

NDEF isn't trivial to implement because there are a lot of edge cases to take into account, and it differs on every card type, etc.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: RFID shield PN532 writing more than 1 line

Post by ktownsend »

doncoleman wrote:Kevin, thanks for the recommending my NDEF library https://github.com/don/NDEF
No problem Don. It's a good library, and I know first hand that it's a lot of work to handle this stuff elegantly, but you have a nice, clean structure to start with. I had to implement this stuff on ARM in pure C and C++ is definitely a better match.

User avatar
ashleyjamesbrown
 
Posts: 48
Joined: Thu Oct 10, 2013 12:37 pm

Re: RFID shield PN532 writing more than 1 line

Post by ashleyjamesbrown »

Sorry hope i didnt appear rude - i can see now how hard it is to implement. I just assumed that the shield and lib would automatically have a method to extract the data - apologies.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”