GithubHelp home page GithubHelp logo

mfrc522-python's People

Contributors

cotix avatar gplaza avatar marek2k17 avatar mj3052 avatar mxgxw avatar omerlh avatar wybczu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mfrc522-python's Issues

Can't open device

Hi

I run "Read.py", I got below error:
Can't open device: No such file or directory

"SPI-Py" is intalled but when I run this: ls /dev/spi*
and it returned this:
No such file or directory

what should I do?

thanks

Read card from two RC522 readers

Hi

Thanks for great software.

How to modify MFRC522.py and Read.py file to read from two readres ?
I'm connect first to /dev/spidev0.0 (24 pin) and second /dev/spidev0.1 (25 pin).
I'm can read from first and second reader when change /dev/spidev0.0 ti /dev/spidev0.1 in MFRC522.py.

Regards
Lukasz

Gain

Hello,
just somehow got to your cool module so i thought i ask you.
I bought some really cheap MFRC-522 reader/writers for my raspberry pi RFID project.
Now i started testing the things, but was really disappointed by the distance of reading the passive tags (<1 cm)
What i want to do is to achieve reading tags with a raspberry in a distance, lets say 0.5-1 meter and through clothes
Do I need to get an antenna a differenet reader? Any good suggestion. How far does your reader read and trhorugh clothes too??
Thanks a lot

Port to JavaScript available ...

I needed to be able to read MFRC522 reader on a Pi from JavaScript (Node.js). What I did was port the code from Python to JavaScript. I'd like to offer this up to you as a new repository. If you are not interested in taking the code, let me know and I'll create my own ... the reason I want to offer it up to you is that I don't know how the MFRC522 works ... and merely ported code ... the JavaScript code works fine but I feel that the ownership of such an offering is best held by someone who owns MFRC522 knowledge at the core.

[email protected]
mfrc522.js.txt

Authentication Error with NTAG216

Was able to setup the RC522 and get it running with the card and tag that came shipped with it. I tried reading my other NFC sticker tags (NTAG216), and I keep getting authentication errors:

AUTH ERROR!!
AUTH ERROR(status2reg & 0x08) != 0
Authentication error

Anyone have an idea on how to fix this?

closing API for SPI file descriptor

This code is missing cleaning up for the open file descriptor. Just like we open spi.openSPI() we must also clean up by calling spi.closeSPI(). This is required when dealing various SPI slaves and when you need to open and close to those slaves often. This can cause too many open file descriptors.

Why SPI-Py over py-spidev?

Out of curiosity, and because SPI-Py was previously unknown to me, I'd love to know what motivated you to chose it over py-spidev.

Cheers!

Writing and tag size

Hey,

I just downloaded this code, and I'm using it now! I just got this MFRC522 card, and I got no clue how to operate it, so could you explain or link me to some kind of documentation of how I could implement writing? And what about the tag size? Not all tags have 5 bytes, or do they?

Thanks man, you're great!

CRC error

how to clear a crc error when it happens ?

a soft/hard reset does not solve the problem.

need to clear the crc error without powering up the circuit again.

appreciate all the help.

thanks

How to detect when a card has been removed from the reader

Hi

If a card is put against the reader, the Read.py script will continue to read the same card over and over, and process the output (in this case printing the UID) again and again.

I am looking for a way of only printing the UID out once, and then upon subsequent iterations, if the code detects it is the same card sitting on the reader, then it should not print out the UID.

Any assistance would be greatly appreciated.

i cant read rfid

i am using pi3 and mfrc522 , but pi3 gpio has changed, can you update your doucument , wo dont konw how to line pi3 and mfrc522. thank you very much

Request Info

PICC_REQIDL = 0x26
PICC_REQALL = 0x52
PICC_ANTICOLL = 0x93
PICC_SElECTTAG = 0x93
PICC_AUTHENT1A = 0x60
PICC_AUTHENT1B = 0x61
PICC_READ = 0x30
PICC_WRITE = 0xA0
PICC_DECREMENT = 0xC0
PICC_INCREMENT = 0xC1
PICC_RESTORE = 0xC2
PICC_TRANSFER = 0xB0
PICC_HALT = 0x50

Where did you find all these? Could you please tell me?
I am trying to understand the code you wrote.

AUTH ERROR

The following error is printed when running this Python code:


Card detected
Card read UID: 13,136,60,202,115
Size: 8
AUTH ERROR!!
AUTH ERROR(status2reg & 0x08) != 0

AUTH ERROR

Half Tag

How to half tag ?
If i tapping card, i want to read just once.

No activity

I'm a NOOB at NFC and Python, so please forgive my ignorance.

I installed SPI-Py and MFRC522-Python per the instructions. When I run "SUDO PYTHON Read.py" the next line displays no text, even when waving a card in front of the reader. The line remains blank until I use ctrl+c. In viewing the Read.py file, it appears that SOMETHING should be on the screen.

I'm not quite sure where to begin looking to find out where I'm going wrong.

Thoughts, anyone?

Warning about the Access Control Bits

I don't know how maintained this is anymore, but I think a warning note about the Access Control Bits in the sector trailer should be added somehow (either in the code or the readme here on github).

There is a rundown of how they work here, but basically the last block of a sector contains the authentication keys and bit pattern used to set access rights. Overwriting this with random data will most likely destroy that sector forever as there is no way to write back a new pattern if you don't have proper access. I also suspect this is the reason for some of the people are reporting unexpected authentication errors on the issue tracker, as trying to read a garbled sector will trip the auth check.

It could also be smart to mention that the very first block contains manufacturer info and is read-only, basically staying out of the first sector all together is probably smart unless you really need the space.

tl;dr: Do not use MFRC522_Write with location 3, 7, 11, 15, 19, 23, ..., etc. unless you know EXACTLY what you are doing. They are used for important stuff, and overwriting them makes the whole sector UNREADABLE FOREVER!

Also note: There also seems to be a mismatch in the code output about what a block/sector is, each block is 16 byte, each sector is 4 blocks (with the last block being reserved for the access control). The read/write commands of this library operates on block level, but the read prints it as sector, which can be confusing.

MFRC522 not read

i use RPi jessie and MFRC522, setup install python-dev , SPI-Py, MFRC522-python
i use RFID tag it show me
screen shot 2558-12-01 at 02 15 16

what i miss

thank you

some problem about the nSPI function

Hi~
Thanks for this useful module.
I can run the read.py file successfully

pi@raspberrypi ~/Documents/rfid_demo $ sudo python read.py 
Welcome to the MFRC522 data read example
Press Ctrl-C to stop.

but when I move the file to another directory
error occured
the command line output is:

pi@raspberrypi  ~/Document/mahjong/test_code $ sudo python read.py 
Traceback (most recent call last):
  File "read.py", line 21, in <module>
    MIFAREReader = MFRC522.MFRC522()
  File "/home/pi/Documents/mahjong/test_code/MFRC522.py", line 111, in __init__
    nSPI(device=dev,speed=spd)
NameError: global name 'nSPI' is not defined

so I wonder what is the function nSPI()?
the code is absolutely the same.
I am new to python.
Thank you for your help!

Problems by Starting the program

Hello,
i have a small problem with my MFRC522.
All the pins are connected correctly. but now, when i want to start the programm the pi shows me
python Read.py Traceback (most recent call last): File "Read.py", line 41, in <module> MIFAREReader = MFRC522.MFRC522() File "/home/pi/Desktop/MFRC522-python/MFRC522.py", line 133, in __init__ GPIO.setup(NRSTPD, GPIO.OUT) NameError: global name 'NRSTPD' is not defined

I hope that you can help me.
Thanks a lot for your help!

Is it possible to run this without sudo???

If I run python Read.py without sudo, it gives me an error:

can't open device: Permission denied
Aborted

I can't rely on sudo privileges while reading RFID tags, what should I do?

How to Change rst pin ?

Hey, I wanted to add a RFID reader in an Existing project , but GPIO - 25 is already in use . So how can i change the reset pin in the code ?

High CPU

When working with a library MFRC522-python I watched high CPU. About ~ 50%. Please support this issue. Thank you.

Supporting Android Beam

I am trying to send an NDEF Message from my Android Phoneto my Raspberry Pi via the rfid-rc522 reader.

When using this library I constantly get an authentication error. Is it possible to read NDEF Messages from Android with this library?

Code not working with Raspberry pi model B+

I would like to note that this code did not worked with the model B+
when executing (sudo python Read.py) I just got the following message:

Welcome to the MFRC522 data read example
Press Ctrl-C to stop.

when I touch the tag nothing happens.
Is there any diagnostic steps that I can follow to discover where is the bug?

Read.py Error

I've followed this tutorial (https://www.piddlerintheroot.com/rfid-rc522-raspberry-pi/) to the T, and I keep getting the error " Traceback (most recent call last):
File "Read.py", line 41, in
MIFAREReader = MFRC522.MFRC522()
File "/home/pi/MFRC522-python/MFRC522.py", line 131, in init
spi.openSPI(device=dev,speed=spd)
AttributeError: 'module' object has no attribute 'openSPI' "
whenever I try to run the Read.py file.
Any help?

"Sector" instead of "Block"

Dump.py map all data stored in MIFARE Classic 1k card or tag. When Dump.py is executed, prints "Sector" at the beginning of each line of data. I think this is wrong. Each line represents a “Block”.

"2.2 Logical Structure
A MiFare Classic card is in principle a memory card with few extra functionalities. The memory is divided into data blocks of 16 bytes. Those data blocks are grouped into sectors. The MiFare Classic 1k card has 16 sectors of 4 data blocks each..."

Sources:
http://www.cs.ru.nl/~flaviog/publications/Attack.MIFARE.pdf (p. 4, section 2.2.)
https://upload.wikimedia.org/wikipedia/commons/3/39/MiFare_Byte_Layout.png

Hex code

Hello

Is it possible to reader the raw hex code with this lib?

ie - 1a44cb1b which can then convert into a 10 digit code 0440716571

currently using the examples I can only see a 12 digit code 272056826136

remove

Please, remove this... Not an issue.

antennaOn ifstatement

Im not sure if this is a issue or not, but i have had a look at the antennaOn function witch on line 157 contains this if(~(temp & 0x03)):
As far as my testing goes I am not able to make this statement return true. This is because of the ~ bitwize complement never return 0.
Would any of you be able to shed some light on what this if statement does? or is suppose to do?
I can see that you are checking if the "output signal on pin TX1 delivers the 13.56 MHz energy carrier
modulated by the transmission data", also TX2. Whatever that is supposed to mean.
File: MFRC522.py

MFRC522 stop working after few hours

Hi,
And first of all, thank you for this program, that works well!
I I just noticed that the reader stops readingt usually after a few hours in use, even if the program still run. Has anyone got some tips for solving this issue?

Cheers,
Maxime

7 byte UID

I tried the your lib and it works great (haven't tried the reading and writing data yet).

My problem is that when I use my Mifare Ultralight cards that have a 7 Byte UID instead of the 4 Bytes of a Mifare 1K. I've been searching myself for hours but I can't figure out how to change the code or what to call.

According to the datasheet the Mifare Ultralight cards are supported so I don't know why I can't get it fixed. Any chance you could add support for it?

Is it possible to read MIFARE PLUS?

Hi!! Great job!! I dont know if it is the right place to ask, but, this library can read MIFARE PLUS with RC522?

If not, could give me a tip of why it can read? Is a software or a hardware point?

Thanks!!

WRITING

As a complete novice to Pi, I am having trouble out how to actually write data onto an rfid. Any help? Thanks

Not able to read with another process

I am tyring to implement this with another process, where i can read the stdout of the main.c and get card details.

Ex: .sudo python Read.py | ./sample.c

my sample.c contains simple read operation from stdout, when i check with any other program which prints output like "hello world" continously in infinite loop, i am able to read it from sample.c. When i test with rc522, i am not able to read anything.

Limiting from Continuous Scanning

I was curious if there was a way to limit the read script from a continuous scan to limit a scan recognition to every five seconds or even a minute. I've just noticed that if I hover an RFID card over the sensor that it will continue to read until I swipe it away. And sometimes if it's a fast swipe, it could still read two or three times.

Is there a way to fix this or does anyone have any suggestions? Thanks~ Matt

Write Sector 0

Hi,

Can I write in the Sector 0 with the chinese changeable UID cards? Seems not possible with this library but not impossible by hardware.

Authentication not working

Hi there,

I can see that the code in this repository isn't working, as there is an issue with authentication. Is this repository still active? I'm asking because I've fixed the error with authentication and created some examples in another repository. If you still maintain this I'll submit a pull-request with the changes.

bad indentation

Hi, I've downloaded your library but it has bad indentation in your last commit, i rolled back to your first version and it's working, but as your last commit it is not working.

New User Need Help

Hi! I am trying to run the codes you have uploaded.I have downloaded the SPI-py file and the RPI.GPIO -0.4la files, both of these are stored in my home/pi directory along with zip life of your code( I extracted them in the same home/pi) .
I don't have a lot of experience with pi, just have run a simple code of PIR using GPIO which works.
I have tried to run the files you gave in the Idle , gksudo idle- then opened the files in the order MFRC522.py, dump.py, read.py, then write.py and clicked on run module no output is coming, I am placing my RFID card to read but it is not reading anything, no print statements shown in the code are coming on python shell.
an error line113 GPIO.setup(22,GPIO.OUT) is coming

i will recheck the pins but please tell me how to execute these file, I mean one by one or all together what is the procedure

Iterative Authentication Failing

Scenario:

I want to dump all of the data like the DumpClassic1k funtion except one of my sections of sectors has a different auth key. (Sector 11 has a non-factory auth key, so Sectors 8-10 don't authenticate).

So, I kick off that function expecting Sectors 8-11 to fail auth. But, ALL sectors after 8 fail. 12, 13, ... 63.

The issue (after making my own versions of that function and working through it) is that the auth function doesn't reset after a failure. So, any future calls fail too regardless of the auth key. Now, if you create a whole new instance (ie. Rerun your script) of the MFRC522, then it works again (well, until you get a single failure.) I've output the status value and it seems that the status is never reset. Status is "0" until a failed auth. Then it is "2" and all subsequent auth calls have status "2" regardless if they SHOULD succeed or not. If I remove the "failed" sector in my iteration and run only against sectors that pass auth, then all status's are "0" (even the ones that showed a "2" in the previous scenario where they ran after a failure.)

Any help is appreciated. This utility is awesome and I really like its functionality. Just need this flaw fixed. Thanks.

how run RC522 by using SPI1

Hi, I try to use my RPi3 and the RC522 and a touchscreen display aswell so i need to put my RC522 on the SPI1 How can I do it ?

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.