RFID-RC522 PICC_ReadCardSerial always zero

Happy day to everyone. I have a problem with an RFID-RC522 connected to an ELEGOO board arduino if you want to see some details you can find them all at this link. The problem I am experiencing is that whatever tutorial I see does not work to recognize the card. I will put my sketch and a picture of the configuration I used. I hope to get help and I really hope it is not my RFID-RC522 that is the problem, thank you very much for listening.

/**
* Source code:
* https://www.italiantechproject.it/sensori-con-arduino/lettore-rfid
*/
#include <MFRC522.h>
 
MFRC522 rfid(10, 5);
 
void setup(){
  Serial.begin(19200);
  SPI.begin();
  rfid.PCD_Init();
}
 
void loop(){
 bool x=rfid.PICC_IsNewCardPresent();
 bool y=rfid.PICC_ReadCardSerial();
 Serial.println("==="); 
 Serial.println(x);
 Serial.println("###"); 
 Serial.println(y);
 Serial.println("==="); 
 getUID();
 if (rfid.PCD_PerformSelfTest()) Serial.println("Passed Self-Test");
//x and y alsays 0 in any case
  if(x && y){
    String uid = getUID();
    Serial.println("RFID ID: " + uid);
  }
  else{
    Serial.println("RFID ID not working ");}
  delay(1000);
}
 
String getUID(){
  String uid = "";
  Serial.println("READING");
  for(int i = 0; i < rfid.uid.size; i++){
    uid += rfid.uid.uidByte[i] < 0x10 ? "0" : "";
    uid += (rfid.uid.uidByte[i], HEX);
    Serial.print(rfid.uid.uidByte[i]);
  }
  Serial.println("READED");
  rfid.PICC_HaltA();
  return uid;
}

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it is not an Introductory Tutorial

Thanks for the support

Hi!

This picture doesn't help so much to see the wiring.

For me looks like the RST is connected to pin 6 not on 5 as specified on code.

Best regards.


i connected the RST on pin 5

The wiring seems fine.

I could try an external power supply for 3.3 V since the Uno can delivery only 50 mA on 3.3 V pin.

I am using my PC's power supply via USB with the 3.3V pin. Currently I don't know how I could provide a different configuration than this. This is a really strange situation, I hope my RFID is not broken. Thanks for your patience.

RFID I am working hard to make RFID work but still unsuccessful, I don't know what to do. I am taking inspiration from this youtube video but without success. l'RFID doesn't print the tag.

i have a question: the pin 3.3V in the arduino UNO, isn't it used to deliver 3.3V? or since the arduino is a 5V device does it still deliver 5V? Can anyone confirm this for me?

The 3.3V pin of a 5V Arduino such as a Uno, or Nano outputs 3.3V, but the current available very limited

do you have any suggestions to solve it? i can't tell if the hardware is damaged or is it me who didn't put the connections in the correct way.

Happy morning. Do you think that i need this module?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.