PN532 NFC Library [PORTED]


#1

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?


Library include error in Web IDE
#2

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


#3

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.


#4

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…


#5

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


#6

+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:


#7

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:


#8

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.


#9

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.


#10

@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.


#11

@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.


#12

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


#13

@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.


#14

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


#15

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.


#16

okay, so you mean these, right?


#17

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.


#18

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


#19

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:


#20

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