Arduino - RFID/NFC

Arduino - RFID/NFC

Arduino - RFID/NFC
In this tutorial, we are going to learn how to use RFID/NFC with Arduino. The RFID/NFC system includes two components: reader and tag. There are two popular RFID/NFC readers: RC522 and PN532 RFID/NFC reader. This tutorial focuses on RC522 RFID/NFC reader. PN532 RFID/NFC reader will be presented in an upcoming tutorial.
在本教程中,我们将学习如何将RFID / NFC与Arduino一起使用。RFID/NFC系统包括两个组件:读卡器和标签。有两种流行的 RFID/NFC 阅读器:RC522 和 PN532 RFID/NFC 阅读器。本教程重点介绍 RC522 RFID/NFC 阅读器。PN532 RFID/NFC阅读器将在即将到来的教程中介绍。

RC522 RFID/NFC reader (also called RFID-RC522 Module) can:
RC522 RFID/NFC读写器(也称为RFID-RC522模块)可以:

  • Read the UID of RFID/NFC tag
    读取RFID / NFC标签的UID
  • Change the UID of RFID/NFC tag (only if the tag is UID-writable)
    更改 RFID/NFC 标签的 UID(仅当标签是 UID 可写的时)
  • Write data to RFID/NFC tag
    将数据写入 RFID/NFC 标签
  • Read data from RFID/NFC tag
    从RFID/NFC标签读取数据

In above capabilities, for Arduino, reading the UID is the most widely-used. This tutorial focuses on reading the UID of RFID/NFC tag. The other will be present in next tutorials
在上述能力中,对于Arduino来说,读取UID是应用最广泛的。本教程重点介绍如何读取RFID/NFC标签的UID。另一个将在下一个教程中出现

Hardware Required 所需硬件

1 × Arduino UNO or Genuino UNO Arduino UNO 或 Genuino UNO
1 × USB 2.0 cable type A/B USB 2.0 电缆 A/B 型
1 × RFID/NFC RC522 Kit (reader + tags) RFID/NFC RC522 套件(读卡器 + 标签)
1 × RFID Key Fob RFID遥控钥匙
1 × Jumper Wires 跳线
1 × (Optional) 9V Power Adapter for Arduino (可选)用于Arduino的9V电源适配器
1 × (Recommended) Screw Terminal Block Shield for Arduino Uno (推荐)用于Arduino Uno的螺钉接线端子屏蔽层
1 × (Optional) Transparent Acrylic Enclosure For Arduino Uno (可选)Arduino Uno透明亚克力外壳

About RFID-RC522 Module 关于RFID-RC522模块

RFID-RC522 Module Pinout RFID-RC522 模块引脚排列

RFID-RC522 has 8 pins, some of them are common pins, the others are shared among three communication modes: SPI, I2C, UART. At a time, only one communication mode can be used. The pin are:
RFID-RC522 有 8 个引脚,其中一些是公共引脚,其他引脚由三种通信模式共享:SPI、I2C、UART。每次只能使用一种通信模式。这些引脚是:

  • GND pin: needs to be connected to GND (0V)
    GND引脚:需要接GND(0V)
  • VCC pin: needs to be connected to VCC (3.3)
    VCC 引脚:需要连接到 VCC (3.3)
  • RST pin: is a pin for reset and power-down. When this pin goes low, hard power-down is enabled. On the rising edge, the module is reset.
    RST引脚:是用于复位和关断的引脚。当此引脚变为低电平时,使能硬断电。在上升沿上,模块被复位。
  • IRQ pin: is an interrupt pin that can alert the microcontroller when RFID tag comes into its vicinity.
    IRQ引脚:是一个中断引脚,当RFID标签进入其附近时,可以提醒微控制器。
  • MISO/SCL/TX pin: acts as MISO when SPI interface is enabled, acts as SCL when I2C interface is enabled and acts as TX when UART interface is enabled.
    MISO/SCL/TX 引脚:在启用 SPI 接口时充当 MISO,在启用 I2C 接口时充当 SCL,在启用 UART 接口时充当 TX。
  • MOSI pin: acts as MOSI when SPI interface is enabled.
    MOSI引脚:启用SPI接口时充当MOSI。
  • SCK pin: acts as SCK when SPI interface is enabled
    SCK 引脚:启用 SPI 接口时充当 SCK
  • SS/SDA/RX pin: acts as SS when SPI interface is enabled, acts as SDA when I2C interface is enabled and acts as RX when UART interface is enabled.
    SS/SDA/RX 引脚:在启用 SPI 接口时充当 SS,在启用 I2C 接口时充当 SDA,在启用 UART 接口时充当 RX。

RFID-RC522 Pinout

※ NOTE THAT: ※ 注意事项:

  • The order of pins can vary according to manufacturers. ALWAYS use the labels printed on the module. The above image shows the pinout of the module from DIYables manufacturer.

  • 引脚的顺序因制造商而异。请务必使用模块上印制的标签。上图显示的是 DIYables 制造商的模块引脚布局。

  • Do not connect VCC pin to 5V pin. This will likely destroy your module.
    请勿将 VCC 引脚连接到 5V 引脚。这可能会损坏您的模块。

  • MFRC522 library supports only SPI mode. Therefore, this tutorial uses only SPI communication.
    MFRC522库仅支持 SPI 模式。因此,本教程仅使用 SPI 通信。

How RFID/NFC Works

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蔚蓝慕

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值