Pages: 1 2 [3]   Go Down
Author Topic: NEW to RFID? where to start?  (Read 13297 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1242
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..

Code:
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..  smiley-cry

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:
Quote
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:
Quote
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!)  smiley-razz



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
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1242
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 0address 1address 2..........address n00
MISO-Xdata 1data 2..........data n-1data n


WRITING DATA:

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

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)


« Last Edit: March 07, 2012, 12:49:24 pm by xl97 » Logged


Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Accelerate to 88 miles per hour.

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1242
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hahaha..

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

Logged


L,POOL England
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1242
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley-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 smiley

let us know what you find out, if anything!
Logged


L,POOL England
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Monte Colombo - Rn
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 - downloaded 37 times.)
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1242
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged


Monte Colombo - Rn
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Reynosa, Mexico
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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! :'(

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Northfield, MN
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Pages: 1 2 [3]   Go Up
Jump to: