December 7

How an RFID Reader Sorts Tags


When scanning RFID tags, the RFID reader needs some way to differentiate between tags when there is more than one within its read range. An example would be if a department store employee took an RFID handheld reader (such as a CS101) and scanned a rack of jeans (all labeled with RFID tags, of course). There may be 20 pairs of jeans on the rack, and the reader needs to be able to count them all separately. How can this be done? With some help from mathematics.

The ‘Q’ algorithm

Over time RFID has graduated to its second generation, titled Gen 2. As part of the protocol in Gen 2, an algorithm has been created to help differentiate tags even better than in the past. This algorithm is called “the Q algorithm,” and is made up of basic algebra. Let’s break it down.

When an RFID reader sees tags, it tells the tags to generate two random numbers. It says to the cards:

1) Generate a number between zero and 65,535.

2) Generate a number between zero and 2 to the power of Q (or 2Q), then take away 1.

The first step is simple, and always the same: generate a number between zero and 65,535. The second step changes based on what the Q parameter is. For example, if the reader sets the value of Q at 5, then what the reader is telling the tag to do is pick a random number between zero and 2 to the power of 5, (which equals 32), and take away one (making 31). So, after all the math is done, we see that when Q=5, the reader is telling the tag to choose a number between zero and 31.

Who’s First?

Now that the tags have chosen their two numbers, the reader asks all of the tags if any of them chose zero as their second random number (the number they had to choose after learning the Q value). If one of them did, then they raise their hand, show the reader their first number (the one between zero and 65,535), and are acknowledged by the reader. At this point the reader could just count the tag as “present,” read the tag’s information or assign the tag some information.

Once this is done, the reader tells the remaining tags to subtract one from their second random number, and asks if any of the tags now has a zero as their number (so, if one of the tags had chosen a ‘1’ as their random number before, they are now a ‘0’ and are raising their hand to the reader). And the process continues.


If no tags raise their hand to say their second number is zero, then the reader will tell all of the tags to once again subtract one from their number. If still not getting any raised hands from the tags, the reader will continue telling the tags to subtract one until one of the tags finally hits zero. On the other hand, if more than one tag responds with zero, then the reader can’t read either tag. It then tells the tags “forget it, wait ‘til you hear back from me.” At this point – if the reader is set up this way – it will ask the tags to pick numbers again, and start the process over, until all tags have been acknowledged by the reader.


You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Get in touch

0 of 350