PN532 NFC Library [PORTED]

Hi guys.
Grabbed the Spark.io to enable remote RFID logging / authentication.

The PN532 is by far the most popular and reliable 13.5Hz module out there.
I’d love to see it ported over:

The Arduino Library is here.

http://www.elechouse.com/elechouse/images/product/PN532%20NFC%20Module/PN532_NFC_elechouse.rar

Would this be possible?

1 Like

Subtle bump for this - I can’t be the only one wanting to use my NFC / RFID modules with my spark!

There is this thread with @Dragonsshout and @CentauriDK

that has a 125KHz RFID system. The recent improvements to the serial port handling made this work much better.

The PN532 is a very common 13,56mhz module, which is unfortunately very different from the 125Hz modules.

Is there a ‘formal’ way of requesting a module, or is it lucky dip?

Is there any way that I could contribute to speed up the process?

I bought the spark specifically for use with RFID…

Again, apologies for the bump - just trying to work out the path of least resistance to either get this module in, or how to get it in myself. Any pointers would be appreciated.

@BDub - It seems that you’re the resident rockstar with libraries - any ideas?

Thanks very much
Simon

+1 for this port :slight_smile:

Trying to get my hands on one and having it working with the core is a definite requirement :smiley:

I have it converted and compiling… just let me release it on Github :wink:

EDIT: Here we go, please test the examples and let me know if there are any problems :slight_smile: https://github.com/technobly/SparkCore-PN532_NFC

UPDATE: This library that Peekay123 and I worked on works better and supports I2C and SPI. This example is setup to work with I2C right out of the box and IMO works better than SPI:

I just wanted to pitch in and say we have begun working on the custom shields and one of them is for a NFC. We are trying out a new tool - Upverter to create this. Would love to get a feedback on it:

https://upverter.com/mbhoite/37040605ebc22910/NFC-Shield/

It’s in its early stages, and I think the most tricky part would be to get the antenna circuit tuned in correctly.

1 Like

You are a perfectionist @mohit :wink: Very cool tool. I think that’s toooo open for me. Lol I don’t want people seeing all of my crazy edits.

@BDub - you’re a champion - thanks very much for this. I’m currently out of the country, so seperated from my beloved sparkcore - when I am back, I will be testing it and let you know.

@mohit - Sounds like an interesting project - quick question though - what is the need for a shield when the PN532 interfaces on UART/SPI/I2C ? Just for the sake of cleanliness - or did I miss something?

In any case, excited to see NFC making it to the sparkcore, it’s really a killer combination for remote access projects.

1 Like

@simon
The NFC shield is being designed as per the request of the custom shield backer from Kickstarter. This one is going to have a similar footprint as the Core itself, allowing the creation of very portable applications. Apart from that, one can always use a combination of a Shield Shield and an Arduino compatible NFC shield.

1 Like

hi @mohit

I have the same NFC reader, and would like to test your code with my reader, my only problem is i don’t know how to connect the spark with the nfc reader. Can you please describe what should be connected with what in order to read the nfcs thru the spark core?

Thanks a bunch!

Kind regards,
Noten

@Noten which NFC reader do you have and where did you buy it from?

FYI ALL, Adafruit has a I2C NFC library as well: https://github.com/adafruit/Adafruit_NFCShield_I2C This is not the one I ported.

Adafruit’s quickstart guide:

@Noten if you have the adafruit shield, you probably want to hook things up via I2C.

// WIRE IT UP!
//
// PN532 NFC SHIELD   SPARK CORE
//--------------------------------------------------------------------
// SEL0 jumper = OPEN
// SEL1 jumper = OPEN
// VCC                - Vin (5V)
// A5 (SCL)           - D1 (needs 2.2k to 10k pull up resistor to Vin)
// A4 (SDA)           - D0 (needs 2.2k to 10k pull up resistor to Vin)
// Ground             - GND
//--------------------------------------------------------------------

Probably works easiest with the Spark Shield Shield.

hi @BDub!

I have this: http://www.elecfreaks.com/store/rfidnfc-breakout-board-p-519.html

Do you think i can get this work?

I tried to connect it thru I2C (without any pull up resistors, just simply wired the spark with this one), but as i saw not even the void loop() went okay. (I added serial.print(“test”) just to see whether something is happening, but nothing happened at all)

Not sure what went wrong, maybe the NFC wasn’t recognised and the code just stopped?

Do you think this one can work with the code?

Thanks,
Noten

You definitely need the pull up resistors. That’s most likely your problem. SCK and SCL are the same node FYI. I don’t see a reason why it won’t work.

okay, so you mean these, right?

Kinda, so that shield you have has a label “SCK” which you want to connect to SCL which is D1 on the Spark Core.
SDA on your shield is SDA on the Core, D0. GND to GND and 5V on your shield to VIN on the Core. You’ll need the pull up resistors as well. If you have 4.7k ohm resistors I would start there.

For reference, the board I was planning to connect (and have been using w/ the Arduino) is this:

http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2205

hi @simon

I just ordered the same (well, almost the same, coz the one you linked is not available anymore):
http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2242

It still takes a few weeks to arrive, but let us know how it goes. Can’t wait to test it :slight_smile:

Came across this while looking at element14.

It’s a NFC PN512 for raspberry pi but making it work for :spark: core shouldn’t be too difficult!

+1 for the price too :slight_smile:

http://sg.element14.com/nxp/explore-nfc/add-on-board-nfc-for-raspberry/dp/2366201?Ntt=2366201&ICID=ap-2366201-np2