MF522-AN RFID Reader

Okay so i bought this rfid reader off ebay
I believe this chip is based on MFRC522

Does anyone else have good working code for this reader that is simpler to understand? Do you know of any tutorials for this reader?

thank you

p.s. i have looker at

http://www.grantgibson.co.uk/blog/2012/04/how-to-get-started-with-the-mifare-mf522-an-and-arduino/

-as well as the post i can find via search in the forum
-there are a few youtube videos but no information in them

-right now when I upload the sketch i get bunch information about the card

card 1 output

Find out a card 
100 , 0 
The card's number is  : 
11101010 , 101 , 1010101 , 10011 , 10101001 
The size of the card is  :   8 K bits 
set the new card password, and can modify the data of the Sector 1 : 
FF , FF , FF , FF , FF , FF ,  
You are B2CQSHOP VIP Member, The card has  $100 !
Read from the card ,the data is : 
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 100 ,  
You pay $18 for items in B2CQSHOP.COM . Now, Your money balance is :   $82 
You add $10 to your card in B2CQSHOP.COM , Your money balance is :  $92

card 2 output

Find out a card 
100 , 0 
The card's number is  : 
1000010 , 1100110 , 1011 , 10011101 , 10110010 
The size of the card is  :   8 K bits 
set the new card password, and can modify the data of the Sector 1 : 
FF , FF , FF , FF , FF , FF ,  
You are B2CQSHOP VIP Member, The card has  $100 !
Read from the card ,the data is : 
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 100 ,  
You pay $18 for items in B2CQSHOP.COM . Now, Your money balance is :   $82 
You add $10 to your card in B2CQSHOP.COM , Your money balance is :  $92

the code provided for the mega 2560 board
from the seller is in Chinese
--all the code for the projects can be downloaded at

http://www.b2cqshop.com/b2cqshopdoc/Q00915209-2560crazykit.rar

-google translator to translate into english for project 15 the rfid project

https://docs.google.com/document/d/14vAZp5xIeqQWhcBgMoZ81V2IJg6YkOURwGDnDm0YeIo/edit

I have been playing with this as well.
Have you gotten it going with the UART?

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;
}
}
*/

delwin:
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'

Do you have a link to the manufactures User Manual?

Your code looks interesting i will have to try it out
-When you say you are using serial1 i am unfamiliar with this i understand that the mega 2560 has extra serial ports
--is this how you use those extra serial ports

-Can you take a picture of how you have it wired up or explain it in greater detail

Thank You

Arduino RFID Library for MFRC522:

Hi!

Sorry for bumping this thread,but can anyone tell me how to connect RC522 to Mini Pro?
I can't find pin connection for this combination.

Pranja:
Hi!

Sorry for bumping this thread,but can anyone tell me how to connect RC522 to Mini Pro?
I can't find pin connection for this combination.

Anyone?

SPI on the Pro Mini hooks up just like with any other 168/328 based Arduino:

Pin 13 >> SCK
Pin 12 >> MISO
Pin 11 >> MOSI
Pin 10 >> SS (Labeled SDA on my reader)
Reset >> RST

IRQ is not necessary.

Muhammad:
SPI on the Pro Mini hooks up just like with any other 168/328 based Arduino:

Pin 13 >> SCK
Pin 12 >> MISO
Pin 11 >> MOSI
Pin 10 >> SS (Labeled SDA on my reader)
Reset >> RST

IRQ is not necessary.

Thank you very much.

I have connected RFID in that way and flashed code from here: How to get started with the Mifare MF522-AN and Arduino – Grant Gibson

But I can't see anything on serial monitor, only Mini Pro LED turns off when I put card on reader.

Also, on same link I found thata reset is on pin 5, but can't read anything in that configuration (reset=pin 5). I tried reset=RST but still, it is same.

My bad, it is working now.

Well, I got reader to work, but output is really strange:

What did I do wrong?

Ok, maybe it will be more interesting if I describe what I would like to do.

I would like to make PC power switch that will be turned on when RFID card with data that match data in Arduino is placed on reader.

To do that, I need to read and write to rfid card, and hook up relay.

Relay came this morning and I allready got it working.

Here is the video of relay test.

Only part that remains is to sort out that rfid reader/writer.

Pranja:
My bad, it is working now.

How do you manage the pin connection? My pin configuration is shows nothing on serial monitor... a.k.a it doesn't work =(

How do i Chang the code on my card and chip because it is still deft (0.0.0.0) I could do with some code to help me. plz:)

Can you write to a card with this if so can someone show me how??????

Hi
First of all, I don't know how to write to card with this device:

If somebody has example please let me know. However, I was able to find a nice program which I modified.
The original program is here :
* RFID.pde * PURCHASED FROM: (EBAY) WWW.B2CQSHOP.COM * COMPLIATION OF COMMENTS FROM MULTIPLE SOURCES/SEARCHES ON SAME SKETCH * Mifare1 - Google Search
'My' modified program you can download as Ino-file:
https://drive.google.com/file/d/0B__6WdVvX0yac2I1a25GaUd0SEE/edit?usp=sharing
Some comments are written in Dutch, please use Google-translate
With 'my' program you can interact with the serial monitor but it still only reads the card and does not write to it. The only thing I can write to is the RC522-chip on the blue module.
I am not a programmer and it is too difficult for me to find that out.

The next two links are about another program and library for the RC522:

I hope this was helpfull.
@Pranja (august 18th), by now you will have figured it out but your baudrate was not set properly in your serial monitor

My question is solved with help of another forum RFID-RC522 Kaartschrijf Probleem - Modding, mechanica en elektronica - GoT
Check this codeline : //Don't initialise the card with 100$ every time!
This is the modified code and it works fine now:
https://drive.google.com/file/d/0B__6WdVvX0yaeVFWS1V2RUtnNE0/edit?usp=sharing

Sir, i have 2 RFID MRC522 and 1 arduino.
so i want each RFID will connect in 1 arduino.
that i want to ask, how i initiate the RFID in arduino?
because i need a tag that detected by the RFID will known detecting by RFID 1 or RFID 2.
Thank you Sir..

delwin:
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;
}
}
*/

Hey I have arduino leonardo and RC522 , can you tell how to integrate it with C#.net

Hello i am trying to put a new project, Using same RFID module, I have sample code to write mifare RFID tags. Check it out.

http://forum.arduino.cc/index.php?topic=256260.0