I'm wondering where the pin setting is manifested in the library. I want to use the RC522 with other digital pins than the default 50-53 pins, because I am using a shield for a display on theese ports.

Where can I change the used ports? why are two ports user-defineable #define RFID_SS 10 #define RFID_RST 5 while the rest is not?

I am with this Playground-Guide using this library from Github on my Arduino Mega

3 Answers 3

#define RFID_SS  10

stands for Slave Select on port 10, the SPI is a serial interface, meaning you can connect all kinds of SPI devices to the same wires, as long as slaves have different IO ports.

This is also the reason you don't need to define the other ports because they need to be connected to your SPI.

I suggest you make yourself familiar with this page: http://arduino.cc/en/Reference/SPI

To sum it up. You can change the reset and Slave Select pin out, (those set in the variables) but not the SPI Pins. But you can use the ISCP pins in the middle of the board.

  • so I can either use ISCP on my board for MOSI MISO SCK. Or I connect the display shield to pins 50-53 and at the same time connect the RFID'sMISO / MOSI / SCK to the same ports 50-53 and the select/reset pins do the rest (choosing where to send data to) for me?
    – Joel
    Commented Feb 19, 2015 at 11:14
  • Yes that is correct. Also be aware that some libraries (lib) have the SS pin hard-coded, this is solved by going in to the library and change the value to a variable set through the function. Commented Feb 19, 2015 at 12:17

SPI The RFID_SS pin is the slave select pin. So you can have another arduino pin for a LCD_SS select. Having RfID_SS =low - talk to RFID. Having LCD_SS =low talk to LCD via MISO. Note: Drive other slave select High otherwise they'll both get the data. Having only one device in communication at a time. Cheers Nik V


Sorry I'm a bit late (5 years late) but hopefully this can help someone who's just now trying to do this!

There's an old obscure Sunfounder library, "rfid1.h" that lets you declare every pin. Like this:


It's a bit hard to find the library online these days, but at the bottom of this page (http://wiki.sunfounder.cc/index.php?title=Mifare_RC522_Module_RFID_Reader) if you download the "RFID-RC522_test_experiment" zip file it will have the library in there. The secret is that this library includes a software SPI which is sort of like a software serial for SPI communication. Letting other digital pins be used as MISO etc...

This library also makes it much easier to use multiple RFIDs reliably since they don't have to share all the same pins.

You can find some example code here: https://www.sunfounder.com/learn/RFID_kit_V1_for_Arduino/lesson-29-rfid-entrance-guard-system-rfid-kit-v1-0-for-arduino.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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