{"id":164031,"date":"2025-01-09T14:23:10","date_gmt":"2025-01-09T14:23:10","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=164031"},"modified":"2025-03-24T11:52:29","modified_gmt":"2025-03-24T11:52:29","slug":"esp8266-nodemcu-mfrc522-rfid-reader-arduino","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-mfrc522-rfid-reader-arduino\/","title":{"rendered":"ESP8266 NodeMCU with MFRC522 RFID Reader\/Writer (Arduino IDE)"},"content":{"rendered":"\n<p>Learn how to interface the MFRC522 RFID reader module with the ESP8266 NodeMCU board. You&#8217;ll learn how to get raw RFID data, get the RFID card UID, and add personal data to the RFID cards. We&#8217;ll use the <span class=\"rnthl rntliteral\">Arduino_MFRC522v2<\/span> library and the ESP8266 will be programmed using Arduino IDE.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 NodeMCU with MFRC522 RFID Reader\/Writer (Arduino IDE)\" class=\"wp-image-164033\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?w=1920&amp;quality=100&amp;strip=all&amp;ssl=1 1920w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?resize=1536%2C864&amp;quality=100&amp;strip=all&amp;ssl=1 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p>We have a similar guide for the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-mfrc522-rfid-reader-arduino\/\">ESP32 with MFRC522 RFID Reader\/Writer (Arduino IDE)<\/a><\/p>\n\n\n\n<p>In summary, in this tutorial we&#8217;ll cover:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#rfid-reader-writer-intro\" title=\"\">Introduction to the MFRC522 RFID Reader\/Writer<\/a><\/li>\n\n\n\n<li><a href=\"#MFRC522-RFID-pinout\" title=\"\">Wire the MFRC522 RFID Reader\/Writer module to the ESP8266<\/a><\/li>\n\n\n\n<li><a href=\"#raw-data\" title=\"Read RFID card raw data\">Read RFID card raw data<\/a><\/li>\n\n\n\n<li><a href=\"#read-uid\" title=\"\">Read the RFID card UID<\/a><\/li>\n\n\n\n<li><a href=\"#read-write-data\" title=\"\">Write\/Read personal data to and from the RFID card<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"rfid-reader-writer-intro\">MFRC522 RFID Reader\/Writer<\/h2>\n\n\n\n<p>In this tutorial, we&#8217;ll be using the MFRC522 RFID reader\/writer and that&#8217;s the one we recommend you getting to interface with the ESP8266.<\/p>\n\n\n\n<p>RFID means radio-frequency identification. RFID uses electromagnetic fields to transfer data over short distances and it&#8217;s useful to identify people, make transactions, etc. Some stores also use RFID tags on their products&#8217; labels to identify them.<\/p>\n\n\n\n<p>An RFID system needs tags and a reader:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Tags<\/strong>&nbsp;(proximity integrated circuit cards\u2014PICC) are attached to the object to be identified, in this example, we have a keychain and an electromagnetic card that come with the MFRC522 RFID Reader\/Writer module.  Each tag has a unique identification (UID).<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522-Card-Tags-Keychain.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"RFID MFRC522 Card Tags Keychain\" class=\"wp-image-163845\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522-Card-Tags-Keychain.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522-Card-Tags-Keychain.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Reader\/Writer <\/strong>(proximity coupling device\u2014PCD) is a two-way radio transmitter-receiver that sends a signal to the tag and reads its response.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Reader Writer RFID MFRC522 Module\" class=\"wp-image-163838\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>The MFRC522 RFID reader works at 3.3V and supports SPI and I2C communication protocols. The library we&#8217;re going to use to control the RFID reader supports both protocols, but we&#8217;ll be using the SPI.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n\n<p>Here&#8217;s a list of the required components for this project:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP8266&nbsp;<\/a>(read<a href=\"https:\/\/makeradvisor.com\/best-esp8266-wi-fi-development-board\/\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;Best ESP8266 boards comparison<\/a>)<\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mfrc522-rfid-reader\/\" target=\"_blank\" rel=\"noreferrer noopener\">MFRC522 RFID Reader\/Writer + tags<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noreferrer noopener\">Breadboard<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noreferrer noopener\">Jumper wires<\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<p>To learn more about the RFID reader with the Arduino read:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/security-access-using-mfrc522-rfid-reader-with-arduino\/\">Security Access using MFRC522 RFID Reader with Arduino<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing the&nbsp;Arduino_MFRC522v2 Library<\/h2>\n\n\n\n<p>For this tutorial, we&#8217;ll use the <span class=\"rnthl rntliteral\">MFRC522v2.h<\/span> library to control the RFID reader. In the Arduino IDE, go to\u00a0<strong>Sketch\u00a0<\/strong>> I<strong>nclude Library<\/strong>\u00a0>\u00a0<strong>Manage Libraries<\/strong>\u00a0or click on the Library Manager icon at the left sidebar.<\/p>\n\n\n\n<p>Search for <strong>MFRC522v2<\/strong> and install the library by GithubCommunity.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"319\" height=\"348\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Installing-RFID-MFRC522v2-Library-Arduino-IDE.png?resize=319%2C348&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing RFID MFRC522v2 Library Arduino IDE\" class=\"wp-image-163709\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Installing-RFID-MFRC522v2-Library-Arduino-IDE.png?w=319&amp;quality=100&amp;strip=all&amp;ssl=1 319w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Installing-RFID-MFRC522v2-Library-Arduino-IDE.png?resize=275%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 275w\" sizes=\"(max-width: 319px) 100vw, 319px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"MFRC522-RFID-pinout\">MFRC522 RFID Reader\/Writer Pinout and Wiring to the ESP8266 NodeMCU<\/h2>\n\n\n\n<p>We&#8217;ll connect the MFRC522 RFID Reader using the ESP8266 NodeMCU default SPI pins. You can use the following table.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Board-Circuit.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Reader Writer RFID MFRC522 Module ESP8266 NodeMCU Board Circuit\" class=\"wp-image-163842\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Board-Circuit.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Board-Circuit.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th class=\"has-text-align-left\" data-align=\"left\">MFRC522 RFID Reader<\/th><th class=\"has-text-align-left\" data-align=\"left\">ESP8266<\/th><td><strong>Description<\/strong><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">SDA<\/td><td class=\"has-text-align-left\" data-align=\"left\">GPIO 15 (D8)<\/td><td>SPI signal input, I2C data line, or UART data input<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">SCK<\/td><td class=\"has-text-align-left\" data-align=\"left\">GPIO 14 (D5)<\/td><td>SPI clock<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">MOSI<\/td><td class=\"has-text-align-left\" data-align=\"left\">GPIO 13 (D7)<\/td><td>SPI data input<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">MISO<\/td><td class=\"has-text-align-left\" data-align=\"left\">GPIO 12 (D6)<\/td><td>SPI master-in-slave-out, I2C serial clock, or UART serial output<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">IRQ<\/td><td class=\"has-text-align-left\" data-align=\"left\">Don&#8217;t connect<\/td><td>Interrupt pin; signals the microcontroller when an RFID tag is nearby<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">GND<\/td><td class=\"has-text-align-left\" data-align=\"left\">GND<\/td><td><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">RST<\/td><td class=\"has-text-align-left\" data-align=\"left\">GPIO 0 (D3)<\/td><td>LOW signal to put the module in power-down mode; send a HIGH signal to reset the module<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\">3.3V<\/td><td class=\"has-text-align-left\" data-align=\"left\">3.3V<\/td><td>Power supply (2.5-3.3V)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Note:<\/strong> this library is also compatible with the ESP32, Arduino, and other boards. If you are using a different board, you can check the recommended <a href=\"https:\/\/github.com\/osSLibraries\/Arduino_MFRC522v2\/?tab=readme-ov-file#pin-layout\" target=\"_blank\" rel=\"noopener\" title=\"\">library pin assigment<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"raw-data\">Read RFID Card Raw Data \u2013 Code<\/h2>\n\n\n\n<p>The following example reads raw data from the RFID tag. With this example, you&#8217;ll better understand how data is stored on the MIFARE 1K tags.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n  Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-nodemcu-mfrc522-rfid-reader-arduino\/\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.  \n  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n*\/\n\n#include &lt;MFRC522v2.h&gt;\n#include &lt;MFRC522DriverSPI.h&gt;\n\/\/#include &lt;MFRC522DriverI2C.h&gt;\n#include &lt;MFRC522DriverPinSimple.h&gt;\n#include &lt;MFRC522Debug.h&gt;\n\n\/\/ Learn more about using SPI\/I2C or check the pin assigment for your board: https:\/\/github.com\/OSSLibraries\/Arduino_MFRC522v2#pin-layout\nMFRC522DriverPinSimple ss_pin(15);\n\nMFRC522DriverSPI driver{ss_pin}; \/\/ Create SPI driver\n\/\/MFRC522DriverI2C driver{};     \/\/ Create I2C driver\nMFRC522 mfrc522{driver};         \/\/ Create MFRC522 instance\n\nvoid setup() {\n  Serial.begin(115200);  \/\/ Initialize serial communication\n  while (!Serial);       \/\/ Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4).\n  \n  mfrc522.PCD_Init();    \/\/ Init MFRC522 board.\n  MFRC522Debug::PCD_DumpVersionToSerial(mfrc522, Serial);\t\/\/ Show details of PCD - MFRC522 Card Reader details.\n  Serial.println(F(&quot;Scan PICC to see UID, SAK, type, and data blocks...&quot;));\n}\n\nvoid loop() {\n  \/\/ Reset the loop if no new card present on the sensor\/reader. This saves the entire process when idle.\n  if (!mfrc522.PICC_IsNewCardPresent()) {\n    return;\n  }\n\n  \/\/ Select one of the cards.\n  if (!mfrc522.PICC_ReadCardSerial()) {\n    return;\n  }\n\n  \/\/ Dump debug info about the card; PICC_HaltA() is automatically called.\n  MFRC522Debug::PICC_DumpToSerial(mfrc522, Serial, &amp;(mfrc522.uid));\n\n  delay(2000);\n}<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_RFID\/RFID_Read_Raw_Data.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>After wiring the circuit, upload the previous code to your board.<\/p>\n\n\n\n<p>After uploading, open the Serial Monitor at a baud rate of 115200. Approximate your tag to the reader and see the tag info being displayed.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Card-Reader-Keychain.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Reader Writer RFID MFRC522 Module ESP8266 NodeMCU Card Reader Keychain\" class=\"wp-image-163843\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Card-Reader-Keychain.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Card-Reader-Keychain.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>It displays the card UID, the tag type, and the memory blocks. The tag is of type MIFARE with 1KB of memory.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"708\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Sectors-Blocks-UID-Dumpinfo-Card-Arduino-IDE.png?resize=777%2C708&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"RFID MFRC522v2 Library Read Sectors Blocks UID Dumpinfo Card Arduino IDE Demonstration\" class=\"wp-image-163716\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Sectors-Blocks-UID-Dumpinfo-Card-Arduino-IDE.png?w=777&amp;quality=100&amp;strip=all&amp;ssl=1 777w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Sectors-Blocks-UID-Dumpinfo-Card-Arduino-IDE.png?resize=300%2C273&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Sectors-Blocks-UID-Dumpinfo-Card-Arduino-IDE.png?resize=768%2C700&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/figure><\/div>\n\n\n<p>Here are some essential aspects you need to take into account about how data is stored on the MIFARE 1K tag.<\/p>\n\n\n\n<p><strong>Memory Layout<\/strong><\/p>\n\n\n\n<p>The memory is organized into 16 sectors (0 to 15), and each sector is divided into 4 blocks (0 to 3), which gives a total of 64 blocks. Each block can store 16 bytes of data (0 to 15).<\/p>\n\n\n\n<p><strong>Manufacturer Block<\/strong><\/p>\n\n\n\n<p>Sector 0, block 0 stores the UID (first 4 bytes), a CRC check byte, and manufacturer data. This is read-only and cannot be changed (except on UID-changeable cards). As you can see from the results in the Serial Monitor, the UUID of our tag is <strong>82 72 9F 0B<\/strong>.<\/p>\n\n\n\n<p><strong>Memory Storage and the Sector Trailer<\/strong><\/p>\n\n\n\n<p>The first three blocks of each sector can be used for storing data. The last block of each sector is a <strong>sector trailer<\/strong>. This sector trailer stores the 2 keys or passwords and controls access to the rest of the blocks in the sector. For example, block number 7 controls block 4, 5 and 6). You should not write on these sectors, otherwise, you&#8217;ll probably brick your card and it will become unusable.<\/p>\n\n\n\n<p>In summary, the Mifare 1K cards have a net storage capacity of:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(16 sectors\/card x 3 data blocks\/sector X 16 bytes\/block) - 16 bytes (first block) = 752 bytes\/card<\/code><\/pre>\n\n\n\n<p>There are 16 sectors with 4 blocks each (64 blocks total). Each block is 16 bytes, giving 1024 bytes in total (1 KB). However, 16 blocks (one in each sector) are sector trailers that store access keys and permissions, not user data. This leaves 48 blocks available for user data. Subtracting 16 bytes for the read-only manufacturer block (Sector 0, Block 0), the effective user storage is 752 bytes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"read-uid\">Read the RFID Card UID \u2013 Code<\/h2>\n\n\n\n<p>The following example only reads the UID of the RFID tag. This can be useful if you just want to identify the card without caring about the rest of the stored data.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n  Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-nodemcu-mfrc522-rfid-reader-arduino\/\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.  \n  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n*\/\n\n#include &lt;MFRC522v2.h&gt;\n#include &lt;MFRC522DriverSPI.h&gt;\n\/\/#include &lt;MFRC522DriverI2C.h&gt;\n#include &lt;MFRC522DriverPinSimple.h&gt;\n#include &lt;MFRC522Debug.h&gt;\n\n\/\/ Learn more about using SPI\/I2C or check the pin assigment for your board: https:\/\/github.com\/OSSLibraries\/Arduino_MFRC522v2#pin-layout\nMFRC522DriverPinSimple ss_pin(15);\n\nMFRC522DriverSPI driver{ss_pin}; \/\/ Create SPI driver\n\/\/MFRC522DriverI2C driver{};     \/\/ Create I2C driver\nMFRC522 mfrc522{driver};         \/\/ Create MFRC522 instance\n\nvoid setup() {\n  Serial.begin(115200);  \/\/ Initialize serial communication\n  while (!Serial);       \/\/ Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4).\n  \n  mfrc522.PCD_Init();    \/\/ Init MFRC522 board.\n  MFRC522Debug::PCD_DumpVersionToSerial(mfrc522, Serial);\t\/\/ Show details of PCD - MFRC522 Card Reader details.\n\tSerial.println(F(&quot;Scan PICC to see UID&quot;));\n}\n\nvoid loop() {\n\t\/\/ Reset the loop if no new card present on the sensor\/reader. This saves the entire process when idle.\n\tif (!mfrc522.PICC_IsNewCardPresent()) {\n\t\treturn;\n\t}\n\n\t\/\/ Select one of the cards.\n\tif (!mfrc522.PICC_ReadCardSerial()) {\n\t\treturn;\n\t}\n\n  Serial.print(&quot;Card UID: &quot;);\n  MFRC522Debug::PrintUID(Serial, (mfrc522.uid));\n  Serial.println();\n\n  \/\/ Save the UID on a String variable\n  String uidString = &quot;&quot;;\n  for (byte i = 0; i &lt; mfrc522.uid.size; i++) {\n    if (mfrc522.uid.uidByte[i] &lt; 0x10) {\n      uidString += &quot;0&quot;; \n    }\n    uidString += String(mfrc522.uid.uidByte[i], HEX);\n  }\n  Serial.println(uidString);\n}<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_RFID\/RFID_Read_UID.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This code is quite simple to understand. First, you initialize the reader on the <span class=\"rnthl rntliteral\">setup()<\/span>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>mfrc522.PCD_Init();    \/\/ Init MFRC522 board.\nMFRC522Debug::PCD_DumpVersionToSerial(mfrc522, Serial);\t\/\/ Show details of PCD - MFRC522 Card Reader details.\nSerial.println(F(\"Scan PICC to see UID\"));<\/code><\/pre>\n\n\n\n<p>Then, in the <span class=\"rnthl rntliteral\">loop()<\/span>, check if there is a card present.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Reset the loop if no new card present on the sensor\/reader. This saves the entire process when idle.\nif (!mfrc522.PICC_IsNewCardPresent()) {\n  return;\n}<\/code><\/pre>\n\n\n\n<p>If so, read the card.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Select one of the cards.\nif (!mfrc522.PICC_ReadCardSerial()) {\n  return;\n}<\/code><\/pre>\n\n\n\n<p>Finally, print the UID and save it on a variable.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>  Serial.print(\"Card UID: \");\n  MFRC522Debug::PrintUID(Serial, (mfrc522.uid));\n  Serial.println();\n\n  \/\/ Save the UID on a String variable\n  String uidString = \"\";\n  for (byte i = 0; i &lt; mfrc522.uid.size; i++) {\n    if (mfrc522.uid.uidByte&#091;i] &lt; 0x10) {\n      uidString += \"0\"; \n    }\n    uidString += String(mfrc522.uid.uidByte&#091;i], HEX);\n  }\n  Serial.println(uidString);\n}<\/code><\/pre>\n\n\n\n<p>Upload the code to your board. Open the Serial Monitor at a baud rate of 115200.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Reading-Card.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Reader Writer RFID MFRC522 Module ESP8266 NodeMCU Reading Card\" class=\"wp-image-163844\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Reading-Card.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Reader-Writer-RFID-MFRC522-Module-ESP8266-NodeMCU-Reading-Card.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Swipe different tags on the reader and see their unique UID being printed.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"274\" height=\"453\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Read-RFID-Card-UID-MFRC522-Arduino-IDE-Demonstration-Example.png?resize=274%2C453&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Read RFID Card UID MFRC522 Arduino IDE Demonstration Example\" class=\"wp-image-163798\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Read-RFID-Card-UID-MFRC522-Arduino-IDE-Demonstration-Example.png?w=274&amp;quality=100&amp;strip=all&amp;ssl=1 274w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/Read-RFID-Card-UID-MFRC522-Arduino-IDE-Demonstration-Example.png?resize=181%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 181w\" sizes=\"(max-width: 274px) 100vw, 274px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"read-write-data\">Write\/Read Personal Data to and from the RFID Card \u2013 Code<\/h2>\n\n\n\n<p>In this example, we&#8217;ll show you how to write custom data on specific blocks. Then, we&#8217;ll also show you how to read the data from those same blocks.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n  Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp8266-nodemcu-mfrc522-rfid-reader-arduino\/\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.  \n  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n*\/\n\n#include &lt;MFRC522v2.h&gt;\n#include &lt;MFRC522DriverSPI.h&gt;\n\/\/#include &lt;MFRC522DriverI2C.h&gt;\n#include &lt;MFRC522DriverPinSimple.h&gt;\n#include &lt;MFRC522Debug.h&gt;\n\n\/\/ Learn more about using SPI\/I2C or check the pin assigment for your board: https:\/\/github.com\/OSSLibraries\/Arduino_MFRC522v2#pin-layout\nMFRC522DriverPinSimple ss_pin(15);\n\nMFRC522DriverSPI driver{ss_pin}; \/\/ Create SPI driver\n\/\/MFRC522DriverI2C driver{};     \/\/ Create I2C driver\nMFRC522 mfrc522{driver};         \/\/ Create MFRC522 instance\n\nMFRC522::MIFARE_Key key;\n\nbyte blockAddress = 2;\nbyte newBlockData[17] = {&quot;Rui Santos - RNT&quot;};\n\/\/byte newBlockData[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};   \/\/ CLEAR DATA\nbyte bufferblocksize = 18;\nbyte blockDataRead[18];\n\nvoid setup() {\n  Serial.begin(115200);  \/\/ Initialize serial communication\n  while (!Serial);       \/\/ Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4).\n  \n  mfrc522.PCD_Init();    \/\/ Init MFRC522 board.\n  Serial.println(F(&quot;Warning: this example overwrites a block in your card, use with care!&quot;));\n \n  \/\/ Prepare key - all keys are set to FFFFFFFFFFFF at chip delivery from the factory.\n  for (byte i = 0; i &lt; 6; i++) {\n    key.keyByte[i] = 0xFF;\n  }\n}\n\nvoid loop() {\n  \/\/ Check if a new card is present\n  if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {\n    delay(500);\n    return;\n  }\n\n  \/\/ Display card UID\n  Serial.print(&quot;----------------\\nCard UID: &quot;);\n  MFRC522Debug::PrintUID(Serial, (mfrc522.uid));\n  Serial.println();\n\n  \/\/ Authenticate the specified block using KEY_A = 0x60\n  if (mfrc522.PCD_Authenticate(0x60, blockAddress, &amp;key, &amp;(mfrc522.uid)) != 0) {\n    Serial.println(&quot;Authentication failed.&quot;);\n    return;\n  }\n  \n  \/\/ Write data to the specified block\n  if (mfrc522.MIFARE_Write(blockAddress, newBlockData, 16) != 0) {\n    Serial.println(&quot;Write failed.&quot;);\n  } else {\n    Serial.print(&quot;Data written successfully in block: &quot;);\n    Serial.println(blockAddress);\n  }\n\n  \/\/ Authenticate the specified block using KEY_A = 0x60\n  if (mfrc522.PCD_Authenticate(0x60, blockAddress, &amp;key, &amp;(mfrc522.uid)) != 0) {\n    Serial.println(&quot;Authentication failed.&quot;);\n    return;\n  }\n\n  \/\/ Read data from the specified block\n  if (mfrc522.MIFARE_Read(blockAddress, blockDataRead, &amp;bufferblocksize) != 0) {\n    Serial.println(&quot;Read failed.&quot;);\n  } else {\n    Serial.println(&quot;Read successfully!&quot;);\n    Serial.print(&quot;Data in block &quot;);\n    Serial.print(blockAddress);\n    Serial.print(&quot;: &quot;);\n    for (byte i = 0; i &lt; 16; i++) {\n      Serial.print((char)blockDataRead[i]);  \/\/ Print as character\n    }\n    Serial.println();\n  }\n  \n  \/\/ Halt communication with the card\n  mfrc522.PICC_HaltA();\n  mfrc522.PCD_StopCrypto1();\n\n  delay(2000);  \/\/ Delay for readability\n}<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_RFID\/RFID_Write_Read_Personal_Data.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How Does the Code Work?<\/h3>\n\n\n\n<p>We start by including the necessary libraries to set up the RFID reader. <\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>#include &lt;MFRC522v2.h&gt;\n#include &lt;MFRC522DriverSPI.h&gt;\n\/\/#include &lt;MFRC522DriverI2C.h&gt;\n#include &lt;MFRC522DriverPinSimple.h&gt;\n#include &lt;MFRC522Debug.h&gt;<\/code><\/pre>\n\n\n\n<p>It defines the CS (Chip Select) pin as pin 15, which will be used for SPI communication with the reader.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Learn more about using SPI\/I2C or check the pin assigment for your board: https:\/\/github.com\/OSSLibraries\/Arduino_MFRC522v2#pin-layout\nMFRC522DriverPinSimple ss_pin(15);\n\nMFRC522DriverSPI driver{ss_pin}; \/\/ Create SPI driver\n\/\/MFRC522DriverI2C driver{};     \/\/ Create I2C driver\nMFRC522 mfrc522{driver};         \/\/ Create MFRC522 instance\n\nMFRC522::MIFARE_Key key;<\/code><\/pre>\n\n\n\n<p>Then, we define a variable called <span class=\"rnthl rntliteral\">blockAddress<\/span>. This specifies the block on the RFID tag where data will be written or read. In this example, <span class=\"rnthl rntliteral\">blockAddress<\/span> is set to 2, which means the code will interact with block 2 of the card&#8217;s memory. You can change this value if you want to write to a different block.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>byte blockAddress = 2;<\/code><\/pre>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important:<\/strong> the last block of each sector is a <strong>sector trailer<\/strong>. You should not write on that sector, otherwise, you&#8217;ll probably brick your card.<\/p>\n\n\n\n<p>Next, <span class=\"rnthl rntliteral\">newBlockData[17]<\/span> holds the data you want to write to the card. Right now, it\u2019s set to <span class=\"rnthl rntliteral\">Rui Santos &#8211; RNT<\/span>, but you can change it. Make sure it is no longer than 16 bytes.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>byte newBlockData&#091;17] = {\"Rui Santos - RNT\"};<\/code><\/pre>\n\n\n\n<p>If you want to clear the block data, you can pass the following bytes array:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>byte newBlockData&#091;16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};<\/code><\/pre>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">setup()<\/span>, initialize the  MFRC522 module.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>mfrc522.PCD_Init();    \/\/ Init MFRC522 board.<\/code><\/pre>\n\n\n\n<p>The default key for the RFID card is also set on the following lines. By default, all bytes are <span class=\"rnthl rntliteral\">0xFF<\/span> for the factory key. This key allows access to the card&#8217;s data blocks.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Prepare key - all keys are set to FFFFFFFFFFFF at chip delivery from the factory.\nfor (byte i = 0; i &lt; 6; i++) {\n  key.keyByte&#091;i] = 0xFF;\n}<\/code><\/pre>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">loop()<\/span> checks if a new RFID card is detected. If a card is present, it reads and displays the card&#8217;s UID.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {\n  delay(500);\n  return;\n}\n\n\/\/ Display card UID\nSerial.print(\"----------------\\nCard UID: \");\nMFRC522Debug::PrintUID(Serial, (mfrc522.uid));\nSerial.println();<\/code><\/pre>\n\n\n\n<p>Next, the code tries to authenticate a specific block on the card using the default key (in this case, block 2). <\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Authenticate the specified block using KEY_A = 0x60\nif (mfrc522.PCD_Authenticate(0x60, blockAddress, &amp;key, &amp;(mfrc522.uid)) != 0) {\n  Serial.println(\"Authentication failed.\");\n  return;\n}<\/code><\/pre>\n\n\n\n<p><strong>Note:<\/strong> <span class=\"rnthl rntliteral\">0x60<\/span> is a command that specifies the use of <span class=\"rnthl rntliteral\">KEY_A<\/span> to authenticate. <span class=\"rnthl rntliteral\">KEY_A<\/span> is one of two keys (<span class=\"rnthl rntliteral\">KEY_A<\/span> and <span class=\"rnthl rntliteral\">KEY_B<\/span>) available on RFID cards, each offering different permissions. Using <span class=\"rnthl rntliteral\">0x60<\/span> means the code is attempting to authenticate with <span class=\"rnthl rntliteral\">KEY_A<\/span>, which by default is <span class=\"rnthl rntliteral\">0xFF 0xFF 0xFF 0xFF 0xFF<\/span> on MIFARE RFID cards.<\/p>\n\n\n\n<p>If authentication is successful, it writes some data (saved on the <span class=\"rnthl rntliteral\">newBlockData<\/span>) to that block. <\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Write data to the specified block\nif (mfrc522.MIFARE_Write(blockAddress, newBlockData, 16) != 0) {\n  Serial.println(\"Write failed.\");\n} else {\n  Serial.print(\"Data written successfully in block: \");\n  Serial.println(blockAddress);\n}<\/code><\/pre>\n\n\n\n<p>After writing, it reads the data back from the block and prints it to the Serial Monitor.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Read data from the specified block\nif (mfrc522.MIFARE_Read(blockAddress, blockDataRead, &amp;bufferblocksize) != 0) {\n  Serial.println(\"Read failed.\");\n} else {\n  Serial.println(\"Read successfully!\");\n  Serial.print(\"Data in block \");\n  Serial.print(blockAddress);\n  Serial.print(\": \");\n  for (byte i = 0; i &lt; 16; i++) {\n    Serial.print((char)blockDataRead&#091;i]);  \/\/ Print as character\n  }\n  Serial.println();\n}<\/code><\/pre>\n\n\n\n<p>Finally, the code halts communication with the card and stops encryption.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Halt communication with the card\nmfrc522.PICC_HaltA();\nmfrc522.PCD_StopCrypto1();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Testing the Example<\/h3>\n\n\n\n<p>In this example, we stored the following personal data &#8220;Rui Santos &#8211; RNT&#8221; in block number 2 on two different RFID cards.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"336\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Personal-Data-Sectors-Blocks-Arduino-IDE-Example-Demonstration.png?resize=591%2C336&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"RFID MFRC522v2 Library Read Personal Data Sectors Blocks Arduino IDE Demonstration\" class=\"wp-image-163789\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Personal-Data-Sectors-Blocks-Arduino-IDE-Example-Demonstration.png?w=591&amp;quality=100&amp;strip=all&amp;ssl=1 591w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Read-Personal-Data-Sectors-Blocks-Arduino-IDE-Example-Demonstration.png?resize=300%2C171&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Other Useful Examples<\/h2>\n\n\n\n<p>There are few examples that come with the <span class=\"rnthl rntliteral\">Arduino_MFRC522v2<\/span> library that might be helpful. In the <em>Hack<\/em> submenu, you can find the <em>ChangeUID <\/em>and <em>FixBrickedUID <\/em>examples.<\/p>\n\n\n\n<p><strong>Important:<\/strong> most RFID cards don&#8217;t allow you to modify the UID. This code only works on specific MIFARE Classic cards that have a writable UID block. Most RFID cards have the UID set as read-only, so if you try to change the UID it won\u2019t work.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"342\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Examples-Arduino-IDE.png?resize=660%2C342&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"RFID MFRC522v2 Library Examples Arduino IDE\" class=\"wp-image-163710\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Examples-Arduino-IDE.png?w=660&amp;quality=100&amp;strip=all&amp;ssl=1 660w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/RFID-MFRC522v2-Library-Examples-Arduino-IDE.png?resize=300%2C155&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 660px) 100vw, 660px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this guide, you learned how to interface the MFRC522 RFID Reader\/Writer module with the ESP8266. We&#8217;ve taken a look at how storage on Mifare 1K cards works and how to dump the information of the cards. We also learned how to get the card UID, write new data on a specific block and how to read data from a specific block.<\/p>\n\n\n\n<p>We hope you found this guide for the ESP8266 with MFRC522 RFID Reader\/Writer useful. We have a similar guide for the Arduino board:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/security-access-using-mfrc522-rfid-reader-with-arduino\/\">Security Access using MFRC522 RFID Reader with Arduino<\/a><\/li>\n<\/ul>\n\n\n\n<p>If you would like to learn more about the ESP8266, and for inspiration for new projects, make sure to take a look at our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\">Home Automation Using ESP8266 (eBook)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp8266\/\">Free ESP8266 NodeMCU Projects and Tutorials<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to interface the MFRC522 RFID reader module with the ESP8266 NodeMCU board. You&#8217;ll learn how to get raw RFID data, get the RFID card UID, and add personal &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP8266 NodeMCU with MFRC522 RFID Reader\/Writer (Arduino IDE)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-mfrc522-rfid-reader-arduino\/#more-164031\" aria-label=\"Read more about ESP8266 NodeMCU with MFRC522 RFID Reader\/Writer (Arduino IDE)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":164033,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[265,214,246,300,240,264],"tags":[],"class_list":["post-164031","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp8266-project","category-esp8266","category-esp8266-arduino-ide","category-0-esp8266","category-esp8266-projects","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/11\/ESP8266-RFID-Reader-Writer-Tutorial.jpg?fit=1920%2C1080&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/164031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=164031"}],"version-history":[{"count":6,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/164031\/revisions"}],"predecessor-version":[{"id":168260,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/164031\/revisions\/168260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/164033"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=164031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=164031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=164031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}