Giter Club home page Giter Club logo

pi-rc522's People

Contributors

anguslmm avatar aterfax avatar cmur2 avatar cvtsi2sd avatar faultylee avatar galarzaa90 avatar jo-me avatar kevinvalk avatar layereight avatar ludwigknuepfer avatar meltinglava avatar mileippert avatar mortbauer avatar ondryaso avatar penguintutor avatar soundstorm avatar stevenroh avatar thijstriemstra avatar wie-niet 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

pi-rc522's Issues

No way to modify antenna gain.

This would be extremely useful for situations when cards need to be read from greater than 1cm. I know the MFRC522-Python library this is based on supports this.

Read faster?

Hi,

first of all thank you for you rc bib. It works fine :)
Do you have any idea to read faster? We have the RFID reader under remote-controlled cars and the Tags lie on the ground. The problem is, that the cars drive too fast over the tags, so that the reader can't read.

We have no idea to improve that. Maybe you have an idea? :)

Thank you :)

Reader not reading

Hi all,

I'm trying to connect an AZ-Delivery RC522 reader to a Raspberry Pi (have tried both 3A+ and Zero 2 W), but the reader just won't read the RFID chip and card that came in the package.

I am using the wiring with IRQ to GPIO24, and have double-checked that all wires are connected correctly.

I am using the current version of Raspberry Pi OS, and have enabled SPI in raspi-config. The kernel modules are loading:

$ uname -a
Linux raspberrypi 5.10.17-v7+ #1414 SMP Fri Apr 30 13:18:35 BST 2021 armv7l GNU/Linux

$ lsmod|grep spi
spidev                 20480  0
spi_bcm2835            20480  0

$ ls -la /dev/spi*
crw-rw---- 1 root spi 153, 0 Nov  7 09:42 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Nov  7 09:42 /dev/spidev0.1

However, when I run the "util" test program from the README, it hangs on rdr.wait_for_tag(), no matter how long I hold the chip or card to the reader.

I have tried this both with spidev 3.5 and 3.4, as suggested in #71.

Any idea what I could try to make this work? Or how I would even debug this?

continous reading fails after 16-20 reads

Hi, great rc522 lib, thanks for this contribution! (CPU usage is low and reading works fine...on raspberry)
my goal is to call a function on tag detection and another on tag removal.
tag detection works fine...
but now i leave the rfid tag on the reader after every 16-20 reads (rdr.request()) returns No Card detected (None/False) and resumes reading the tag fine afterwards ...
problem is, this error makes me think the tag was removed... wrongly :(

am i using the wrong function? or do i need to throttle down reading?

thx gus

Two Readers (CS0 and CS1) not working in one program

Hi,
using one reader (spidev0.0 and spidev0.1) in one program works (Read.py).

Two readers are not working. Only the first initialized is working.
Any idea?

Thomas

`import RFID
import signal
import time

run = True
rdr0 = RFID.RFID("/dev/spidev0.1")
rdr1 = RFID.RFID("/dev/spidev0.0")
util1 = rdr1.util()
util1.debug = True
util0 = rdr0.util()
util0.debug = True

def end_read(signal,frame):
global run
print ("\nCtrl+C captured, ending read.")
run = False
rdr0.cleanup()
rdr1.cleanup()

signal.signal(signal.SIGINT, end_read)

print ("Starting")
while run:
(error, data) = rdr0.request()

(error, uid) = rdr0.anticoll()
if not error:
    print ("In Card read UID: "+str(uid[0])+","+str(uid[1])+","+str(uid[2])+","+str(uid[3]))

(error, data) = rdr1.request()
(error, uid) = rdr1.anticoll()
if not error:
    print ("Out Card read UID: "+str(uid[0])+","+str(uid[1])+","+str(uid[2])+","+str(uid[3]))

 time.sleep(0.1)

`

Reading card content to text

Could you please include or point me to an example for how to read the whole content of a card and print it as a string?

I have checked your examples but could not wrap my head around the whole logic for reading the data from the card.

I understand the sectors and blocks, but what exactly should be done in order to read the whole card and output the whole data as a textual content?

rdr.request() fails one time in two

When polling the state while a while loop (like in the example) the rdr.request() fails one time in two if the tag is always kept close to the reader.

More precisely : when I place my tag on the reader and leave it there I would expect rdr.request() to return True at each iteration of the loop, but instead it returns a sequence like this :

(True, data) 
(False, None)
(True, data)
(False, None)
...

This behavior make it more complicated to detect a tag removal.

Cannot import on Beaglebone

Hi,
I'm trying to use this module on BeagleBone Black.
But I fail to import the module and get an error.

Must be used on Raspberry Pi
ImportError: cannot import name 'RFID'

I'm wondering how to use the module on BeagleBone Black.

stuck at wait_for_tag()

I follow exactly the instructions and double check them I'am using raspberry pi 3b+
I used to work with MFRC522 library and now decided to change this one but it seems reader does not read any card at all. No warning, no error.

What should I do?

OLED with RFID

Hi,
I am trying to combine an OLED display with a RFID reader. The OLED should give status informations about the user. I used the procedure described here (https://www.raspberrypi-spy.co.uk/2018/04/i2c-oled-display-module-with-raspberry-pi/) to run the display. In separate it works perfectly but when I try to combine both it does not work. The display library Adafruit_SSD1306 (SSD1306_128_32) is using GPIO.BCM. The pirc522 library is using GPIO.BOARD. According to the Readme it is possible to switch to BCM: “You may change BOARD pinout to BCM py passing pin_mode=RPi.GPIO.BCM.” I tried to change the values but it doesn’t work like this.
Could you please explain more in detail how to change from BOARD to BCM ?

Best regards
Norbert

7-byte tag support

Hi,
Tags with 7-byte id's do not seem to be read. These tags are detected, but the id is not returned. Am I doing something wrong?
Thanks!

getting E1 or E2 error

whenever I screen the card, it only prints E1 or E2, but I have no idea where E1 or E2 comes from? I follow the instruction in here:

http://www.penguintutor.com/news/raspberrypi/rfid-rc522

how to avoid the errors to print "Detected" successfully?

#!/usr/bin/python3

import sys
sys.path.insert(0, "/home/pi/pi-rc522/ChipReader")
from pirc522 import RFID
import signal
import time
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522

reader = RFID()
util = reader.util()
util.debug = False

print("reader= ", reader)
print("util= ", util)

while True:
    (error, data) = reader.request()
    print("reader.request()= ", reader.request()) 
    if not error:
        print("\nDetected")
        (error, uid) = reader.anticoll()
        if not error:
            print ("str(uid[0]) " +str(uid[0])+ ", "+str(uid[1])+", "+str(uid[2])+", "+str(uid[3]))
            time.sleep(1)

print E1/E2 cannot print Detected, all connection and installation should work.

Errno 2 directory does not exist

I am using a raspberry pi 4 model b running the latest version of raspbian (2020-02-13). I followed this tutorial on how to use the rc522 RFID scanner with a raspberry pi: https://pimylifeup.com/raspberry-pi-rfid-rc522/ / https://www.youtube.com/watch?v=evRuZRxvPFI&t=172s .When I got to the point where I needed to run Write.py it gave me the error: python3: can’t open file ‘Write.py’ : [Errno 2] No such file or directory

Thank you for your time, and I hope you can help.

Wake up?

May #7 #10 be caused because of the card was not sent the wake up command?

what pin can I remove?

I'm limited to 7 pins for now, can I possibly skip something like IRQ and what would I lose

Doubts

1 - What are authentication methods A and B?
2 - Why does the read_out () method always display the message "Not calling card_auth - already authed"?

Can't read cards

I changed from MFRC522-python because of the "list index out of bounds" issue that has been mentioned there.

If I run the Read.py and swipe my card nothing happens. No error, no nothing.
I'm on a Pi 2B, raspbian, everything is wired correctly and I installed spidev.
If I type "ls /dev/spi*" there is spidev0.0 and spidev0.1. Anything wrong there?

Everything was setup correctly for my project on MFRC522-python and now I have to implement it with pi-rc522 and it stops me right at the beginning :'(

SPI1 instead of SPI0

As RaspberryPi Zero uses SPI0 for display it seems to be interesting how to use other SPI interface. The task is complicated because of GPIO18 (used by the current design) is CE0 of SPI1, so there seem to be some interferences. Furthermore there is a conflict between the display and the RFID receiver with GPIO24 and with GPIO25. How to make this working?

How can use the SPI1 ?

How can use SPI1 for communication on raspberry pi with your library? GPIO7 belongs to SPI0 so it does not solve my problem unfortunately.

Something wrong while running the demo code.

  • When I run your first demo code with no util, I gotta an error while reading cards.
  • I tried to debug in RFID.py, found that when I call the function rdr.read(block_address), In RFID.py, the write() function in read() returns an empty list.
  • Your second demo code runs well, I have no idea why this happens.
  • At last, could you please tell me can this RF522 module with your lib rewrite the uid of some cards whose uid have been declared to be able to be modified.

Thanks a lot !

How to reduce electromagnetic emissions?

It might sound finicky, but I would like to reduce the electromagnetic emissions from the RFID reader.

I build a speaker with an RFID reader inside and kids are putting their heads on it, I don't want their brains to be fried over time. (Mobile phone usage [GSM, UMTS, LTE] is strongly discouraged for small kids.)

It there a way to reduce 1) the field strength and 2) the emission interval? I would be happy to experiment to set the strength as low as possible and for me a 3 second interval would be enough. I am just a RFID user, so I am to sure if this is doable at all.

Port to SpiDev

It’s maybe good to use SPIDEV instead of SPI-Py.
See mxgxw/MFRC522-python#31
As long as I am aware of (I am not a pro), SpiDev is more popular than SPI-Py.
It doesn’t make much sense in my setup to run two different SPI lib, since it may cause compatibility issues.

Read fails after some time

Hi,

i got two problems.

  1. wait_for_tag is not working for me - it just hangs there waiting. However i can read tags after commenting out the wait_for_tag bit
  2. After like 40 reads in a row ( not a specific number it just happens after some time ) not tags can be read anymore. It always errors out after rdr.request()

System is a fresh raspian on a raspberry zero w

The library reads two times the module and one is wrong

The code is from the readMe:

rdr = RFID.RFID()
while True:
  (error, tag_type) = rdr.request()
  if not error:
    print ("Tag detected")
    (error, uid) = rdr.anticoll()
    if not error:
      print("1")
      rdr.stop_crypto()
    else:
        print("0")
  else:
      print("0")

and the output is something like this
OUTPUT:
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0

Clean pip install fails

Installing in a virtualenv fails as spidev is missing. Once that has been installed, it fails again because RPi.GPIO is missing. After installing that, pip install pi-rc522 works.

setup.py should be updated to install these dependencies. I'll submit a PR later this week if I find time

I cant read my card

I use pi3 , I see this, so one step by step i do,
but nothing print , no error,no uid,
I waste a day to fix , but i am fail.
I think it is my gpio not right ,can you tell me how i should do.
I use Physical pin same to you , but I think it is not right with pi3

deauth() doesn't reset the authentication data

print "\nChanging Key"
util.write_trailer(1, (0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), (0xFF, 0x07, 0x80), 105, (0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF))
util.deauth()

util.auth(rdr.auth_a, [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF])
util.do_auth(util.block_addr(1, 0))  # OUTPUT : Not calling card_auth - already authed
print "\nWriting modified bytes"   
rdr.write(4, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])

I am changing the Trailer first and call the deauth(), but I called the do_auth, it said already authed.

I am wonder deauth() can give a total reset or not.
So I can change the Data Block after I changed the Trailer
Thanks!

RFID-THM3030

Do you have any idea if and how this reader pictured below would map to the pins mentioned in the documentation?

9176 png

Reading Cards on Events

Hi guys.

I am new to Raspberry Pi and for my fist project I set RC522 and your library. It works fine from the samples. But the thing is, I want to get away from While true loop(CPU consumption) and move to an event listening. How can I do that? Any hints are welcome.

KeyChange

after running the KeyChange file i understand i now need that key to read sector 1 however sectors 2-15 still use the default key..

i am very new to this rfid stuff and still trying to understand most of it.. was wondering is there a way to reset the key back to default on the first sector ?

any way any help would be greatly appreciated..
thank you for your time

"E1"/"E2" error messages when increasing antenna gain above default

When adjust the antenna gain above the default value of 4 using the RFID.set_antenna_gain() method introduced in #32, e.g. in a slightly modified Read.py example, sequences of "E1" and "E2" are printed. They seem to originate from the RFID.card_write() method, however the code there is a bit opaque to me.

all seemd ok but don't read

Hi,
your library seems to be the most recent so it's very usefull for me, thank you.
I have a RPI3 and:

  1. connected the RFID reader as the schema
  2. cloned and install SPI and your library
  3. configured /boot/config.txt with
device_tree_param=spi=on
dtoverlay=spi-bcm2708

But when I launch python Read.py nothing happen :(

I read in README that you said:

pin_ce=BOARD numbering pi

What does it mean exactly?

Can't read HID iClass

I cannot get any HID iClass DH cards to work. I'm not sure if it's a software or hardware issue. Any help is much appreciated.

Request: timeout on wait_for_tag

It would be nice to have a timeout argument on the wait_for_tag function. I'm using it to listen for tags on a looping thread that checks on a 'global' exit flag at each loop, but since wait_for_tag can never exit I have no nice way of killing it so I was forced to make my own modified version.

It should be a simple change, like this:

def wait_for_tag(self, timeout):
	# enable IRQ on detect
	start_time = time.time()
	rdr.init()
	rdr.irq.clear()
	rdr.dev_write(0x04, 0x00)
	rdr.dev_write(0x02, 0xA0)
	# wait for it
	waiting = True
	while waiting and time.time() - startTime < timeout:
		rdr.dev_write(0x09, 0x26)
		rdr.dev_write(0x01, 0x0C)
		rdr.dev_write(0x0D, 0x87)
		waiting = not rdr.irq.wait(0.1)
	rdr.irq.clear()
	self.init()

It's just a little detail that would improve usability.

get_access_bits function not callable

Trying to call the def get_access_bits(self, c1, c2, c3) function, defined in pirc522/util.py, line 138 I get an
AttributeError: 'RFIDUtil' object has no attribute 'get_access_bits'

I just added

# transport configuration
c1 = (0,0,0,0) 
c2 = (0,0,0,0)
c3 = (0,0,0,1)
b1,b2,b3 = util.get_access_bits(c1, c2, c3)

in the examples/UtilExample.py, line 12. Also tried to call get_access_bits within the loop, e.g. line 49.

Any suggestions?

auth fail always

sorry . my poor english .

if auth fail , always fail.
[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF] is true
[0xF1,0xF1,0xF1,0xF1,0xF1,0xF1] is false

from pirc522 import RFID
rdr = RFID()
rdr.wait_for_tag()
(error, tag_type) = rdr.request()
(error, uid) = rdr.anticoll()
rdr.select_tag(uid)
False
rdr.card_auth(rdr.auth_a, 10, [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF], uid)
False
rdr.card_auth(rdr.auth_a, 10, [0xF1,0xF1,0xF1,0xF1,0xF1,0xF1], uid)
True
rdr.card_auth(rdr.auth_a, 10, [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF], uid)
True

Reader not reading certain Card

Hi I bought my MFRC22 Reader on amazon and wired it up. It was shipped with a blue round dongle and with a white blank plastic card. Both are reporting to be type ISO 14443-3A MIFARE Classic 1k

Using the example program reading the blue dongle is working very stable. However it does not work at all with the white plastic card. It always returns with the error flag set to True.
I also tried reading with my android phone using the app NFC Tools. The phone reads both cards without any problem.

I wasn't able to find any clue on how to deal with this. Are there any options I can adjust in the library regarding this issue? The cards doesn't seem to be broken, but will the behavior the same with other cards? I want to use several of the cards. Are there cards which I can safely buy or will those also be affected by this problem?

Thanks

pi-rc522 not working with spidev 3.5

Hello.

I discovered recently that pi-rc522 does not work with spidev version 3.5. Reverting back to version 3.4 works.

I'm a fairly novice programmer so I'm not certain why that is the case, but I'd be happy to provide any information or try any potential fixes if needed. Please just let me know if I can help!

Thanks!

install fails on BeagleBone black (RPi libs are installed)

install fails on BeagleBone black.

setup will install the libs needed for Raspberry Pi ( spidev and RPi.GPIO ) not the one needed for BeagleBone Black ( Adafruit_BBIO ).

Work around is to remove the RPi libraries after pip install and install the lib needed for BBB.

git clone https://github.com/ondryaso/pi-rc522.git
cd pi-rc522
python setup.py install

pip uninstall spidev
pip uninstall rpi.gpio
pip install Adafruit_BBIO

Best would be to automate this in setup.py, or perhaps even easier - if possible - to switch to use Adafruit_GPIO.SPI ?

Integration into other project

I find it difficult to integrate this lib into other python project : as it has not setup.py to install it, it must be included directly into the source of the application using it.
That's not really a problem, except that RFID.py and RFIDUtil.py import each other, meaning that if you simply copy the ChipReader directory in the application source tree, these import fails (there are not relative import).

AFAIK there are several way of solving this kind of problem, the cleanest it probably to make it an actual library (with a setup.py). I could work on a pull request for this if you want.

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.