Go Down

Topic: Tracking multiple RFID tags with the SparkFun Simultaneous RFID Reader- M6E Nano (Read 1 time) previous topic - next topic

lohjianhui

I am using the Arduino Mega with the SparkFun Simultaneous RFID Reader - M6E Nano with an external UHF RFID antenna. I am making a prototype for a security solution for the logistics industry. I need to place an array of RFID tags, say 100 of those, arranged in such a way that they within range of the antenna. I need to be able to count the number of RFID tags every 1min or so, to check if any are missing.

I got all the Arduino SparkFun_Simultaneous_RFID_Tag_Reader_Library examples working for this Sparkfun reader (e.g. Range Test, Constant RFID read) but I am unsure of how to adapt the library to address my specific case. It seems that the RFID reader randomly scans for any tags, often reading the same tag multiple times. How do I use the Sparkfun library to count the number of unique tags?

Right now, I have an idea of adapting the "RFID_Constant_Read" example. My idea is to store EPC numbers into an array. Whenever it gives a EPC number, I will check whether it is already in the array or not. I will only add it into the array if it is not already in the array because it is a new unique tag. After letting the RFID reader do its scanning for about 30 seconds, I will then check the size of the array to determine the number of unique tags. Will this work? I bought Sparkfun RFID tags. A related issue is whether they all have a unique EPC number?

Any code advice would be helpful. I am not a professional engineer or programmer, so some code examples would be great. Attached the library example code I was mentioning about and a screenshot of the output on my Serial monitor..

PaulS

Quote
I am using the Arduino Mega
I know what that is.

Quote
with the SparkFun Simultaneous RFID Reader - M6E Nano with an external UHF RFID antenna
No clue what that is, so you should provide a link.

Quote
I got all the Arduino SparkFun_Simultaneous_RFID_Tag_Reader_Library
Another link needed.

Quote
How do I use the Sparkfun library to count the number of unique tags?
Well, first you need to collect all the tag data in an array. Then, you need to iterate over the array comparing the data at the nth position for the data at the 0th to ni1st positions. If the data at the nth position matches that of a previous position, move the rest of the array up one position, and decrement the count of used array positions. When you get to the end of the array, all the elements will contain unique values, so you know how many there are.

Quote
Right now, I have an idea of adapting the "RFID_Constant_Read" example. My idea is to store EPC numbers into an array. Whenever it gives a EPC number, I will check whether it is already in the array or not. I will only add it into the array if it is not already in the array because it is a new unique tag. After letting the RFID reader do its scanning for about 30 seconds, I will then check the size of the array to determine the number of unique tags. Will this work?
Yes, if the RFID_Constant_Read example does what I expect it to do. Of course, I have no way of knowing whether it does, or doesn't.

Quote
I am using the Arduino Mega
Code: [Select]
#include <SoftwareSerial.h> //Used for transmitting to the device

SoftwareSerial softSerial(12, 13); //RX, TX

These just do NOT go together.

Code: [Select]
  if (setupNano(38400) == false) //Configure nano to run at 9600bps
That is NOT what that code does.

Currently, that code starts reading at the end of setup(). You'll need to move that to loop(), and determine what the appropriate action is to take after the desired scanning interval. Whether there is a method to stop reading, or whether you simply need to clear some variables and/or arrays, I couldn't tell you, without knowing more about the library.

Why is the instance of the RFID class called nano?
The art of getting good answers lies in asking good questions.

lohjianhui

Thanks for the reply. This issue has been resolved. Yes the algorithm you suggested is essentially the solution and I managed to implement it successfully. You can see the tested working code here:
https://github.com/lthben/raitong_RFID_Constant_Read/blob/master/raitong_RFID_Constant_Read.ino

pierlau38

Dears,

I am trying to use the same M6E Nano with a Arduino mega but I face issue setting the communication between MEga and RFID Shield.

what wiring did you use ? seems that for Softwareserial we can't use pin2. In your code, it seems that you chose to go with 12 and 13. Was it working ?


Today : I have wired : GNB +5V and pin 12/13 on the mega to RX/TX on the shield but still no communication (SW/HW UART shitch in SW position) ?

What baud rate for the shield should be consider when no communication has been possible ?


Any clue about this issue ?

Thanks

Pierre

PaulS

Quote
seems that for Softwareserial we can't use pin2.
Why are you using SoftwareSerial on a board with 4 hardware serial ports, only one of which is currently being used?
The art of getting good answers lies in asking good questions.

pierlau38

Good question !

Only because it is the way the example are provided with the board.
Based on your answer I will try to figger out how I can make use of the 'hardware' serial port and  associate board to board connection

Thanks

Pierre

Go Up