RFID Reader distance from Arduino

Hi everyone,
I am currently working on a project where I have to read an RFID tag, but the thing is, the Arduino is 8 meters away from the RFID Reader (MFRC522), connected with a high quality cable. I was working with 15cm length before, and everything was working with the MFRC522 library. Then, I extended the cable to 5 meters, and it wasn't working, but when I started using the RFID library, it started working on 5 meters length.
Now, I need to read from the reader on 8 meters length, but it doesn't work right now with the current RFID library. I tried something like changing the frequencies, but I can't make it work.
The previous programmer managed to make it work, so his code works on 8 meters distance from the Arduino, but mine works in maximum 5 meters.
I would be really thankful if someone can help me.

Note: I connected my Arduino on the same hardware from the other programmer, he didn't use any other buffers or whatever, just a normal wiring.

Code:

#include <SPI.h>
#include <RFID.h>
 
#define SS_PIN 10
#define RST_PIN 9



RFID rfid(SS_PIN, RST_PIN);
String rfidCard;
 
void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  rfid.init();   // Initiate MFRC522
  Serial.println();
}
void loop() 
{
  if (rfid.isCard()) {
    if (rfid.readCardSerial()) {
      rfidCard = String(rfid.serNum[0]) + " " + String(rfid.serNum[1]) + " " + String(rfid.serNum[2]) + " " + String(rfid.serNum[3]) + "|";
      Serial.println(("UID: " + rfidCard));
      delay(3000);
    }
    rfid.halt();
  }
}

Even 5 meters will never be reliable. You're using the SPI interface, a bus that's designed to have a length of about 40cm at most. By lowering the bus frequency you can extend to to about 1 meter but everything above that is pure luck and the slightest electrical noise will kill the connection.

So you have several options:

  • Move the Arduino to the RFID reader (best solution). Use some other kind of connection to transfer the data to your PC (or why ever you think the Arduino must be that far).

  • Connect to the RFID reader by I2C and use a pair of I2C extender (p.e. P82B715) chips to extend the bus length (standard is about 50cm max.).

  • Lower the SPI frequency as long as you don't get a result from the RFID reader (definitely not recommended) and live with the bad reliability.

Thank you so much, I lowered the SPI frequency, by setting the clock divider to SPI_CLOCK_DIV8, and now it works.

As I wrote: On a distance of 8 meters this won't be reliable. I strongly recommend to change to one of the other options if you use that actually.