RFID key tag

Identify your tag on id.

There are different useful use cases, for instance:

  • access control
  • tracking objects
  • identify objects

Bildergebnis für MFOne S50 key tag

This picture shows a MFOne-S50 key tag. The key has a number with eight signs like B260B673.

To get the card id use following code for Arduino.

/*******************************************
* function:get the id of RFID key
* RFID Uno r3
* VCC 3.3V
* RST 2
* GND GND
* MISO 3
* MOSI 4
* SCK 5
* NSS 6
* IRQ 7
****************************************/

#include"rfid1.h"
RFID1 rfid;//create a variable type of RFID1

uchar serNum[5]; // array to store your ID

void setup()
{
Serial.begin(9600); //initialize the serial
rfid.begin(7, 5, 4, 3, 6, 2); //rfid.begin(IRQ_PIN,SCK_PIN,MOSI_PIN,MISO_PIN,NSS_PIN,RST_PIN)
delay(100);//delay 1s
rfid.init(); //initialize the RFID
}
void loop()
{
uchar status;
uchar str[MAX_LEN];
// Search card, return card types
status = rfid.request(PICC_REQIDL, str);
if (status != MI_OK)
{
return;
}
// Show card type
rfid.showCardType(str);
//Prevent conflict, return the 4 bytes Serial number of the card
status = rfid.anticoll(str);

if (status == MI_OK)
{
Serial.print("The card's number is: ");
memcpy(serNum, str, 5);
rfid.showCardID(serNum);//show the card ID
Serial.println();
Serial.println();
}
delay(500);

rfid.halt(); //command the card into sleep mode
}

To use the card id for access control use this code segment to identify a person named Alisha or an object for example.

uchar* id = serNum;
if( id[0]==0xB2 && id[1]==0x60 && id[2]==0xB6 && id[3]==0x73 )
{
lcd.setCursor(0,1);
lcd.print(" Alisha ");
delay(2000);
lcd.clear();
}

 

Have fun with RFID’s in your projects.

Download libraries: RFID_kit_V1.0_for_Arduino.zip 
https://www.sunfounder.com/learn/category/RFID_kit_V1_for_Arduino.html