RFID Sensor Zero Bytes

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

RFID Sensor Zero Bytes

Postby PrettyFly » Tue Jun 12, 2012 12:26 pm

Hi,

I am currently working with the Lego RFID Sensor which is supported by LeJOS.
I am using the latest LeJOS version (0.9.1).

When I read transponders it sometimes happens that Bytes are falsely read as 0. This can happen for the last or the first Bytes but always in a row and I always get correct Bytes with it too.
i.e. if the correct value is 1-2-3-4-5 I might get 1-2-3-4-5 correctly or I might get something like 1-2-3-0-0 or 0-0-0-4-5 or 0-2-3-4-5.
The only workaround I have so far is to read about 5 times and take the value with the most occurences as most of the time the sensor returns the correct values. You cannot check for falsely recognized zeroes as there are transponders with zeroes in it....

I have tried the readTransponder and the readTransponderAsLong methods both with continuous reading switched on and off.


Has someone experienced the same problems so far or has any idea what to do in this case? It might even be a hardware problem so I can t do much about it....


Thanks,
PrettyFly
PrettyFly
New User
 
Posts: 3
Joined: Tue Jun 12, 2012 12:15 pm

Re: RFID Sensor Zero Bytes

Postby gloomyandy » Tue Jun 12, 2012 1:51 pm

Hi,
the RFID sensor is one of the most badly behaved devices I've ever had to work with, so I'm not surprised you are hitting problems. You have already discovered one solution. Not sure if the tags have any sort of error check code in the encoded id or not, if they have you could use that. Depending upon how many tags you have you may just be able to check for a match against the known set. It seems unlikely that you will have tags that differ just by one or more zero values, and you could check that this assumption holds true.

Oh and you might want to try updating to the very latest 0.9.1 release (see the sticky in the software forum), as I fixed an i2c bug that may impact this...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: RFID Sensor Zero Bytes

Postby skoehler » Tue Jun 12, 2012 2:21 pm

gloomyandy wrote:Oh and you might want to try updating to the very latest 0.9.1 release (see the sticky in the software forum), as I fixed an i2c bug that may impact this...

Andy refers to 0.9.1-3 downloadable here:
https://sourceforge.net/projects/lejos/ ... 0.9.1beta/
skoehler
leJOS Team Member
 
Posts: 1128
Joined: Thu Oct 30, 2008 4:54 pm

Re: RFID Sensor Zero Bytes

Postby PrettyFly » Mon Jun 18, 2012 3:17 pm

Thank you I will try if an update helps.

My best solution so far ist to return zero if just zeroes are read as in this case it is most likely that there is no RFID tag to read in front of the sensor.
And if I read anything I read again 5 times and take the biggest value read. As the wrong values always have to many zeroes they are always smaller (converted to long) than the actual value. This is the fastest solution so far and it works most of the times as the sensor gets wrong values about 1 out of 10 times.


Edit: I forgot...regarding your ideas: The tags do not have any checks values so that is not possible. It would be possible to check for a pool of values but if you get like 3 zeroes out of a 5 byte array it is likely that you won t find the correct value even if you just have a pool of about 30 tags.

Edit 2: I just realized that I m already using 0.9.1 beta3 so this does not fix the problem. :-(
PrettyFly
New User
 
Posts: 3
Joined: Tue Jun 12, 2012 12:15 pm

Re: RFID Sensor Zero Bytes

Postby gloomyandy » Mon Jun 18, 2012 3:39 pm

and do you have a pool of 30 tags? Most people only have two or three? But even with 30 tags it would still give you a way to decide if what you have read is valid or not, if it is not valid read it again and keep doing this until you do get a valid one. I seem to remember that you can read reasonably fast. Oh and make sure that it does not power off (it has some sort of power saving mode), if it does power off make sure you have woken it up. I think the driver does this already but it has been a long time since I used it other than for testing. I don't remember getting that many misreads though. Are you using the tags supplied with it?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: RFID Sensor Zero Bytes

Postby skoehler » Mon Jun 18, 2012 5:04 pm

You can try the NXC driver, which is available on the manufacturers homepage: http://www.codatex.com/index.php?en_RF_ID_Sensor-1
Report back, if it behaves different and/or review, whether the leJOS driver implements roughly the same logic as the NXC driver.

Actually, how is this device to behave when multiple RFID tags are in range? Does it do an inventory of the Tag IDs and then returns the data of the closest tag or something like that?
skoehler
leJOS Team Member
 
Posts: 1128
Joined: Thu Oct 30, 2008 4:54 pm

Re: RFID Sensor Zero Bytes

Postby PrettyFly » Mon Jun 18, 2012 5:56 pm

@gloomyandy:
Yeah I have a pool of 30 tags but there are more to come....basically what I m doing is writing some programs to get a "Real Life Pac-Man". I cannot check against that pool as there might come additional maps for the game and the values of the tags are therefore stored on a remote server. Communication with the server after each reading would take much too long. Also I m working with Android phones for controlling the robot and there shouldn t be too much logic on the robot in order to be portable to other robots some day...
Waking up the sensor is already implemented and I m not using the supplied tags. I have credit card sized tags but they work on the same frequency (125kHz), have a 5 Byte value and are of type EM4102. So they are pretty much the same as the supplied ones, but they are a bit cheaper and orderable in bigger quantities.

@skoehler
I cannot use the NXC driver as I have a framework running on LeJOS for communication with my android smartphone. So I need to stay with LeJOS.
If I have multiple tags in range the device will give me a value from one of the tags. Seems to select the tag randomly or at least I couldn t figure out which one it selects. Likely it s the first tag that responds. That does not have to be the one nearest to the sensor so you never know which value you will get when you have 2 tags in range. Might be a funny idea for true randomness. ;-)



The 'biggest value algorithm' works pretty good for now so I guess I will stick with this solution. It s fast and gets the right values, however it s not such a 'clean' solution....


btw gloomyandy your first comment made me laugh so hard as it s exactly what I was thinking for the last weeks. I m doing all this work for my masterthesis would you mind if I cite you with this sentence:
Hi,
the RFID sensor is one of the most badly behaved devices I've ever had to work with, so I'm not surprised you are hitting problems.

:D :D
PrettyFly
New User
 
Posts: 3
Joined: Tue Jun 12, 2012 12:15 pm

Re: RFID Sensor Zero Bytes

Postby skoehler » Mon Jun 18, 2012 6:30 pm

PrettyFly wrote:@skoehler
I cannot use the NXC driver as I have a framework running on LeJOS for communication with my android smartphone.

I actually wasn't suggesting that you switch from leJOS to NXC. I was suggesting, that you check whether the NXC driver has the same issue - and if it does not, workout why the leJOS has an issue.
skoehler
leJOS Team Member
 
Posts: 1128
Joined: Thu Oct 30, 2008 4:54 pm

Re: RFID Sensor Zero Bytes

Postby gloomyandy » Wed Jun 20, 2012 7:03 pm

Hi,
Have you tried running the leJOS RFIDTest sample application? What happens when you do? I've just run this using the two RFID sensors I have and the four tags that came with them and have seen no sign of misreads or 00 values being inserted. Have you tried using the tags provided with the sensor and with this test? Do you see misreads with these tags or only with your own tags?

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3012
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff