Need help with MFRC522

Hello,

Hopefully somebody can show me the pad to make my RFID kit the way i want.

I newbie using Arduino but want to become an expert, I’m a self-learning guy, like to read and practice what I’m learning.

De way I decide to learn Arduino is to make a project, so I chose a RFID access control and log system.

My project will consist of

• RFID access control, read a tag and grant access if is in a database. • Access log; want to have a log when access is granted to a tag. • Web, want to be able to set up new cards or verify log file from a web server. • Use a LCD as a basic HMI to the user

Maybe looks a little complex, but want to go step by step, so far I have been a little frustrated because I only can read the tag and show the serial number in the serial monitor and record the tag serial number in an array, but that is all.

Maybe my problem is handling information in an array, I don’t know.

My kit is this one:

http://www.ebay.com/itm/Serial-UART-13-56MHZ-RFID-Reader-Writer-Module-with-Cards-Arduino-Compatible-/130649910994?pt=BI_Electrical_Equipment_Tools&hash=item1e6b576ed2

Have somebody a sample code that can share with me?

Regards

Eduardo

http://www.elechouse.com/elechouse/images/product/13.56MHZ_RFID_Module/RFID%20with%20Arduino.pdf

Thank you John,

But i already test this code and works then i was able to record the card serial number (4 bytes) in an array, but then I'm not bale to do something else, maybe i need to be more patient and investigate more.

Also i would like to know is somebody have a sample code using the basic instructions set, then i will be able to use the other features this kit has.

Regards

Eduardo

I found the attached code on Simon’s blog and another friend recommend this to me. I translate to English the comments. This code is using SPI communication but my kit is using UART, still a good example.

Regards

unoRFID.ino (29 KB)

Any luck with this using the UART?
I also find the basic instruction set pretty complicating. Only getting modes set up.

Thought I’d add my work here,

I have it running of Serial1, and Accessing the MEGA through Serial.

The manufacturer has a 8051 type microcontroller in from of this device which they use to control and config the RC522 using custom Command Codes, I spent ours trying to get it to work with the RC522 datasheet only to realize I must use the manufacturers ‘User Manual’

Heres some code that works:

unsigned char command, devnull;
unsigned int returnLength;

void setup()

{

Serial.begin(115200);

Serial.println(“Waiting for Card\n”);
Serial1.begin(9600);

Serial1.write(0x02); //Send the command to RFID, please refer to RFID manual

}

void loop() // run over and over

{

if (Serial1.available())
{
Serial.print("\n\rCARD SERIAL: “);
for (unsigned int i=0; i<4 ;i=i){
//Serial.print(“2”);
if (Serial1.available()) {
//Serial.print(”\n\ri is: “);Serial.print(i);Serial.print(” ");
Serial.print(Serial1.read(),HEX); //Display the Serial Number in HEX
i++;
}
}

Serial.println("\n\rRead Card Make…");
Serial1.write(0xAB);Serial1.write(0x02);Serial1.write(0x01);

Get_Reply();

Serial1.write(0x02); //Send the command to RFID, please refer to RFID manual
}

}

void Get_Reply() {
while (!Serial1.available());
devnull = Serial1.read();
while (!Serial1.available());
returnLength = Serial1.read() - 1;

for (unsigned int i=0;i< returnLength;i=i){
//Serial.print(“2”);
if (Serial1.available()) {
//Serial.print("\n\ri is: “);Serial.print(i);Serial.print(” “);
Serial.print(Serial1.read(),HEX); //Display the Serial Number in HEX
i++;
}
}
}
/*
if (Serial.available()){
command = Serial.read();
switch ( command ){
case ‘1’:
Serial.println(”\n\rRead Card Make…");
Serial1.write(0xAB);Serial1.write(0x02);Serial1.write(0x01);
break;
case ‘2’:
Serial.println("\n\rRead Card Serial…");
Serial1.write(0xAB);Serial1.write(0x02);Serial1.write(0x02);
break;
case ‘3’:
Serial.println("\n\rRead Card DATA…");
Serial1.write(0xAB);
Serial1.write(0x0A);
Serial1.write(0x03);
Serial1.write(0x04);
Serial1.write(0x00,HEX);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
break;
}
}
*/

Serial1.write(0x00,HEX);

please allow me to have some doubts that this really works (reliably). This writes 16 bytes starting at address 0 (zero) of your Arduino to Serial1.

Hello!!

I am working in a project using arduino uno and mfrc522 rfid module. I would like to know if somebody can tell me what I have to do to record things on my tags.

Thank you!