0

Ok, So I have one RC522 reader working with no issues. I want to have 3. I don't care which receiver picks up the RFID tag, I just want to know whenever a tag was picked up at all by any of them. Essentially, if I detect any RFID tag with an expectation of just one unique tag at a time, I want to get the RFID tag number and do stuff with it. I am using the MFRC522.py library to control the device.

I was reading through a bunch of other guides and it seems there is a chip select and a way to set overlays. I set the 3cs overlay in order to have 3, but the default CS0 (18) pin doesn't seem to work the way I expect. Previously, I used the standard CE0 (24) pin and my code worked, but after changing the overlay and moving the pin to 18, the one reader is not working (though it still works on 24).

What am I missing here? I'm not super new to coding and hardware, but I'm also no pro in the hardware area.

EDIT for further clarification:

I have one currently working RC522. It's connected via pin 24 - CE0 as well as the MISO/MOSI/SCLK pins. And, at the end of the day I want to have all three working together on the same Rpi. The code can be found here - https://github.com/DevMattM/MFRC522-python

The library I am using uses SpiDev, and does a spi.open(0,0).

As far as pins go, I am just going by the pin number, not GPIO number, but after reading your comment and checking the pin out ( GPIO Pinout Orientation RaspberyPi Zero W) we are talking about the same pin. Thank you for clarifying.

Matthew
  • 29
  • 4

2 Answers2

1

Question

How can Rpi talk to 3 SPI RFID reader at the same time?

Answers

Short Answer

No problem. You use the NSS (Not Slave Selected) signal to disslect what you don't want.

rfid nss

/ to continue, ...

Long Answer

/ to continue, ...

References

PN532/C1 Near Field Communication (NFC) controller - NXP 2017

AliExpress RC522 Modules

AliExpress PN532 NFC RFID Module V3

Adafruit PN532 NFC/RFID Controller Shield for Arduino + Extras $40

RFID Selection Guide - EBV Elektronik

MFRRC522 Python

SPI-Py: Hardware SPI as a C Extension for Python - Louis Thiery

/ to continue, ...

Appendices

Appendix A - Rpi Pinout

rpi pinout

Appendix B - Use Rpi/MCP23017 GPIO pins to select more than 16 SPI Devices

Instead of RPi’s built in CE0, CE1 signals. I can use, says, 6 GPIO pins as CE0, CE1, to CE5 pins to select 6 SPI devices.

In other words, I almost never only use Rpi’s GPIO pins for "GPIO" - I only use them for SPI select or similar demux jobs. I only use the I2C, SPI, and UART pins. This way I can easily port my python/microPython software and I2C/SPI/UART hardware between Rpi, PyBoard, MicroBit, and CircuitPython etc.

For selecting more than 16 SPI devices, my trick is using MCP23017 GPIO signals to pretend to be CEn signals. So, only 1 MCP23017 can chip select 16 SPI devices. And I can use two MCP23017 to select 32 SPI devices. I have tried it a couple of times and so far so good.

Appendix C - RC522 Module Pinout

rc522 pinout

tlfong01
  • 4,847
  • 3
  • 12
  • 24
0

The easiest solution to your problem is to connect your MFRC522 to an Arduino nano each. Then you can talk between the raspberry and the 3 arduino using I²C. Moreover you are able to stack 256 RFID readers using this technique.