RFID reader MFRC-522 - UID vs PICC

Hi I have cheap 13.56MHz RFID reader from eBay http://www.ebay.com/itm/271425698949.

I have one chip and one card (supplied with reader). I need to read unique card id and send it to PC over Serial port.

I use these program from github:

/*
 * Dump block 0 of a MIFARE RFID card using a RFID-RC522 reader
 * Uses MFRC522 - Library to use ARDUINO RFID MODULE KIT 13.56 MHZ WITH TAGS SPI W AND R BY COOQROBOT. 
 ----------------------------------------------------------------------------- 
 * Pin layout should be as follows:
 * Signal     Pin              Pin               Pin
 *            Arduino Uno      Arduino Mega      MFRC522 board
 * ------------------------------------------------------------
 * Reset      9                5                 RST
 * SPI SS     10               53                SDA
 * SPI MOSI   11               52                MOSI
 * SPI MISO   12               51                MISO
 * SPI SCK    13               50                SCK
 *
 * Hardware required:
 * Arduino
 * PCD (Proximity Coupling Device): NXP MFRC522 Contactless Reader IC
 * PICC (Proximity Integrated Circuit Card): A card or tag using the ISO 14443A interface, eg Mifare or NTAG203.
 * The reader can be found on eBay for around 5 dollars. Search for "mf-rc522" on ebay.com. 
 */

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10    //Arduino Uno
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);        // Create MFRC522 instance.

void setup() {
        Serial.begin(9600);        // Initialize serial communications with the PC
        SPI.begin();                // Init SPI bus
        mfrc522.PCD_Init();        // Init MFRC522 card
        Serial.println("Print block 0 of a MIFARE PICC ");
}

void loop() {
        
        // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
        MFRC522::MIFARE_Key key;
        for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;
        
        // Look for new cards
        if ( ! mfrc522.PICC_IsNewCardPresent()) {
                return;
        }

        // Select one of the cards
        if ( ! mfrc522.PICC_ReadCardSerial())    return;
        
        Serial.print("Card UID:");    //Dump UID
        for (byte i = 0; i < mfrc522.uid.size; i++) {
          Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
          Serial.print(mfrc522.uid.uidByte[i], HEX);
        } 
        Serial.print(" PICC type: ");   // Dump PICC type
        byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
        Serial.println(mfrc522.PICC_GetTypeName(piccType));
         
        byte buffer[18];  
        byte block  = 0;
        byte status;
        //Serial.println("Authenticating using key A...");
        status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, block, &key, &(mfrc522.uid));
        if (status != MFRC522::STATUS_OK) {
           Serial.print("PCD_Authenticate() failed: ");
           Serial.println(mfrc522.GetStatusCodeName(status));
           return;
        }
        
        // Read block
	byte byteCount = sizeof(buffer);
	status = mfrc522.MIFARE_Read(block, buffer, &byteCount);
	if (status != MFRC522::STATUS_OK) {
	    Serial.print("MIFARE_Read() failed: ");
	    Serial.println(mfrc522.GetStatusCodeName(status));
	}
        else  // Dump data
	for (byte index = 0; index < 16; index++) {
	    Serial.print(buffer[index] < 0x10 ? " 0" : " ");
	    Serial.print(buffer[index], HEX);
	    if ((index % 4) == 3) Serial.print(" ");
	}
        Serial.println(" ");
        mfrc522.PICC_HaltA(); // Halt PICC
        mfrc522.PCD_StopCrypto1();  // Stop encryption on PCD
       
}

After I put card and chip to reader I see in putty:

Print block 0 of a MIFARE PICC
Card UID: 05 88 72 45 PICC type: MIFARE 1KB
 05 88 72 45  BA 08 04 00  62 63 64 65  66 67 68 69
Card UID: 64 24 95 5B PICC type: MIFARE 1KB
 64 24 95 5B  8E 08 04 00  62 63 64 65  66 67 68 69

So there is my question. What is unique ID? UID, or PICC?

UID = Unique ID
PICC = short for Proximity Integrated Circuit Card (RFID Tag itself) actually your code header explains this.

1 Kb Tags can hold data up to about 1 Kb exact usable space less because of UID. UID generally can be 4 byte or 7 byte, maybe more. If you just want print scanned tag’s (PICC’s) UID on serial you can use like this

for (int i = 0; i < mfrc522.uid.size; i++) {  // for size of uid.size write uid.uidByte to readCard
    readCard[i] = mfrc522.uid.uidByte[i];
    Serial.print(readCard[i], HEX);
}

Can you paste the whole code? please

Dear, omersiar

The tag's UID in your case is "05 88 72 45" for the 1st tag you read, and "64 24 95 5B" for the 2nd. That is because MIFARE 1KB has 4 bytes-long UIDs.

If you still are interested of this reader, I've done this library: https://github.com/dalmirdasilva/ArduinoRadioFrequencyIdentification

There are a bunch of examples you can use.

hi i have two device for read ID from RFID tag 1.Arduino Mega R3

2.RFID USB reader Detail Info: https://www.aliexpress.com/item/New-Version-13-56MHz-RFID-Reader-USB-Proximity-Sensor-Smart-Card-NFC-Reader-Variety-Format-No/32613760414.html?spm=2114.40010208.4.36.oWtTdh (in This page has been said that it Read:First 10 digists of the RFID IC card (Factory original format)

Arduino detect tag and show uid: 193 207 40 13 but usb RFID reader Show 0220778433 how can edit Arduino code to show uid like usb reader?

Hello,

I have uno+wifi r3 atmega328p+esp8266 board
RFID Reader MFRC522

And I am trying for below simple code but m getting no output of it

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10 // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details
Serial.println(F(“Scan PICC to see UID, SAK, type, and data blocks…”));
}

void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}

// Dump debug info about the card; PICC_HaltA() is automatically called
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

wiring connection:

10 - SDA

13 - SCK

11 - MOSI

12 - MISO

UNUSED - IRQ
GND - GND
9 - RST
3.3V - 3.3V

Please help me with this situation