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:
| Type | Typical frequency |
|---|---|
| LF RFID | ~125–134 kHz |
| HF RFID | 13.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
| Feature | RFID | NFC |
|---|---|---|
| Main purpose | Identification/tracking | Short-range communication |
| Frequency | Various | 13.56 MHz |
| Range | Depends on RFID type | Usually very short |
| Communication | Often reader ↔ tag | Can support two-way communication |
| Smartphone support | Depends on hardware | Common |
| Example | Inventory tag | Tap-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:
| MFRC522 | Function |
|---|---|
| 3.3V | Power |
| GND | Ground |
| RST | Reset |
| SDA/SS | SPI chip select |
| MOSI | SPI |
| MISO | SPI |
| SCK | SPI clock |
The exact GPIO numbers depend on your ESP32 board.
15 MFRC522 + ESP32
A common ESP32 wiring example is:
| MFRC522 | ESP32 |
|---|---|
| 3.3V | 3.3V |
| GND | GND |
| SCK | GPIO 18 |
| MISO | GPIO 19 |
| MOSI | GPIO 23 |
| SDA/SS | GPIO 5 |
| RST | GPIO 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
| Feature | NFC | QR Code |
|---|---|---|
| Physical contact | No | No |
| Camera required | Usually no | Yes |
| Cost | Tag required | Can be printed |
| Rewritable | Often | Depends on destination |
| Range | Very short | Camera distance |
| Example | Tap phone | Scan 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
| RFID | Barcode |
|---|---|
| Wireless | Optical |
| No direct line-of-sight usually required | Usually requires line of sight |
| Can identify multiple tags with suitable systems | Usually scanned individually |
| Tags can store data | Barcode stores encoded information visually |
| More expensive | Cheap |
| Useful for automation | Useful 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
- RFID stands for Radio Frequency Identification.
- RFID systems use readers and tags.
- Passive RFID tags generally obtain operating energy from the reader's field.
- RFID exists across several frequency ranges.
- HF RFID commonly uses 13.56 MHz.
- MFRC522 is a popular 13.56 MHz RFID module for Arduino/ESP32 projects.
- NFC is a short-range 13.56 MHz technology closely related to HF RFID.
- An RFID tag can expose a UID, but UID-only authentication is not necessarily secure.
- RFID can be used for:
- Attendance
- Door locks
- Inventory
- Library systems
- Asset tracking
- NFC can be used for:
- Contactless interactions
- Smart posters
- URLs
- Mobile interactions
- RFID can be combined with ESP32, relay, servo, OLED, buzzer and Wi-Fi to build IoT systems.
- Always verify the frequency and voltage requirements of the RFID reader and tag before connecting them.