NEW to RFID? where to start?

Everyone learns heir owns ways I guess.

I didnt buy this with a specific purpose or project in mind. I bought it to learn and play with. (period)

Yes whatever I coded in before was pretty forgiving... it also had nothing to do with hardware, more web based.

There are a few people in here new to RFID.. so we talk and explore together. Post back results of our 'journey' and others can benefit from it.

More advanced members can chime in and help out of answer questions.. (or ignore it all together if this thread and its approach to learning doesnt identify with them)

I appreciate your explanations as well. :slight_smile:

Just tearing things apart little by little and function by function to see results and plug-into the learning curve.

If there is 'easier' code pertaining to this RFID card/reader/writer.. Id be happier to look/play/study that... but unfortunately..this is all I have currently.

Thanks

I'd like to see you able to read the code you have easier because I know that would help. But wow it's a lot of explanation, a lot of typing material that's already available on the web -- but the lessons are 99.9% suited for PC's with, compared to Arduino, vastly more RAM. My UNO has only 2k SRAM to run on, including for the stack. Yet with care one can do serious work with it since there's no resource-hogging OS getting in the way. We have to write our own bugs!

back at work.. and moving ahead..

I skip to the loop() function..

as I dont understand 'much' above... or how, in general, you 'talk' with the RFID card.. i thought I had proposed it correctly above?

anyways.. getting to the main loop..

seems it a huge 'check' over and over..

update a var called status (with different values or calls/writes to the card).. then an immediate check on the new/current state of 'status'...

I found (by running test sketch/and looking at print out text) the 'section' where it just 'checks' for a card/id in the area..

void loop()
{
status = MFRC522_Request(PICC_REQIDL, str);	
  if (status == MI_OK)
  {
    Serial.println("CARD IN PROXIMITY....CHECKING");
    //Serial.print(str[0],BIN);
    //Serial.print(" , ");
    //Serial.print(str[1],BIN);
    //Serial.println(" ");
    //delay(1000);
  }
  //Serial.println(" ");
  MFRC522_Halt(); // calls a fucntion outlined later in the sketch but above my knowledge to know  exactly what it is doing
  delay(200);  //I added this to delay the speed of the 'checks' for now..


//which bring us/me to the first part of the code I sorta identify as the CARD PROXIMITY CHECKING code snippet

 status = MFRC522_Request(PICC_REQIDL, str);  //updating 'status' to be a function/result/return of MFRC522_Request(PICC_REQIDL, str) ****  (function posted below)

//now check status value against some conditions
  if (status == MI_OK)
  {
    Serial.println("CARD IN PROXIMITY....CHECKING");
    //Serial.print(str[0],BIN);
    //Serial.print(" , ");
    //Serial.print(str[1],BIN);
    //Serial.println(" ");
    //delay(1000);
  }
 
}

I wish there was some better documentation on the functions/methods available in this class/lib.. =(

but this function:

MFRC522_Request(); seems to be the method available for checking/seeing if there is an RFID in the area

I commented out the print() lines... because Im not really 'sure' what/where those values are coming from?

seems to be printing out the values/index's of an array (str[])..and outputting it in binary? but str[] is? how it got populated to begine with and with what? (and why print it out now) Im still un clear about)

just to make things easier for anyone curious or following along on this thread.. here are the full methods that are called above.

function from above:

uchar MFRC522_Request(uchar reqMode, uchar *TagType)
{
uchar status;
uint backBits; //????????

Write_MFRC522(BitFramingReg, 0x07); //TxLastBists = BitFramingReg[2..0] ???

TagType[0] = reqMode;
status = MFRC522_ToCard(PCD_TRANSCEIVE, TagType, 1, TagType, &backBits);

if ((status != MI_OK) || (backBits != 0x10))
{
status = MI_ERR;
}

return status;
}

HALT function noted above:

void MFRC522_Halt(void)
{
uchar status;
uint unLen;
uchar buff[4];

buff[0] = PICC_HALT;
buff[1] = 0;
CalulateCRC(buff, 2, &buff[2]);

status = MFRC522_ToCard(PCD_TRANSCEIVE, buff, 4, buff,&unLen);
}

I have played with some Arduino sketches before.. timers, no delays.. using interrupts.. matrix set-up's..etc..

but the RFID (or at least this library/version) if rather difficult learning curve.. and not what "I" am used to as far as good documentation (probably just spoiled!) :stuck_out_tongue:

anyways.. moving on.. just going to try and figure out

  • see what that 'sectorNewKeyA' stuff is all about.. and how you actually change that password/key
  • what section(s) on the card 'can' be written to to hold certain data.
  • figure out to write to one of the custom/user allowed, writable areas

I have mine working now, but I'm
burned out, so I'm letting it sit for
a day.

Some of the questions are going
to be answered by looking at the
PDF data sheets.

Doug

Have you tried writing to your vendor
and asking for a data sheet on the
RFID cards?

RFID.pdf has a comment about changing
sector KeyA to sector NewKeyA. I can't
figure out what they're trying to say.

Scratching the surface a little bit here:

Look at RC522.pdf sections 10.2.2 and
10.2.3. They give insight on how the data
is read from and written to the card using
SPI.

thanks for the tip on the section to focus on..

so in laymen terms you do send a 'string/sequence' of data that outlines

the type of 'command' it is (leading bit is either 0 or 1)

what address(es?) you want to read (and the returned data form those address blocks/sectors.

if writing.. you send the ddress you want to 'write' to followed by the data you want written..

(talking outloud here.. walking myself/teaching myself.. this is NOT correct by any means)

READING DATA:

byte 0 byte 1 byte 2 byte... byte n byte n+1
MOSI- address 0 address 1 address 2 .......... address n 00
MISO- X data 1 data 2 .......... data n-1 data n

WRITING DATA:

byte 0 byte 1 byte 2 byte... byte n byte n+1
MOSI- address 0 data 0 data 1 .......... data n-1 data n
MISO- X X X .......... X X

Address Byte:

The address byte has to fulfill the following format-

The MSB bit of the first byte defines the user mode (read or write mode)

  • To read from the MFRC522 the MSB bit is set to LOGIC 1
  • To write from the MFRC522 the MSB bit is set to LOGIC 0
    *The bits 6 to 1 define the address and the LSB shall be set to LOGIC 0

helps a little bit.

is there an easy chart or section that notes what areas/sectors are 'writable' to use? what are readable? (what are neither..protected..etc)

I WANT TO KEEP THIS IN MY PROFILE FOR FUTURE USE, SO THAT IS THE POINT OF THIS REPLY!

hahaha..

you wont be learning much in this thread.. (at least not from me)

Hi, have any of you managed to find out what you are supposed to change in this code the second time around?

uchar sectorKeyA[16][16] = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
//when you try it again, please change it into " 0x19, 0x84, 0x07, 0x15, 0x76, 0x14 "
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
};
uchar sectorNewKeyA[16][16] = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{0x19, 0x84, 0x07, 0x15, 0x76, 0x14, 0xff,0x07,0x80,0x69, 0x19,0x84,0x07,0x15,0x76,0x14},
{0x19, 0x33, 0x07, 0x15, 0x34, 0x14, 0xff,0x07,0x80,0x69, 0x19,0x33,0x07,0x15,0x34,0x14},
};

cheers

I have not... matter of fact, mine has sat in my components box sine last post/time got it really.

I have been slowly working on another project, that has had some bumps.. and some unexpected learning curves in it. :wink:

but I would like to eventually get back to tearing this apart, and getting an understanding of the functions..etc..

I have a cat project and a door lock project in mind for these :slight_smile:

let us know what you find out, if anything!

I've not got my RFID reader / writer yet, just doing some research before it arrives. Once I understand that bit of code, I'll get stuck in. I have been in touch with the company regarding the code, but they have not got back to me yet. When it come to what they want you to change the second time around with the code is really badly explained, hopefully, someone will sort it out. will keep you informed on here to my progress!lol

Hi All,
I found at http://www.b2cqshop.com/best/Q00915209-2560crazykit.rar the best (at present for me) doc relating to RFID (13 MHz) and Mega 2560. Inside the doc there is also a detailed explanation of Mifar's tags.

I think that the program is the same found at another b2cqshop link (previous posted). It run properly but I was a bit confused by a sketch of more than 800 lines that run ok but do few actions so, despite I don't really fully understood any function I made an arduino library (MF.h) just for Mifar cards copyng that functions with some amount of work to obtain a standard library.

The sketch need a declaration of an object of the MF class (i.e. MF rfid;) and any function is now a method (like rfid.MFRC522_Init(NRSTPD,chipSelectPin); ) .

The final advantage is that the sketch contain only a series of callings to the methods and not also the methods.
Try the same example after the copy of MF folder in the libraries folder of the Arduino IDE.

MF_lib.rar (6.87 KB)

that link doesnt go anywhere for me. (dead link, 404 error)

Really sorry: that link was useful when I posted...
Please try here: http://dl.dropbox.com/u/32687222/Q00915209-2560crazykit.rar

Hello,

Any luck with your project?

I bought another kit based on the same MFR522, mine 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

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. So still in step 1! :cry:

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

Maybe we can combine efforts and make our systems work.

Regards

Eduardo

hellonearthis:
I've been learning how to use one of these rfid reader/writer and getting good results.
I use softwareserial at 19200. I am currently looking at how to connect to the cards SIG pin, docs say it has an Interrupt output, LOW level indicates Tag in the field.
Which means you don't have to keep polling the card to see if there is a Tag around. There are also write options, which can store data in a purse/wallet area. Not got into that yet.

Hi

I've just bought this kit as well. I'm totally new to arduino and while I've got power on the RFID board and it sees tags I haven't managed to figure out how to get a tag ID into the serial output window, I'm guessing I'll have to do some digitalRead and digitalWrite tutorials. Can I ask if you use the small board with a serial dongle or are you just connecting straight to the RFID board pins?

Thanks for any advice

Deekin

I have purchased an MF RC522 from ebay but am having trouble figuring out how to write to the card. Does anyone have experience with this?

Can you read 125mhz fobs with a 13.65mhz reader?

dier02:
Can you read 125mhz fobs with a 13.65mhz reader?

No.
Why ever do you think you could?
It is MHz anyway.