[ad_1]
I am making an attempt to learn an NFC/RFID tag utilizing Arduino and an RFID-RC522 module.
At present I can efficiently learn the information from a key fob and from a card that had been included with the RC522, however the tag I need to learn isn’t detected in any respect.
Is the module I am utilizing unsuitable to learn this sort of tags?
Tag:
Code:
#embrace <SPI.h>
#embrace <MFRC522.h>
#outline SS_PIN 10
#outline RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);
void setup() {
Serial.start(9600);
SPI.start(); // init SPI bus
rfid.PCD_Init(); // init MFRC522
Serial.println("Tag reader on");
}
void loop() {
if (rfid.PICC_IsNewCardPresent()) { // new tag is on the market
if (rfid.PICC_ReadCardSerial()) { // NUID has been readed
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
Serial.print("RFID/NFC Tag Kind: ");
Serial.println(rfid.PICC_GetTypeName(piccType));
// print NUID in Serial Monitor within the hex format
Serial.print("UID:");
for (int i = 0; i < rfid.uid.measurement; i++) {
Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(rfid.uid.uidByte[i], HEX);
}
Serial.println();
rfid.PICC_HaltA(); // halt PICC
rfid.PCD_StopCrypto1(); // cease encryption on PCD
}
}
}
Output learn on Serial Monitor once I scan the important thing fob and the cardboard:
Tag reader on
RFID/NFC Tag Kind: MIFARE 1KB
UID: BC 38 B4 12
RFID/NFC Tag Kind: MIFARE 1KB
UID: 86 FB 35 B6
Wiring:
My RC522 module:
[ad_2]