MFRC522 Module

From ElecFreaks
Jump to: navigation, search


It is an contactless reader module based on the MFRC522 from NXP B.V.. Communication Via Serial makes it simple and easy-using. Compatible with ISO/IEC 14443 A/MIFARE cards, it supports all variants of the MIFARE Mini, MIFARE 1K, MIFARE 4K, MIFARE Ultralight, MIFARE DESFire EV1 and MIFARE Plus RF identification protocols, and the operating distance in Read/Write mode is up to 40 mm.

This module could be used in a variety of applications: Access management, Tracking of goods, Tracking of persons and animals, Toll collection and contactless payment, Machine readable travel documents, Smartdust (for massively distributed sensor networks), Tracking sports memorabilia to verify authenticity, Airport baggage tracking logistics and etc.

Model: EF03041

MFRC522 Module A.JPGMFRC522 Module B.JPGMFRC522 Module C.JPG


  • Power supply 3.3 V/5V
  • Support ISO/IEC 14443 A/MIFARE
  • Support mifare1 S50、mifare1 S70、mifare UltraLight、mifare Pro、mifare Desfire
  • Operating distance in Read/Write mode up to 40 mm
  • FIFO buffer handles 64 byte send and receive
  • SPI interface
  • Working current 13~26mA
  • Idle current 10—13mA
  • Working temperature -25 ~ 85℃
  • Size 71.00mm×40.90mm


  • MFRC522 IC working voltage of 3.3V, the power to the module, do not mistake the input voltage!


  • Production progress tracking,warehouse stock tracking
  • Personal identification
  • Car transponder
  • Access Control System


MFRC522 Module D.JPG


Interface Function

MFRC522 Module E.JPG


MFRC522 Module F.JPG

MFRC522 Module G.JPG

Hardware Installation

  • Details

1.MFRC522 Module

2.Jumper Wire

3.Arduino mainboard

4.USB Cable

5.S50 Induction IC Card

6.Clear Card



2.Arduino IDE(1.0.5)

Part 1 Download Arduino RFID 522 CODE to Arduino IDE

1. Download the file of ”Arduino_RFID_522_CODE” from our official website

2. Open ”Arduino_RFID_522_CODE”, and enter into Arduino IDE(1.0.5), the screen like below would occur, then compile and upload the code.

MFRC522 Module I.JPG

Note: The content in the red circle would remind you that when using Arduino UNO or MEGA 2560 mainboard to test, you need to modify the chipSelectPin into the corresponding pin.

Part 2 MFRC522 Module and Arduino UNO Wiring Way

Step 1. Wiring diagram

MFRC522 Module J.JPG
MFRC522 Module K.JPG

Step 2. Compile and run the Arduino(1.0.5)IDE code

Compile and run the program in Arduino(1.0.5)IDE. After upload succeed, open the serial port, then place the S50IC induction card or clear card within the induction area of the module, you would see the display effect as follows.

Running effect as below:

MFRC522 Module L.JPG


Includes important code snippet. Demo code like : Paintcode

void setup() {                
   Serial.begin(9600);                       // RFID reader SOUT pin connected to Serial RX pin at 960bps 
 // start the SPI library:
  pinMode(chipSelectPin,OUTPUT);             // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin 
    digitalWrite(chipSelectPin, LOW);          // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);               // Set digital pin 10 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

   Serial.println("Please put the IC card in the antenna inductive zone! ");

void loop()
  	uchar i,tmp;
	uchar status;
        uchar str[MAX_LEN];
        uchar RC_size;
        uchar blockAddr;	//选择操作的块地址0~63

		status = MFRC522_Request(PICC_REQIDL, str);	
		if (status == MI_OK)

		//防冲撞,返回卡的序列号 4字节
		status = MFRC522_Anticoll(str);
		memcpy(serNum, str, 5);
		if (status == MI_OK)
                        Serial.println("The card's number is  : ");
                        Serial.println(" ");

		RC_size = MFRC522_SelectTag(serNum);
		if (RC_size != 0)
		blockAddr = 7;		//数据块7		
		status = MFRC522_Auth(PICC_AUTHENT1A, blockAddr, sectorKeyA[blockAddr/4], serNum);	//认证
		if (status == MI_OK)
			status = MFRC522_Write(blockAddr, sectorNewKeyA[blockAddr/4]);
                        Serial.print("set the new card password, and can modify the data of the Sector: ");
                        blockAddr = blockAddr - 3 ; 
                        status = MFRC522_Write(blockAddr, writeDate);
                        if(status == MI_OK)

		blockAddr = 7;		//数据块7		
		status = MFRC522_Auth(PICC_AUTHENT1A, blockAddr, sectorNewKeyA[blockAddr/4], serNum);	//认证
		if (status == MI_OK)
                        blockAddr = blockAddr - 3 ; 
                        status = MFRC522_Read(blockAddr, str);
			if (status == MI_OK)
                                Serial.println("Read from the card ,the data is : ");
				for (i=0; i<16; i++)
                                Serial.println(" ");
		MFRC522_Halt();			//命令卡片进入休眠状态              


The projects and application examples.

Version Tracker

Revision Descriptions Release
v0.9b Initial public release date

Bug Tracker

Bug Tracker is the place you can publish any bugs you think you might have found during use. Please write down what you have to say, your answers will help us improve our products.

Additional Idea

The Additional Idea is the place to write your project ideas about this product, or other usages you've found. Or you can write them on Projects page.


How to buy

Click here to buy:

See Also

Other related products and resources.


This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are licensed under GPL/LGPL, see source code files for details.

External Links

Links to external webpages which provide more application ideas, documents/datasheet or software libraries