3

I have a project that requires 4 different RFID-RC522 readers. The RFID-RC522 has the following pins:

  • SDA
  • SCK
  • MOSI
  • MISO
  • IRQ
  • GND
  • RST
  • 3.3V

I have read that the SDA pin is used for selecting the active device, So I'm thinking that these devices can share data pins. Is it possible to connect multiple RFID-RC522 readers to the same 3.3V, RST, GND, IRQ, MISO, MOSI and SCK pins if you use a different pin for each SDA? If so, this would save me a lot of pins. So far, I have only seen direction on how to connect one RFID-RC522 to an Arduino.

I'm using the MFRC522 library. It appears to only support one reader because it only allows one SS pin to be identified in the constructor, and offers no way to change it later. An I missing something or do I need another library?

  • possible duplicate of Use RFID-RC522 with other Pins – Magic-Mouse Feb 26 '15 at 17:19
  • I am not asking how to redefine pins, I want to use one set of pins for multiple RFID cards. – Hoytman Feb 26 '15 at 17:49
  • The answer is still there. – Magic-Mouse Feb 26 '15 at 17:55
  • @Magic-Mouse no, it is not. That doesn't state how to create different objects with different pins. To the OP: I'd suggest editing the library to replace the macro with a variable inside the class and just pass that in the class constructor. You're on the right track with the different chip select pins, but it seems like you might need to have an independent RST pin for each one, too. All of the SPI pins (SDA/SCK/MISO/MOSI) and power (3.3V/GND) 100% can be shared as long as the chip has a select pin. – Anonymous Penguin Mar 1 '15 at 17:17
  • @AnnonomusPenguin SDA is the SS/CS pin – Magic-Mouse Mar 2 '15 at 8:44
2

Connect everyone to the MOSI / MISO / SCK and ground, then define every SDA all the way around. and set respectively high low depending on where you want to write.

How ever im not sure if you need to set high or low if you want to read. But since you got multiple you can play around with that your self. Feel free to add to this question with the result for future googlers.

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN           7          // Configurable, see typical pin layout above
#define RST_PIN2           8          // Configurable, see typical pin layout above
#define SS_PIN           9          // Configurable, see typical pin layout above
#define SS_PIN2          10          // Configurable, see typical pin layout above

....

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
MFRC522 mfrc522_2(SS_PIN2, RST_PIN2);   // Create MFRC522 instance.

....


void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();        // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
  mfrc522_2.PCD_Init(); // Init MFRC522 card
  • I'm using the MFRC522 library. It appears to only support one reader because it only allows one SS pin to be identified in the constructor, and offers no way to change it later. An I missing something or do I need another library? – Hoytman Feb 28 '15 at 14:56
  • @Hoytman works fine for me, though i only have one that i can test on but it compiles. – Magic-Mouse Feb 28 '15 at 15:35
  • On my first couple of attempts, I could not get this to work. Might have been my own code mistakes though. – Hoytman Mar 7 '15 at 15:47
  • I just saw that i made a copy paste error, try and set the variables as the corrected code. – Magic-Mouse Mar 9 '15 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.