通信接口

如何在Arduino平台上利用MFRC522 RFID实现安全访问

字号+ 作者:duino123.com 来源:未知 2016-04-28 10:54 我要评论( )

本文是一个使用MFRC522读卡的简单示例,对基于Arduino平台的应用做了一个总体的介绍和说明,希望对以后的应用能有帮助。

PLCLIVE.COM
本文是一个使用MFRC522读卡的简单示例,对基于Arduino平台的应用做了一个总体的介绍和说明,希望对以后的应用能有帮助。

1. 概述

RFID means radio-frequency identification. RFID uses electromagnetic fields to transfer data over short distances. RFID is useful to identify people, to make transactions, etc…

You can use an RFID system to open a door. For example, only the person with the right information on his card is allowed to enter. An RFID system uses:

  • tags attached to the object to be identified, in this example we have a keychain and an electromagnetic card. Each tag has his own identification (UID).
  • two-way radio transmitter-receiver, the reader, that send a signal to the tag and read its response.
  • 2. 特性

    • Input voltage: 3.3V
    • Frequency: 13.56MHz

    3. 下载库

    Here's the library you need for this project:

    1. Download the RFID library here 库在这里下载哦!
    2. Unzip the RFID library
    3. Install the RFID library in your Arduino IDE
    4. Restart your Arduino IDE
  • 4. 连接

    Pin Wiring to Arduino Uno
    SDA Digital 10
    SCK Digital 13
    MOSI Digital 11
    MISO Digital 12
    IRQ unconnected
    GND GND
    RST Digital 9
    3.3V 3.3V

    切记:电源为3.3V!!!

    5. 电路

     

    6. 读取数据

    After having the circuit ready, go to File > Examples > MFRC522 > DumpInfo and upload the code. This code will be available in your Arduino IDE (after installing the RFID library).

    Then, open the serial monitor. You should see something like the figure below:

    Approximate the RFID card or the keychain to the reader. Let the reader and the tag closer until all the information is displayed.

    This is the information that you can read from the card, including the card UID that is highlighted in yellow. The information is stored in the memory that is divided into segments and blocks as you can see in the previous picture.

    You have 1024 bytes of data storage divided into 16 sectors and each sector is protected by two different keys, A and B.

    记下你RFID卡的UID,后面要用到哦!

    Upload the following code.

    In the piece of code above you need to change the if (content.substring(1) == “REPLACE WITH YOUR UID”) and type the UID card you've written previously. 这里必须修改成你的RFID卡UID。

    7. 演示

    Now, upload the code to your Arduino and open the serial monitor.

    Approximate the card you’ve chosen to give access and you’ll see:


    If you approximate another tag with another UID, the denial message will show up:

    收工again!希望这个小例子抛砖引玉,让你开发出更棒的作品!

如需更详细资料,如有好资源分享,请加入QQ交流群:214461008

欢迎阅读,欢迎转载,不用注明出处!本站只提供入门和进阶资料,做您学习的小伙伴!

请加群:214461008

相关文章
  • json在arduino上的应用

    json在arduino上的应用

    2016-06-20 09:45

  • 两块Arduino之间通过SPI通信

    两块Arduino之间通过SPI通信

    2016-06-01 13:02

  • 常见的几种arduino型号的IIC引脚定义

    常见的几种arduino型号的IIC引脚定义

    2016-05-29 14:40

  • Arduino软串口的使用

    Arduino软串口的使用

    2016-05-04 15:27

网友点评
Arduino
热门教程
关注我们
自动化世界