Description
Feature:This RFID modules base on MFRC522 IC and that can read and write Mifare’s tags.The microcontroller and card reader uses SPI for communication.The card reader and the tags communicate using a 13.56MHz electromagnetic field.The RFID MFRC522 module supports MF1xxS20, MF1xxS70 and MF1xxS50 tags.The RFID MFRC522 module supports contactless communication and uses MIFARE higher transfer speeds up to 848 kBd in both directions.RFID MFRC522 have compact design and small size 36x36mm.Power can supply 3.3V or 5V.This yasy for connection to board with 5V, not need power regulator for 3.3V.The antenna is built into the board. And it has a good sensitivity to a height of 25mmPackage includes:1 x RFID ReaderSketch for :
// VCC—-5V
// GND—-GND
// RST—-D5
// SDA—-D10
// MOSI—D11
// MISO—D12
// SCK—-D13
#include
#include
RFID rfid(10,5); //D10–SDA, D5–RST
unsigned char serNum[5];
unsigned char writeDate[16] ={‘R’, ‘o’, ‘b’, ‘o’, ‘t’, ‘D’, ‘y’, ‘n’, ‘-‘, ‘T’, ‘e’, ‘s’, ‘t’, 0, 0, 0};
unsigned char sectorKeyA[16][16] = {
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},};
unsigned char sectorNewKeyA[16][16] = {
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xff,0x07,0x80,0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xff,0x07,0x80,0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},};
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.init();
}
void loop()
{
unsigned char i,tmp;
unsigned char status;
unsigned char str[MAX_LEN];
unsigned char RC_size;
unsigned char blockAddr;
rfid.isCard();
if (rfid.readCardSerial())
{
Serial.print(“The card’s number is : “);
Serial.print(rfid.serNum[0],HEX);
Serial.print(rfid.serNum[1],HEX);
Serial.print(rfid.serNum[2],HEX);
Serial.print(rfid.serNum[3],HEX);
Serial.print(rfid.serNum[4],HEX);
Serial.println(” “);
}
rfid.selectTag(rfid.serNum);
blockAddr = 7;
if (rfid.auth(PICC_AUTHENT1A, blockAddr, sectorKeyA[blockAddr/4], rfid.serNum) == MI_OK)
{
status = rfid.write(blockAddr, sectorNewKeyA[blockAddr/4]);
Serial.print(“set the new card password, and can modify the data of the Sector: “);
Serial.println(blockAddr/4,DEC);
blockAddr = blockAddr – 3 ;
status = rfid.write(blockAddr, writeDate);
if(status == MI_OK)
{
,,
Reviews
There are no reviews yet.