1

i brought a rfid module which is rc 522 but when i upload the code it is not reading the card even when i upload example code i have returned it 2 times and got it replaced but the same problem may i know the solution

#include "SPI.h" // SPI library
#include "MFRC522.h" // RFID library (https://github.com/miguelbalboa/rfid)

const int pinRST = 9;
const int pinSDA = 10;

MFRC522 mfrc522(pinSDA, pinRST); // Set up mfrc522 on the Arduino

void setup() {
  SPI.begin(); // open SPI connection
  mfrc522.PCD_Init(); // Initialize Proximity Coupling Device (PCD)
  Serial.begin(9600); // open serial connection
}

void loop() {
  if (mfrc522.PICC_IsNewCardPresent()) { // (true, if RFID tag/card is present ) PICC = Proximity Integrated Circuit Card
    if(mfrc522.PICC_ReadCardSerial()) { // true, if RFID tag/card was read
      Serial.print("RFID TAG ID:");
      for (byte i = 0; i < mfrc522.uid.size; ++i) { // read id (in parts)
        Serial.print(mfrc522.uid.uidByte[i], HEX); // print id as hex values
        Serial.print(" "); // add space between hex blocks to increase readability
      }
      Serial.println(); // Print out of id is complete.
    }
  }
}

this is one of the many codes i used

4
  • 1
    What gets printed? You have a lot of serial prints there, can you please edit the question and share what you see?
    – Nick Gammon
    Nov 8, 2021 at 6:17
  • 1
    i just see nothing Nov 8, 2021 at 14:50
  • Possibly you have wired it incorrectly. Without seeing any photos, links to the module you bought, or schematics, it is very hard, if not impossible, to say.
    – Nick Gammon
    Nov 9, 2021 at 6:15
  • SDA 10, SCK 13, MOSI 11, MISO 12, IRQ UNUSED, GND GND, RST 9, 3.3V 3.3V, i dont feel they are wrong Nov 9, 2021 at 14:05

0

Your Answer

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

Browse other questions tagged or ask your own question.