I’m using this RFID module for Arduino Ethernet R3 and I need to retrieve from the Software Serial the card (TAG) ID that is written outside the tag.
The module’s datasheet says that 14 bytes are sent to the Arduino. The first is the header, the last the footer, the 2 bytes before the footer are the checksum, and the other 10 bytes are the ASCII data that contains the tag ID.
How can I recreate the ID of the card, and control the checksum? For example with a tag that has this ID: 0013530444, the Arduino response is:
I received: 2
I received: 51
I received: 67
I received: 48
I received: 48
I received: 67
I received: 69
I received: 55
I received: 53
I received: 52
I received: 67
I received: 67
I received: 66
I received: 3
But I’ve no idea how to print on the screen the ID read by the Arduino. How to calculate the checksum?
http://www.seeedstudio.com/wiki/index.php?title=125Khz_RFID_module_-_UART
Can anyone help me?
Here’s a walkthrough of how to calculate the checksum.
Take your card number (this is just directly quoted from your text)
This would give you a number that is equivalent to the following:
The first numer (2) indicates that this is the beginning of a request.
The last number (3) indicates that this is the end of a request.
For the purposes of calculating the checksum, we are going to remove these two numbers. So your new number is now:
The last two numbers that you have are your checksum. The remaining numbers are your card number. So:
Your card number is:
And your checksum is:
Next you need to convert your Card Number and your Checksum to ASCII values:
Your card number is:
And your checksum is:
Next, grab each number into pairs:
Your card number is:
And your checksum is:
Then you need to treat each pair as a HEXIDECIMAL value and do an XOR against them. So basically you need to prove the following:
Because CB == CB, this is a valid transaction.
No doubt someone else can come up with a better approach than this, but there should be enough pseudo code here for you to write it yourself.