Giter Club home page Giter Club logo

rfid-rc522's Introduction

Python RC522 library

rc522 consists of two Python classes for controlling an SPI RFID module "RC522" using Beaglebone Black.

MIFARE datasheet datasheet.

MIFARE Access Bits Calculator Access Bits Calculator.

Sectors? Blocks?

Classic 1K MIFARE tag has 16 sectors, each contains 4 blocks. Each block has 16 bytes. All this stuff is indexed - you must count from zero. The library uses "block addresses", which are positions of blocks - so block address 5 is second block of second sector, thus it's block 1 of sector 1 (indexes). Block addresses 0, 1, 2, 3 are from the first sector - sector 0. Block addresses 4, 5, 6, 7 are from the second sector - sector 1, and so on. You should not write to first block - S0B0, because it contains manufacturer data. Each sector has it's sector trailer, which is located at it's last block - block 3. This block contains keys and access bits for corresponding sector. For more info, look at page 10 of the datasheet.

Connecting

Connecting RC522 module to SPI is pretty easy. You can use Beaglebone Black Pinout for reference.

Board pin name Board pin Beaglebone Black pin name
SDA 1 P9_17, SPI0_CS0
SCK 2 P9_22, SPI0_SCLK
MOSI 3 P9_18, SPI0_D1
MISO 4 P9_21, SPI0_D0
IRQ 5 P9_15, GPIO_48
GND 6 P9_01, Ground
RST 7 P9_23, GPIO_49
3.3V 8 P9_03, VDD_3V3

pins

rfid-rc522's People

Contributors

milesbdyson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

dnssoftware

rfid-rc522's Issues

CreateCard

Press Enter to exit
Card Type [Master,Super,User]: q
First Name [Max 48 Char]: w
Last Name [Max 48 Char]:e
Employee ID [Max 16 Char]:q
Department Number [Max 16 Char]:q
Title [Max 16 Char]: q
Waiting for Tag...

Traceback (most recent call last):
File "CreateCard.py", line 128, in
util.rewrite(sector[2][0],cardtype)
File "/home/toka/RFID-RC522/examples/rc522/util.py", line 119, in rewrite
error = self.rfid.write(block_address, data)
File "/home/toka/RFID-RC522/examples/rc522/rfid.py", line 376, in write
crc = self.calculate_crc(buf_w)
File "/home/toka/RFID-RC522/examples/rc522/rfid.py", line 251, in calculate_crc
self.dev_write(0x09, data[i])
File "/home/toka/RFID-RC522/examples/rc522/rfid.py", line 107, in dev_write
self.spi_transfer([(address << 1) & 0x7E, value])
File "/home/toka/RFID-RC522/examples/rc522/rfid.py", line 101, in spi_transfer
r = self.spi.xfer2(data)
TypeError: Non-Int/Long value in arguments: 766e91e0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.