Pages: [1]   Go Down
Author Topic: Unusual serial data from RFID reader  (Read 1137 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've hooked up a Parallax RFID to an Arduino and got things working great; capturing tag information and retransmitting it via serial to my PC for output.

However when I do a println of the tag I get 10 characters plus another character, which is always Å. I'm not sure if this denotes carriage return or not (doesn't show up on other lines).

I am using these RFID cards from Trossen Robotics which are noted as having 64 bits of EEPROM capacity. Does this mean I should be looking for 64 bit IDs instead of 10 bit IDs?

Hopefully this makes some sense to you guys smiley-razz
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
However when I do a println of the tag I get 10 characters plus another character, which is always Å
So, print the values in HEX, rather than ASCII - that'll tell you what the character is.
Logged

Per Arduino ad Astra

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The cards output 64 bits in the following order:

9 x 1 bit (to signal start of data)

10 bits - customer id (of which the 5th and 10th bit are parity check)

40 bits - user data (of which every 5th bit is parity check)

4 bits - column parity check

1 stop bit

= 64 bits

When you strip off the parity info and start and end markers, you are left with:

customer id: 8 bits

customer data: 32 bits

In hex you'll get something like:

customer id: 22

customer data: 00 06 8E 4D

Have a look at the EM4102 datasheet at:

http://www.emmicroelectronic.com/webfiles/Product/RFID/DS/EM4102_DS.pdf

Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@Groove: I just tried to do that, but was given an error. I am storing the tag values into an array of chars (char*[]) and when I try to output the tag in HEX the compiler says that it cannot convert char* to long int.

@programmer: The data sheet should help. Weird that they have 9 header bits, looks like I'll need to do a bit more work to read in the tag.

The RFID reader says that it only outputs 8 bits per packet; is this something I need to account for in my program?
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am storing the tag values into an array of chars (char*[]) and when I try to output the tag in HEX the compiler says that it cannot convert char* to long int.
So, print them one-by-one, in a loop.
You can't print arrays in a single print statement, except for char arrays with a NULL terminator.
Logged

Per Arduino ad Astra

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

Quote
So, print them one-by-one, in a loop.
You can't print arrays in a single print statement, except for char arrays with a NULL terminator.

This will help me with my LCD screen problems thank you
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking better now. I am able to get sufficiently unique IDs that look more like this:

Code:
32373030333932384633

when printed in HEX that is. My code throws out the header bits, so the fact that there are 9 of them is inconsequential. I really should know the answer to this, but I see there are two actual numbers per bit resulting in 20 characters per ID.
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 94
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I`m not sure, as I don't know how the Parallax reader spits out data (i`ve only worked with the raw signal data), but I would imagine that those id's you're getting are hex ascii codes

so

32373030333932384633

would become:

32 = 2
37 = 7

30 = 0
30 = 0
33 = 3
39 = 9
32 = 2
38 = 8
46 = F
33 = 3

Giving:

Customer ID: 27
Customer Data: 003928F3

That would give the 10 bytes, and looks like it could be a valid tag
code
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I'm definitely confused, lol. I understand the differences between hex, decimal and binary but I suppose haven't seen a practical application of it before.

Like I mentioned when I pass different tags I seem to get sufficiently unique ID codes from them so I can probably finish up my program with that in mind, but just for the sake of learning I'd like to know a little more about this.

I thought there were 8 binary bits in 1 byte which allows for 256 different characters. Hex bits can be 0-9 or A-F; how many hex chars are in 1 byte? 2?

The Parallax RFID datasheet has the following says the following: "All communication is 8 data bits, no parity, 1 stop bit ..." Not sure if this is handled internally by the Serial (I'm using SoftwareSerial) class, I'm guessing it is.
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I thought there were 8 binary bits in 1 byte

There are 8 bits in a byte. Each bit is a 1 or 0. All 0's is 0. All 1's is 255.

A hex digit ranges from 0 to F (0 to 15 in decimal). That's 0000 to 1111 in binary, which, as you can see takes 4 bits. So, there are 2 hex values in a byte. That is, a byte can range from 0 to FF.

Quote
Not sure if this is handled internally by the Serial

It is.
Logged

0
Offline Offline
Sr. Member
****
Karma: 2
Posts: 254
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hahaha. Nice succinct answer. Definitely makes sense now, thanks.
Logged

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Pages: [1]   Go Up
Jump to: