2.2.10 MFRC522 RFID Module¶
Radio Frequency Identification (RFID) refers to technologies that use wireless communication between an object (or tag) and interrogating device (or reader) to automatically track and identify such objects.
Some of the most common applications for this technology include retail supply chains, military supply chains, automated payment methods, baggage tracking and management, document tracking and pharmaceutical management, to name a few.
In this project, we will use RFID for reading and writing.
In this project, we need the following components.
It’s definitely convenient to buy a whole kit, here’s the link:
ITEMS IN THIS KIT
You can also buy them separately from the links below.
Step 1: Build the circuit.
Step 2: Set up SPI (refer to SPI Configuration for more details. If you have set SPI, skip this step.)
Step 3: Go to the folder of the code.
Step 4: Compile the code.
make read make write
Step 5: After running
./write, enter the information, such as the name of the person, and then put the tag or card on the MRC522 module and wait for the writing to be completed.
Step 6: Now run
./read to read the information of the tag or card you have written.
If it does not work after running, or there is an error prompt: "wiringPi.h: No such file or directory", please refer to Install and Check the WiringPi.
This function is used to initialize the RFID RC522 module.
This function is used to read the data of the card, and if the read is successful, it will return “1”.
uint8_t write_card_data(uint8_t *data);
This function is used to write the data of card and returns “1” if
the write is successful.
*data is the information that will be written
to the card.