Adeept RFID Module For UNO R3

Adeept RFID Module For UNO R3

Overview
In this lesson, we will learn how to use RFID Module. We programmed the Arduino UNO to read the data which is acquired by the RFID module, and then make the ID data displayed on the serial monitor.
Requirement
– 1* Adeept UNO R3(Arduino UNO R3)
– 1* USB Cable
– 1* RFID-RC522 Module
– 1* RFID ID Round Tag
– 1* RFID ID Card
– Several Jumper Wires
Principle
RFID technology is used for a wide variety of applications including access control, package identification, @warehouse stock control, point-of-sale scanning, retail antitheft systems, toll-road passes, surgical instrument inventory, and even for identifying individual sheets of paper placed on a desk. RFID tags are embedded in name badges, shipping labels, library books, product tags and boxes; installed in aircraft; hidden inside car keys; and implanted under the skin of animals or even people. RFID systems work on a wide range of frequencies, have a variety of modulation and encoding schemes, and vary from low-power passive devices with range of only a few millimeters to active systems that work for hundreds of kilometers.
However, all RFID systems have the same basic two-part architecture: a reader and a transponder. The reader is an active device that sends out a signal and listens for responses, and the transponder (the part generally called the “tag”) detects the signal from a reader and automatically sends back a response containing its identity code.
A reader is shown in the following:

A transponder is shown in the following:

Different types of RFID tags fall into one of three broad categories: active, passive, and batter

 

y-assisted passive.
Active tags are physically large because they require their own power supply such as a battery. They can also have a very long range because the availability of local power allows them to send high-powered responses that can travel from tens of meters to hundreds of kilometers. An active tag is essentially a combination of a radio receiver to detect the challenge, some logic to formulate a response, and a radio transmitter to send back the response. They can even have the challenge and response signals operate on totally different frequencies. The downsides are the size of the tag, a high manufacturing cost due to the number of parts required, and the reliance on a battery that will go flat eventually.
Passive tags can be much smaller and cheaper than active tags because they don’t require a local power supply and have much simpler circuitry. Instead of supplying their own power, they leach all the power they need from the signal sent by the reader. Early passive tags operated on the “Wiegand effect,” which uses a specially formed wire to convert received electromagnetic energy into radio-wave pulses. Some early passive RFID tags actually consisted of nothing more than a number of very carefully formed wires made from a combination of cobalt, iron, and vanadium, with no other parts at all.
Modern passive tags use a clever technique that uses current induced in their antenna coil to power the electronics required to generate the response. The response is then sent by modulating the reader’s own field, and the reader detects the modulation as a tiny fluctuation in the voltage across the transmitter coil. The result is that passive tags can be incredibly small and extremely inexpensive: the antenna can be a simple piece of metal foil, and the microchips are produced in such large quantities that a complete RFID-enabled product label could cost only a few cents and be no thicker than a normal paper label. Passive tags can theoretically last indefinitely because they don’t contain a battery to go flat, but their disadvantage is a very short operational range due to the requirement to leach power from the reader’s signal, and lack of an actively powered transmitter to send back the response.
Passive tags typically operate over a range of a few millimeters up to a few meters.
Tags can also have a variety of different modulation schemes, including AM, PSK, and ASK, and different encoding systems. With so many incompatible variations, it’s sometimes hard to know if specific tags and readers are compatible. Generally speaking, each type of tag will only function on one specific frequency, modulation scheme, and communications protocol. Readers, on the other hand, are far more flexible and will often support a range of modulation schemes and comms protocols, but are usually still limited to just one frequency due to the tuning requirements of the coil.
Apart from the specific requirements for communicating with them, tags can also have a number of different features. The most common passive tags simply contain a hard-coded unique serial number and when interrogated by a reader they automatically respond with their ID code. Most tags are read-only so you can’t change the value they return, but some types of tags are read/write and contain a tiny amount of rewritable storage so you can insert data into them using a reader and retrieve it later. However, most uses of RFID don’t rely on any storage within the tag, and merely use the ID code of the tag as a reference number to look up information about it in an external database or other system.
RFID tags are produced in a wide variety of physical form factors to suit different deployment requirements. The most commonly seen form factor is a flat plastic card the same size as a credit card, often used as an access control pass to gain access to office buildings or other secure areas. The most common form by sheer number produced, even though you might not notice them, is RFID-enabled stickers that are commonly placed on boxes, packages, and products. Key fob tags are also quite common, designed to be attached to a keyring so they’re always handy for operating access control systems.
Procedures
1. Build the circuit

2.Install Library
The example sketches provided use the Adeept_RFID_RC522.ZIP library, so you need to install it before compiling. Click Add.ZIP Library to add the Adeept_RFID_RC522.ZIP to the libraries folder.

After the library is installed successfully, you can find the ‘Adeept_RFID_RC522 under Include Librarry on the window.
3. Program
/***********************************************************
File name: Adeept_RFID_UNO.ino
Description: when you close the ID card to the RFID reader,
             the ID number will be sent to the serial monitor
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/08/25 
***********************************************************/
#include <Adeept_RFID_RC522.h>

Adeept_RFID_RC522 RFID;
const int chipSelect = 10;
const int NRSTPD = 9;

void setup() { 
    RFID.MFRC522_Init( chipSelect, NRSTPD);
    Serial.begin(57600); 
}
void loop(){
    unsigned char statusa;
    unsigned char str[MAX_LEN];
 
    // Search card, return card types
    statusa = RFID.MFRC522_Request(PICC_REQIDL, str); 
    if (statusa != MI_OK){ return;}
    // Show card type
    ShowCardType(str);
    //Prevent conflict, return the 4 bytes Serial number of the card
    statusa = RFID.MFRC522_Anticoll(str);
    // str[0..3]: serial number of the card
    // str[4]: XOR checksum of the SN.
    if (statusa == MI_OK){
        Serial.print("The card's number is: ");
        memcpy(RFID.serNum, str, 5);
        ShowCardID(RFID.serNum);
        // Check people associated with card ID
        unsigned char* id = RFID.serNum;
        if( id[0]==0x4B && id[1]==0xE6 && id[2]==0xD1 && id[3]==0x3B ) {
            Serial.println("Hello Mary!");
        } else if(id[0]==0x3B && id[1]==0xE6 && id[2]==0xD1 && id[3]==0x3B) {
            Serial.println("Hello Greg!");
        }else{
            Serial.println("Hello unkown guy!");
        }
    }
    RFID.MFRC522_Halt(); //command the card into sleep mode 
    delay(200);
}
/*
 * Function:ShowCardID
 * Description:Show Card ID
 * Input parameter:ID string
 * Return:Null
 */
void ShowCardID(unsigned char *id){
    int IDlen=4;
    for(int i=0; i<IDlen; i++){
        Serial.print(0x0F & (id[i]>>4), HEX);
        Serial.print(0x0F & id[i],HEX);
    }
    Serial.println("");
}
/*
 * Function:ShowCardType
 * Description:Show Card type
 * Input parameter:Type string
 * Return:Null
 */
void ShowCardType(unsigned char* type){
    Serial.print("Card type: ");
    if(type[0]==0x04&&type[1]==0x00) 
        Serial.println("MFOne-S50");
    else if(type[0]==0x02&&type[1]==0x00)
        Serial.println("MFOne-S70");
    else if(type[0]==0x44&&type[1]==0x00)
        Serial.println("MF-UltraLight");
    else if(type[0]==0x08&&type[1]==0x00)
        Serial.println("MF-Pro");
    else if(type[0]==0x44&&type[1]==0x03)
        Serial.println("MF Desire");
    else
        Serial.println("Unknown");
}
Adeept_RFID_RC522 library Link:Adeept_RFID_RC522
4. Compile the program and upload to Adeept UNO R3 board
Now, when you close the ID card to the RFID reader and the ID number will be sent to the serial monitor.

Leave a Reply