Closed th0mas closed 4 years ago
Adafruit seems to suggest that with the Raspberry Pi SPI is the way to go:
I (think) I've managed to connect the Raspberry Pi to the board using a wiki found here: http://wiki.sunfounder.cc/index.php?title=PN532_NFC_Module_for_Raspberry_Pi.
It has a simple table which tells you what pins on the pi to connect to the pins on the NFC board.
Finding a maintained elixir library is proving to be difficult.
https://github.com/arjan/nerves_io_nfc no longer compiles and https://github.com/jmerriweather/nerves_io_pn532 seems to be lacking documentation
@nelsonic How do you think we should get round this? I'm not feeling like rolling my own PN532 interface library - but it is always an option. I'll look at writing a NIF wrapper around libnfc
but I feel this will also come with some heavy drawbacks.
I've also looked at some Rust libraries to use with Rustler
but these seem to suffer the same drawbacks as the Native Elixir libraries
I've looked through https://github.com/jmerriweather/nerves_io_pn532 and I think its our best option.
I'll try and write documentation and fix any bugs as I go.
This library also uses UART, but I think we'll just have to use it a low bandwidth (which should be fine) and hope.
Plan B is to implement Adafruit's library in Elixir https://github.com/adafruit/Adafruit_Python_PN532 which will take a while, so I want to avoid this.
Got card recognition working over UART - sort of
PN532 seems to send an ACK
request every few ms to the Raspberry Pi. When logging over SSH this can slow the board down to a crawl - Erlang I/O is single threaded.
Can't get it to recognise the fob-type NFC tags, or NFC cards reliably. Currently using the Pi's 5V header so power shouldn't be a problem.
We can only read MiFare type cards, I don't think this should be a problem, this appears to be the de-facto standard.
I've had to fork the PN532 I/O library as it didn't compile due to outdated dependencies.
Need to work out:
ACK
frequency without comprising read frequency?Pi 0s seem to communicate over a different UART interface - ttyAMA0
so we need to account for this when deploying to Pi Zeros
Wrote most of this down in 20fbe8d, closing this issue
Nice one @th0mas 🙌 thanks!
We have several options to connect our PN532 development board to the Raspberry Pi:
We need to work out which one of these communication protocols to use and if there's any (meaningful) difference between them for our use case. The manufacturer seems to suggest SPI, but I can't find a concrete recommendation from them.
We also need to find an Elixir library that can communicate with the NFC chip and see how this would work.