🐞 Tutorial 33 - MFRC522 Module

The MFRC522 Module is a highly integrated RFID reader/writer module that operates at 13.56 MHz frequency and supports ISO/IEC 14443 A/MIFARE mode. It is commonly used in access control systems, contactless payment systems, and other applications that require wireless communication.

The MFRC522 Module includes an integrated circuit that performs all the necessary functions for RFID communication, including modulation and demodulation of the radio frequency signals, data encoding and decoding, and security features such as encryption and authentication.

The MFRC522 Module communicates with a microcontroller or other device using a SPI interface and provides information about the detected RFID tag or card, including its unique identification number (UID), type, and other data. It also includes a built-in antenna for wireless communication and supports up to 100 mm reading distance.

The MFRC522 Module is easy to use and can be integrated into electronic projects using a variety of programming languages, including C, C++, and Python. It is cost-effective and provides a reliable and secure way to communicate wirelessly with RFID tags and cards.

Overall, the MFRC522 Module is a versatile and widely-used RFID reader/writer module that provides a simple and effective way to communicate wirelessly with RFID tags and cards. Its ease of use and compatibility with a wide range of devices make it a popular choice for hobbyists and professionals alike.

Components Needed

ComponentQuantity
Raspberry Pi Pico W1
Micro USB Cable1
Breadboard1
WiresSeveral
RC522 RFID Module1

Fritzing Diagram

Code

from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522(spi_id=0,sck=2,miso=4,mosi=3,cs=5,rst=0)

def write():
    to_write = input("Please enter the message: ")
    print("Writing...Please place the card...")
    id, text = reader.write(to_write)
    print("ID: %s\nText: %s" % (id,text))

write()

Reading Data

from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522(spi_id=0,sck=2,miso=4,mosi=3,cs=5,rst=0)

def read():
    print("Reading...Please place the card...")
    id, text = reader.read()
    print("ID: %s\nText: %s" % (id,text))

read()

Code Explanation