** Update **
Someone has already started work on the library.  You can read about it here.  You can view the library on github (as of this writing) here.

So if you like me wanted to do a project using NFC peer-to-peer (P2P) between Android and Arduino (the P532 chip) there is no doubt that you have spent countless hours searching for libraries or examples which have already implemented this feature.  You may have even built test application for Android (I used this one) and a sketch for your Arduino (I started with this sketch).  I at least saw that the NFC was communicating between the devices so it’s a start.  It took me a few days of searching before I even got to this point.  Now I needed to figure out why I wasn’t actually sending the NDEF message from Android — the breakpoint at createNdefMessage is never reached.

So lets lay down some facts:

  • You are using the PN532 NFC chip.
  • You are attempting to send a message between your Android device and your Arduino
  • You want peer-to-peer between the devices.
  • The protocol is SNEP on top of LLCP.

As I said, I spent a long time looking for a c/c++ library which already implemented this protocol.  I haven’t looked too much into the source of libnfc at this point but I found a java library which implements the protocols for a specific card reader.  I really didn’t feel like digging through that code and I will use it as a last result.  This reader is using the PN532 chip so the code should be compatible.  I also found this forum post where the guy who wrote the java library details some of his work.  This should help in setting the appropriate messages for the NDEF packets.

Anyway, I wrote this post in order to save people some time searching for a similar solution.  I am going to keep going down this path of implementing the protocols in c++ to work on Arduino.  This is no small task and should take quite some time to even implement the basics.

2 thoughts on “NFC Between Android and Arduino

    • All of that is in my github. I am working on a full hardware list but I am waiting for my Spark Core to be delivered. It has 20k memory so I will be able to add much more robust error handling and maybe an LCD screen for status. I just changed jobs so I was pretty busy but I am starting to work on this project again.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>