Skip to main content

PN532 library for Raspberry Pi

Project description

NFC library for Raspberry Pi

This is a port of Seeed Studios's PN532 Arduino Library for using the PN532 chip with Raspberry Pi.

Raspberry Pi PN532

Features

  • Support all interfaces of PN532 (I2C, SPI, HSU )
  • Read/write Mifare Classic Card
  • Communicate with android 4.0+(Lists of devices supported)
  • Card emulation (NFC Type 4 tag)

To Do

  • Works with Don's NDEF Library
  • To support more than one INFO PDU of P2P communication
  • To read/write NFC Type 4 tag

Getting Started

  • PyPI

    1. Install with pip
      pip install pn532pi
      
    2. Follow examples
  • Direct Download

    1. Download zip file and extract the 4 folders(pn532pi, quick2wire, examples and test)
    2. Follow the examples of the two libraries.
  • Clone Git Repository

    1. Get pn532 library

        git clone --recursive https://github.com/gassajor000/pn532pi.git
      
    2. Follow the examples of the two libraries

Power

The Raspberry Pi does not provide enough current to drive the PN532 chip. If you try to run the PN532 off your Raspberry Pi it will reset randomly and may not respond to commands. Instead you will need another power source (3.3v) to power the PN532

I2C Interface

I2C is short for Inter-integrated Circuit. I2C interface needs only 4 wires to connect PN532 with Raspbeery Pi. I2C Connection

To use the I2C bus 1 to control PN532, refer to the code below.

from pn532pi import Pn532I2c, Pn532

i2c = Pn532I2c(1)
nfc = Pn532(i2c)

def setup():
    nfc.begin()
    # ...

Contribution

It's based on Adafruit_NFCShield_I2C. Seeed Studio rewrite the library to make it easy to support different interfaces and platforms. @Don writes the NDEF library to make it more easy to use. @JiapengLi adds HSU interface. @awieser adds card emulation function. @gassajor000 ported to python/Raspberry Pi

[Mega]: http://arduino.cc/en/Main/ arduinoBoardMega [DUE]: http://arduino.cc/en/Main/arduinoBoardDue [Leonardo]: http://arduino.cc/en/Main/arduinoBoardLeonardo [SoftwareSerial]: https://www.arduino.cc/en/Reference/softwareSerial

Images courtesy of pinout.xyz, components101.com, sparkfun.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pn532pi-1.3-py3-none-any.whl (60.8 kB view details)

Uploaded Python 3

File details

Details for the file pn532pi-1.3-py3-none-any.whl.

File metadata

  • Download URL: pn532pi-1.3-py3-none-any.whl
  • Upload date:
  • Size: 60.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.2

File hashes

Hashes for pn532pi-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 69cfa1168bdceeea42a20482f8c818cb1b664ec5acf17112c601333fee1595d3
MD5 156c3d3b14e674b910c3d8bdfc50afc2
BLAKE2b-256 626fef700fb96651d07fee6908697c65ff37019f16b4dc02f821605d3e000792

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page