Ugenz Academy/IoT Tutorial

Rfid Nfc And Identification

13 min read2,443 words

Reading progress

Keep learning

RFID, NFC and Identification Sensors

RFID and NFC are technologies used to identify objects, people, cards, tags, or devices wirelessly.

They are widely used in:

  • 🔐 Access-control systems
  • 🎓 Student attendance
  • 💳 Contactless payments
  • 🚪 Smart door locks
  • 🏪 Inventory management
  • 📦 Asset tracking
  • 🚗 Vehicle identification
  • 🏭 Industrial automation
  • 🏠 Smart-home systems
  • 🤖 Arduino/ESP32 projects

1 What Is RFID?

RFID = Radio Frequency Identification

RFID uses radio waves to communicate between a reader and a tag.

Basic system:

RFID TAG ┌─────────┐ │ DATA │ └────┬────┘ │ Radio Waves ↕ ┌─────────┐ │ RFID │ │ READER │ └────┬────┘ │ ESP32 │ ┌─────┴─────┐ ↓ ↓ Relay Display

The reader detects the tag and obtains information from it.


2 Main Components of an RFID System

An RFID system generally contains:

1. RFID Reader

The reader communicates with the tag.

2. RFID Tag

The tag contains identification information.

3. Antenna

The antenna enables radio communication.

4. Controller

A microcontroller such as:

  • Arduino
  • ESP32
  • ESP8266

processes the RFID data.


3 RFID Tag

An RFID tag can be:

  • Card
  • Key fob
  • Sticker
  • Wristband
  • Label
  • Embedded chip

Example:

RFID CARD ┌─────────────────┐ │ │ │ RFID │ │ │ │ ANTENNA │ │ │ └─────────────────┘

A tag may contain:

  • Unique identifier
  • Memory
  • Integrated circuit
  • Antenna

4 Passive RFID Tags

Passive tags don't normally contain their own battery.

The reader provides the energy needed for communication.

RFID Reader │ │ Radio energy ↓ RFID Tag │ │ Response ↓ RFID Reader

Advantages:

  • Small
  • Cheap
  • Long shelf life
  • No battery required

Common in:

  • Access cards
  • Inventory
  • ID cards
  • Library systems

5 Active RFID Tags

Active RFID tags contain their own battery.

Battery │ ↓ RFID electronics │ ↓ Antenna

They can generally support longer-range communication than passive tags, depending on the system.

Applications include:

  • Asset tracking
  • Vehicle tracking
  • Industrial systems

6 RFID Frequency Types

RFID systems operate at different frequency ranges.

Common categories include:

TypeTypical frequency
LF RFID~125–134 kHz
HF RFID13.56 MHz
UHF RFID~860–960 MHz

The exact allowed UHF range varies by region.


7 LF RFID

LF = Low Frequency

Common systems operate around:

125 kHz

Used in applications such as:

  • Animal identification
  • Simple access cards
  • Key fobs
  • Older access-control systems

Characteristics:

  • Short range
  • Relatively simple
  • Works well in some environments where higher frequencies can be problematic

8 HF RFID

HF = High Frequency

A very common frequency is:

13.56 MHz

HF RFID is important because many NFC systems also operate at 13.56 MHz.

Examples include:

  • MIFARE cards
  • NFC
  • Library cards
  • Access cards

The popular MFRC522 module works with 13.56 MHz RFID cards/tags.


9 UHF RFID

UHF RFID commonly operates around:

860–960 MHz

It can provide considerably longer read ranges than many low-frequency or HF systems.

Applications:

  • Warehouses
  • Supply chains
  • Inventory
  • Logistics
  • Retail

Example:

Warehouse ↓ UHF RFID Reader ↓ Many tagged products ↓ Inventory system

10 What Is NFC?

NFC = Near Field Communication

NFC is a short-range wireless communication technology operating at:

13.56 MHz

It is designed for very close-range communication.

Examples:

  • Tap-to-pay
  • Access cards
  • NFC tags
  • Smartphone interactions
  • Transit systems

11 RFID vs NFC

FeatureRFIDNFC
Main purposeIdentification/trackingShort-range communication
FrequencyVarious13.56 MHz
RangeDepends on RFID typeUsually very short
CommunicationOften reader ↔ tagCan support two-way communication
Smartphone supportDepends on hardwareCommon
ExampleInventory tagTap-to-pay

NFC is closely related to HF RFID, but RFID is the broader category.


12 RFID UID

Many RFID tags expose an identifier called a UID.

UID means:

Unique Identifier

Example:

UID: A3 7F 21 9C

Your Arduino/ESP32 can read the UID.

For example:

Card detected! UID: A3 7F 21 9C

The program can then compare it with authorized IDs.


13 RFID Access Control

A simple access-control system:

RFID Card ↓ RFID Reader ↓ ESP32 ↓ Check UID ↓ ┌──┴───┐ ↓ ↓ Valid Invalid ↓ ↓ Unlock Alarm

For example:

Authorized UID ↓ Servo rotates ↓ Door unlocked

14 MFRC522 RFID Module

The MFRC522 is one of the most popular RFID modules for Arduino and ESP32 projects.

It commonly supports:

  • 13.56 MHz RFID cards
  • MIFARE-compatible tags
  • SPI communication

Typical pins:

MFRC522Function
3.3VPower
GNDGround
RSTReset
SDA/SSSPI chip select
MOSISPI
MISOSPI
SCKSPI clock

The exact GPIO numbers depend on your ESP32 board.


15 MFRC522 + ESP32

A common ESP32 wiring example is:

MFRC522ESP32
3.3V3.3V
GNDGND
SCKGPIO 18
MISOGPIO 19
MOSIGPIO 23
SDA/SSGPIO 5
RSTGPIO 22
MFRC522 ESP32 ──────── ───── 3.3V ───────────────→ 3.3V GND ───────────────→ GND SCK ───────────────→ GPIO 18 MISO ───────────────→ GPIO 19 MOSI ───────────────→ GPIO 23 SDA ───────────────→ GPIO 5 RST ───────────────→ GPIO 22

Important: MFRC522 modules are typically operated at 3.3V logic. Do not treat the module as a 5V GPIO device.


16 Simple RFID Reading Flow

The program follows roughly this process:

Start ↓ Initialize RFID ↓ Check for card ↓ Card found? ├── No → Continue checking └── Yes ↓ Read UID ↓ Display UID ↓ Process action

17 Basic ESP32 RFID Code

Using the common MFRC522 library:

#include <SPI.h> #include <MFRC522.h> #define SS_PIN 5 #define RST_PIN 22 MFRC522 rfid(SS_PIN, RST_PIN); void setup() { Serial.begin(115200); SPI.begin(); rfid.PCD_Init(); Serial.println("RFID Reader Ready"); } void loop() { if (!rfid.PICC_IsNewCardPresent()) { return; } if (!rfid.PICC_ReadCardSerial()) { return; } Serial.print("UID: "); for (byte i = 0; i < rfid.uid.size; i++) { if (rfid.uid.uidByte[i] < 0x10) { Serial.print("0"); } Serial.print(rfid.uid.uidByte[i], HEX); Serial.print(" "); } Serial.println(); rfid.PICC_HaltA(); rfid.PCD_StopCrypto1(); delay(500); }

The Serial Monitor may show:

RFID Reader Ready UID: A3 7F 21 9C

18 RFID-Based Door Lock

Now we can connect a servo.

RFID Card ↓ MFRC522 ↓ ESP32 ↓ Check authorized UID / \ YES NO ↓ ↓ Servo Buzzer ↓ Door Open

Example:

Valid Card ↓ Servo → 90° ↓ Door unlocked ↓ Wait 3 seconds ↓ Servo → 0° ↓ Door locked

19 RFID Attendance System

RFID is also useful for attendance.

Student ↓ RFID Card ↓ Reader ↓ ESP32 ↓ Read UID ↓ Identify Student ↓ Record Date & Time

Database:

UID Name Date Time ------------------------------------------------ A3 7F 21 9C Uday 09-Oct 09:02 B2 18 91 44 Ram 09-Oct 09:05

The ESP32 can send the data over Wi-Fi to:

  • Firebase
  • Web server
  • Google Sheets through an appropriate backend
  • Custom database

20 RFID + Relay

Instead of a servo, RFID can control a relay.

RFID ↓ ESP32 ↓ Authorized? ↓ Relay ON ↓ Device ON

Possible applications:

  • Electronic lock
  • Access-controlled equipment
  • Lab equipment
  • Lighting
  • Automation

Electrical safety

If the relay controls mains voltage, use a properly rated relay module, enclosure, insulation, and safe mains wiring practices. For student projects, low-voltage loads are much safer.


21 RFID + OLED

An OLED can display status.

Example:

┌──────────────────┐ │ RFID ACCESS │ │ │ │ Scan Your Card │ └──────────────────┘

When valid:

┌──────────────────┐ │ ACCESS GRANTED │ │ │ │ Welcome Uday │ └──────────────────┘

Invalid:

┌──────────────────┐ │ ACCESS DENIED │ │ │ │ Unknown Card │ └──────────────────┘

22 RFID + Buzzer

A buzzer provides audio feedback.

Valid Card ↓ Short beep
Invalid Card ↓ Two/three beeps

Example:

VALID → Beep INVALID → Beep Beep

This makes an access-control system easier to use.


23 RFID + LED

You can also use LEDs:

🟢 Green → Access Granted 🔴 Red → Access Denied 🟡 Yellow → Waiting

System:

RFID ↓ ESP32 ┌─────┼─────┐ ↓ ↓ ↓ Green Red Buzzer

24 RFID Smart Door Project

A complete beginner project could use:

Components

  • ESP32
  • MFRC522
  • RFID cards
  • Servo
  • OLED
  • Green LED
  • Red LED
  • Buzzer

Architecture

RFID CARD ↓ MFRC522 ↓ ESP32 │ ┌──────────────┼──────────────┐ ↓ ↓ ↓ OLED Servo Buzzer │ │ │ Status Lock Sound │ ↓ Door

25 NFC Tags

NFC tags are small programmable tags.

Example:

NFC TAG ┌────────────┐ │ NFC │ │ DATA │ └────────────┘

They can store information such as:

  • URL
  • Text
  • Contact information
  • Configuration data

A smartphone can read an NFC tag when brought close to it.

Example:

NFC Tag ↓ Phone ↓ Open website

26 NFC Smart Poster

You could create an educational or business poster with an NFC tag.

Example:

┌─────────────────────────┐ │ │ │ U GENZ ACADEMY │ │ │ │ TAP YOUR PHONE │ │ HERE │ │ │ │ NFC │ │ │ └─────────────────────────┘

When the user taps the phone:

NFC ↓ Website ↓ Courses / Social Media / Contact

27 NFC vs QR Code

FeatureNFCQR Code
Physical contactNoNo
Camera requiredUsually noYes
CostTag requiredCan be printed
RewritableOftenDepends on destination
RangeVery shortCamera distance
ExampleTap phoneScan poster

Both are useful for smart information systems.


28 RFID in Inventory Management

Each product can have an RFID tag.

Product ↓ RFID Tag ↓ Reader ↓ Database

For example:

Product ID: 10021 Product: Arduino Uno Quantity: 15 Location: Shelf A

A warehouse can scan many tagged items using appropriate RFID equipment.


29 RFID in Library Management

Books can have RFID tags.

Book ↓ RFID Tag ↓ Reader ↓ Library System

When a student borrows a book:

Scan ↓ Identify book ↓ Identify student ↓ Update database ↓ Book issued

This reduces manual data entry.


30 RFID Security

A very important point:

Do not assume that a UID alone is a secure authentication mechanism.

A basic system that simply checks:

if UID == authorizedUID

can be suitable for a classroom demonstration, but it may not provide strong security.

Depending on the card and protocol, attackers may potentially:

  • Copy identifiers
  • Clone some tags
  • Replay data
  • Exploit weak authentication
  • Use unauthorized cards

For serious access-control systems, use stronger cryptographic authentication and appropriately designed secure credentials.


31 RFID Range

RFID range depends on:

  • Frequency
  • Reader power
  • Antenna
  • Tag type
  • Tag orientation
  • Environment
  • Reader design

Generally:

LF/HF → Shorter range UHF → Longer range

Don't assume every RFID reader can detect tags from several meters away.


32 RFID and Metal

Metal can interfere with some RFID systems.

For example:

RFID Tag ↓ Metal surface ↓ Performance may change

Special RFID tags designed for metal surfaces are available for applications requiring them.


33 Common RFID Problems

Problem 1: Card isn't detected

Check:

  • Power
  • SPI wiring
  • SS pin
  • RST pin
  • Library
  • Card frequency
  • Reader orientation

Problem 2: Random UID readings

Possible causes:

  • Poor wiring
  • Electrical noise
  • Unstable power
  • Incorrect SPI configuration

Problem 3: Wrong card type

For example:

13.56 MHz reader ↓ 13.56 MHz compatible tag

A 125 kHz tag will not normally work with a 13.56 MHz MFRC522 reader.


Problem 4: Short reading distance

Possible causes:

  • Weak antenna
  • Poor tag placement
  • Wrong tag type
  • Metal interference
  • Power problems

34 RFID vs Barcode

RFIDBarcode
WirelessOptical
No direct line-of-sight usually requiredUsually requires line of sight
Can identify multiple tags with suitable systemsUsually scanned individually
Tags can store dataBarcode stores encoded information visually
More expensiveCheap
Useful for automationUseful for simple identification

35 Complete RFID IoT System

A more advanced project can look like this:

RFID TAG ↓ RFID Reader ↓ ESP32 │ ┌──────────────┼──────────────┐ ↓ ↓ ↓ OLED Servo Buzzer │ │ │ Status Lock Alert │ ↓ Wi-Fi │ ↓ Cloud DB │ ↓ Web Dashboard

Example dashboard:

================================ RFID ACCESS SYSTEM ================================ Last Card: A3 7F 21 9C User: Uday Status: ACCESS GRANTED Door: UNLOCKED Time: 09:15 AM ================================

36 Key Points

  1. RFID stands for Radio Frequency Identification.
  2. RFID systems use readers and tags.
  3. Passive RFID tags generally obtain operating energy from the reader's field.
  4. RFID exists across several frequency ranges.
  5. HF RFID commonly uses 13.56 MHz.
  6. MFRC522 is a popular 13.56 MHz RFID module for Arduino/ESP32 projects.
  7. NFC is a short-range 13.56 MHz technology closely related to HF RFID.
  8. An RFID tag can expose a UID, but UID-only authentication is not necessarily secure.
  9. RFID can be used for:
    • Attendance
    • Door locks
    • Inventory
    • Library systems
    • Asset tracking
  10. NFC can be used for:
  • Contactless interactions
  • Smart posters
  • URLs
  • Mobile interactions
  1. RFID can be combined with ESP32, relay, servo, OLED, buzzer and Wi-Fi to build IoT systems.
  2. Always verify the frequency and voltage requirements of the RFID reader and tag before connecting them.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy