Hello, I’m having a problem getting my reader to pull the correct user data. I’m using example 1, and example 4. With example 4, it works correctly and produces the correct hex “30 30 32 39” (0029), but when I use example 1 it instead produces “00 00 01 29”. I can’t figure out why it is doing this. The code behind pulling the user data is the same in example 1 and example 4 as far as I can tell.
Any help would be greatly appreciated! I haven’t changed either example other than reducing the bytes from 64 to 4 (and even at 64 got the same issue), and adjusting the read dBm.
My setup is:
M6E Nano Simultaneous RFID Reader SEN-14066
SparkFun RedBoard DEV-13975
UHF RFID Antenna WRL-14131
UHF RFID Tag WRL-14147
Setup is on additional wall power, with the read dBm set to 20dBm.
with startReading() (example1) it will only read the EPC and some meta-data from the reader. With readUserData() (example4) it will only read the complete userbank.
Oh, that’s odd. What’s the purpose of this code then (this is from Example1)? Is there a way to get it working? I’ve even tried getting rid of everything except the //Print User Data portion, and it still only produces 00 00 01 29.
//Print User Data
Serial.print(F("Size ["));
Serial.print(myDataLength);
Serial.print(F("] User data["));
for (byte x = 0 ; x < myDataLength ; x++)
{
if (myData[x] < 0x10) Serial.print(F("0"));
Serial.print(myData[x], HEX);
Serial.print(F(" "));
}
Serial.println(F("]"));
From the else if statement below:
byte responseType = nano.parseResponse(); //Break response into tag ID, RSSI, frequency, and timestamp
byte myData[4];
byte myDataLength = sizeof(myData); //Tell readUserData to read up to 64 bytes
if (responseType == RESPONSE_IS_KEEPALIVE)
{
Serial.println(F("Scanning"));
}
else if (responseType == RESPONSE_IS_TAGFOUND)
{
//If we have a full record we can pull out the fun bits
int rssi = nano.getTagRSSI(); //Get the RSSI for this tag read
long freq = nano.getTagFreq(); //Get the frequency this tag was detected at
long timeStamp = nano.getTagTimestamp(); //Get the time this was read, (ms) since last keep-alive message
byte tagEPCBytes = nano.getTagEPCBytes(); //Get the number of bytes of EPC from response
Serial.print(F(" rssi["));
Serial.print(rssi);
Serial.print(F("]"));
Serial.print(F(" freq["));
Serial.print(freq);
Serial.print(F("]"));
Serial.print(F(" time["));
Serial.print(timeStamp);
Serial.print(F("]"));
//Print User Data
Serial.print(F("Size ["));
Serial.print(myDataLength);
Serial.print(F("] User data["));
for (byte x = 0 ; x < myDataLength ; x++)
{
if (myData[x] < 0x10) Serial.print(F("0"));
Serial.print(myData[x], HEX);
Serial.print(F(" "));
}
Serial.println(F("]"));
//Print EPC bytes, this is a subsection of bytes from the response/msg array
Serial.print(F(" epc["));
for (byte x = 0 ; x < tagEPCBytes ; x++)
{
if (nano.msg[31 + x] < 0x10) Serial.print(F("0")); //Pretty print
Serial.print(nano.msg[31 + x], HEX);
Serial.print(F(" "));
}
Serial.print(F("]"));
Serial.println();
}
paulvha:
with startReading() (example1) it will only read the EPC and some meta-data from the reader. With readUserData() (example4) it will only read the complete userbank.
I checked out the library and didn’t really see anything that worked for this. All I’m trying to do is run the constant read for user data. I can’t figure out what arduino wants to do this. I can get it to give me only user data, but the user data it returns in junk. Like I mentioned, I have no idea why it’s doing this as the code for the user data is the same as in example 4, which pulls the correct user data. I’m not sure what I’m missing here, I don’t see anything in the code that should be messing with myData.
Output of Example 4:
15:23:15.915 -> Initializing...
15:23:15.949 -> Press a key to read user data
15:23:18.974 -> Size [4] User data[30 30 32 39 ]
Output of Example 1 with all but userData commented out (data is the same even when left untouched):
15:28:27.943 -> Press a key to begin scanning for tags.
15:28:31.876 -> Scanning
15:28:32.688 -> Size [4] User data[00 00 01 22 ]
You get rubbish as the user data is NOT read from the tag in example1, only the EPC.
Follow the link from my previous post. Remove the current Sparkfun library and install mine. It is an extended version of the SParkfun library with many more examples and features. Use example16.