mxgxw / MFRC522-python

A small class to interface with the NFC reader Module MFRC522
GNU Lesser General Public License v3.0
527 stars 419 forks source link

Code not working with Raspberry pi model B+ #40

Open mohamedbelhassen opened 7 years ago

mohamedbelhassen commented 7 years ago

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?

jozobozo301 commented 7 years ago

First check wires:

Name Pin # Pin name
SDA 24 GPIO8
SCK 23 GPIO11
MOSI 19 GPIO10
MISO 21 GPIO9
IRQ None None
GND Any Any Ground
RST 22 GPIO25
3.3V 1 3V3

If this is correct go to any tutorial and follow steps to install python-dev, enable SPI and change other settings on raspberry. If you are still stuck try to take fresh image and go by this tutorial; http://www.instructables.com/id/Raspberry-Pi-3-Model-B-MIFARE-RC522-RFID-Tag-Readi/

koddr commented 6 years ago

Similar problem. All wires are correct.

$ lsmod | grep spi

spidev             7373  4
spi_bcm2835        7596  0
dingdayu commented 6 years ago

Similar problem. Board D1 indicator light,No response when approaching the card.

pi@raspberrypi:~/Dev/MFRC522-python $ lsmod | grep spi
spidev                 16384  0
spi_bcm2835            16384  0
pi@raspberrypi:~/Dev/MFRC522-python $ sudo apt-get install python2.7-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
python2.7-dev 已经是最新版 (2.7.13-2+deb9u2)。
python2.7-dev 已设置为手动安装。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。
TJMurph commented 6 years ago

I've got the same issues as the above - same reading as dingdayu. Followed the directions at http://www.instructables.com/id/Raspberry-Pi-3-Model-B-MIFARE-RC522-RFID-Tag-Readi/ No errors or anything - just doesn't read.

I've actually got two Raspberry pi's with the same problem. One a model B V1.2 (in black case in photos 1 and 2) and one a B+ 2017 (in clear case photos 3 and 4). They are wired identically and using the same colour scheme - I can't see any problem with the wiring and I've tried replacing the wires. image image image image

$ lsmod | grep spi spidev 16384 0 spi_bcm2835 16384 0

Its powering up alright. I'm getting the following:

$ ls /dev/spi* /dev/spidev0.0 /dev/spidev0.1

The config.txt is showing:

dtparam=spi=on

When I run lsmod I see:

$ lsmod Module Size Used by fuse 110592 3 rfcomm 49152 4 bnep 20480 2 hci_uart 36864 1 btbcm 16384 1 hci_uart serdev 20480 1 hci_uart bluetooth 368640 29 hci_uart,bnep,btbcm,rfcomm ecdh_generic 28672 1 bluetooth brcmfmac 307200 0 brcmutil 16384 1 brcmfmac cfg80211 573440 1 brcmfmac spidev 16384 0 rfkill 28672 6 bluetooth,cfg80211 snd_bcm2835 32768 1 snd_pcm 98304 1 snd_bcm2835 snd_timer 32768 1 snd_pcm snd 69632 5 snd_timer,snd_bcm2835,snd_pcm spi_bcm2835 16384 0 fixed 16384 0 uio_pdrv_genirq 16384 0 uio 20480 1 uio_pdrv_genirq evdev 24576 6 i2c_dev 16384 0 ip_tables 24576 0 x_tables 32768 1 ip_tables ipv6 434176 22

I'm at my wits end trying to get this to work now for an office access card system. Can I please have help?

TJMurph commented 6 years ago

Sorry should also add to the above that I've also tried two different RC522's. Currently got one hooked up to each pi but both having the same problem described at top of thread. All seems installed fine but not actually reading.

ThomasWoeg commented 6 years ago

Im not an expert, but the tutorial I followed suggested, that you have to enable bcm2708 instead of bcm 2835. I did that by adding the following line to the end of /boot/config.txt dtoverlay=spi-bcm2708 Maybe you can try this, I hope this helps!

TJMurph commented 6 years ago

Thought that just related to the silicone of the chip itself which is different in the pi 3B. Since I'm out of ideas I gave it a go anyway though and still not working. Thanks for helping though.

ThomasWoeg commented 6 years ago

Well I bought a Raspberry Pi 3B+ two weeks ago and got it working following this git https://github.com/mxgxw/MFRC522-python So I'm not sure if your problem has something to do with it being a newer Pi

Edit: Nevermind, you're actually using the same library and did the same to implement it.

ThomasWoeg commented 6 years ago

I'm assuming you tried to run the Read.py file. What did that show?

TJMurph commented 6 years ago

Same as the initial post unfortunately:

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

when I touch the tag nothing happens.

TJMurph commented 6 years ago

I did have the same problem with the 3B (two pi's tried and 2 different RFID readers)

TJMurph commented 6 years ago

Would you possibly be able to post the read outs similar to the above you are getting with a working version please? Maybe I can work it out from there.

ThomasWoeg commented 6 years ago

Have you tried debugging or putting prints in the MFRC library, to see exactly which step, seems to be not working?

TJMurph commented 6 years ago

Didn't hit any problems along the way when installing. Just didn't work at the end.

ThomasWoeg commented 6 years ago

Would you possibly be able to post the read outs similar to the above you are getting with a working version please? Maybe I can work it out from there.

Im not sure that I understand what you want from me, but this is the output I get (when it's working)

pi@raspberrypi:~/MFRC522-python $ sudo python Read.py Welcome to the MFRC522 data read example Press Ctrl-C to stop. Card detected Card read UID: 69,245,238,117 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

TJMurph commented 6 years ago

Could you tell me how things look when you run lsmod?

TJMurph commented 6 years ago

and confirm that you are using the Stretch Version: 2.8.2 Release date: 2018-06-27

ThomasWoeg commented 6 years ago

my lsmod output

pi@raspberrypi:~ $ lsmod Module Size Used by rfcomm 49152 6 bnep 20480 2 hci_uart 36864 1 btbcm 16384 1 hci_uart serdev 20480 1 hci_uart bluetooth 368640 29 hci_uart,bnep,btbcm,rfcomm ecdh_generic 28672 1 bluetooth fuse 106496 3 binfmt_misc 20480 1 evdev 24576 6 joydev 20480 0 spidev 16384 0 brcmfmac 307200 0 brcmutil 16384 1 brcmfmac cfg80211 573440 1 brcmfmac rfkill 28672 6 bluetooth,cfg80211 snd_bcm2835 32768 1 snd_pcm 98304 1 snd_bcm2835 snd_timer 32768 1 snd_pcm snd 69632 5 snd_timer,snd_bcm2835,snd_pcm spi_bcm2835 16384 0 uio_pdrv_genirq 16384 0 fixed 16384 0 uio 20480 1 uio_pdrv_genirq i2c_dev 16384 0 ip_tables 24576 0 x_tables 32768 1 ip_tables ipv6 434176 22 how do i lookup the version?

TJMurph commented 6 years ago

If you bought it two weeks ago and downloaded the latest image rather than an old one it’ll be that

TJMurph commented 6 years ago

Thank you - you’ve been very helpful

ThomasWoeg commented 6 years ago

yeah i downloaded the latest image, and even did an apt-get update IIRC

TJMurph commented 6 years ago

Only lines I can see that differ are: fuse 110592 3 fuse 106496 3 rfcomm 49152 4 rfcomm 49152 6 ...then you have the following that I don't at all: binfmt_misc 20480 1 joydev 20480 0

Unfortunately I lack the skills to know any more about why yours works and mine doesn't.

ThomasWoeg commented 6 years ago

What type of RFID tags do you have?

I noticed that MIFARE DESfire EV1 dont work, but EV2 do work

Edit: You can check which ones you exactly have with an android app (NXP Tag Info for example) if your smart phone has NFC

TJMurph commented 6 years ago

Same ones that came with the RFID-RC522 devices

ThomasWoeg commented 6 years ago

That means that they should work.... Then I'm out of ideas. Sorry!

TJMurph commented 6 years ago

I appreaciate the help anyway. Seems unlikely to be hardware problems on two different pi's with two different RC522's.

Mohanavadivel-git commented 5 years ago

I am also facing the same problem with raspberry pi B+...When RFID tag says it works at 13.56Mhz, do we need to configure this frequency in the code, bcoz the spi speed is set to 1Mhz? i tried but it didn't work, any other ideas to make it work

Erjona1 commented 5 years ago

Hello, has anyone been able to solve this? I am having the exact same issue. I installed successfully but i cant make it read :/

mohamedbelhassen commented 5 years ago

Hello, In my case, the problem was the RFID board itself. I just used another one from another seller and it worked fine

Le jeu. 23 mai 2019 à 10:45, Erjona1 notifications@github.com a écrit :

Hello, has anyone been able to solve this? I am having the exact same issue. I installed successfully but i cant make it read :/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mxgxw/MFRC522-python/issues/40?email_source=notifications&email_token=ACE7BMBJ2IZQEHFUJU7HK4TPWZRS3A5CNFSM4DIVKMQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWBVTLY#issuecomment-495147439, or mute the thread https://github.com/notifications/unsubscribe-auth/ACE7BMD4LEEUEFU4GUX5NC3PWZRS3ANCNFSM4DIVKMQQ .

obdbeats commented 5 years ago

I was facing the same problem with MFRC522 and i just solve it connecting the RC522 IRQ pin into PIN 18 of GPIO

deatheater01 commented 4 years ago

Still not working. @obdbeats

obdbeats commented 4 years ago

Still not working. @obdbeats

Yes! It works for me! ;) Keep trying Bro!

alexanderzirl commented 3 years ago

Does not work for me. Any other ideas? Any test methods I could use?