ATrappmann / PN5180-Library

PN5180 library for Arduino
GNU Lesser General Public License v2.1
104 stars 92 forks source link

Multiple readers with incorrect corresponding UID #31

Open kaichunchou opened 4 years ago

kaichunchou commented 4 years ago

I have two tags and two readers. Everything looks good when I put two tags on two different readers.

However, when I am trying to move tag#2 away from reader#2 to a distance that the reading is not stable. The UID reading( getInventoryon() ) of tag#2 will toggle randomly between No Card, tag#2 uid, and "tag#1" id. Tag#1 is certainly far away from the reader#2. What might be the cause to the problem?

With only one reader and one tag, if I try to move the tag away from the reader, the reading would toggle randomly between No Card, tag id. This makes sense to me and is the behavior I expect.

With 6 readers and 6 tags, when I try to move tag#3 away, the following readings would appear randomly:

1(stable readings when every tag is placed correctly: tag#1, tag#2, tag#3, tag#4, tag#5, tag#6 2(move tag#3 far away from the reader): tag#1, tag#2, NoCard, tag#4, tag#5, tag#6 3~ (move tag#3 away from the reader to a distance that the reading is unstable. 3: tag#1, tag#2, tag#3, tag#4, tag#5, tag#6 4: tag#1, tag#2, NoCard, tag#4, tag#5, tag#6 5: tag#1, tag#2, tag#2, tag#4, tag#5, tag#6 6: tag#1, tag#2, NoCard, tag#2, tag#5, tag#6 7: tag#1, tag#2, NoCard, tag#4, tag#5, tag#5

It seems like sometimes the reader would read the previous value when a tag is placed at an awkward distance.

A quick workaround is to call getInventory() twice for each reader. This made the reading more stable.

bodomliu commented 2 years ago

I have the same problem.

kaichunchou commented 2 years ago

@bodomliu The buffer is static being shared by all class instances. The workaround I did is to reset the buffer manually in readData function. This makes the false readings stick to its reader.