This is a PN532 NFC library for Raspberry Pi.
- Support I2C, SPI and HSU of PN532
- Easy to understand how the PN532 chip works
- Plug the PN532 NFC Hat to your Pi.
- The module supports I2C, SPI and HSU.
- on I2C:
Set
I0: H
andI1: L
, which meansMOSI/SDA/TX Pin to Pi's SDA NSS/SCL/RX Pin to Pi's SCL
- on SPI:
Set
I0: L
andI1: H
, which meansMOSI/SDA/TX Pin to Pi's MOSI NSS/SCL/RX Pin to Pi's CE0
- on HSU(UART):
Set
I0: L
andI1: L
, which meansMOSI/SDA/TX Pin to Pi's RX NSS/SCL/RX Pin to Pi's TX
-
Modify the init lines and Run the example with
python3 example.py
.- for SPI, uncomment this line:
pn532 = PN532_SPI(debug=False, reset=20, cs=4)
, and comment lines for I2C and UART. - for I2C, uncomment this line:
pn532 = PN532_I2C(debug=False, reset=20, req=16)
, and comment lines for SPI and UART. - for UART, uncomment this line:
pn532 = PN532_UART(debug=False, reset=20)
, and comment lines for SPI, I2C.
- for SPI, uncomment this line:
-
With waving a 13.56MHz NFC card, the UID of the card will be printed.