Pages: [1]   Go Down
Author Topic: UHF-RW-MP-232-V1 - UHF tag reader help.  (Read 5335 times)
0 Members and 1 Guest are viewing this topic.
Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello All,

First im extremely new to Arduino smiley i have only done a couple of small projects that have worked great!

So i bought 2 of the UHF-RW-MP-232-V1 readers with the idea of creating a cattle management program. So ive started this to get help when i cant get things working on my own smiley-wink

So i started by connecting the reader to a Arduino pro mini and after some reading i got it to read card data smiley-grin
Every read is consistent(obviously with one or two miss reads) but my current problem is that the values i read via the pro mini and the values read by the Demo program (on the PC) do not match, example:
Demo reads   - 07 . 00 . EE . 00 . 94 . 7B . 00 . BD which is ( 07  00 238 00  148 123  00  189 )
Arduino reads- 7C . 23 . FF . D7 . 9   . FF . 85 . 0   which is (124 35 255 215 9    255 133  0

I have read and tried a lot of different approaches but just cant see how to get the same values from demo program and Arduino.

Here is the code im currently using:

Code:

#include <SoftwareSerial.h>
const int SerInToArdu=2; //Defines pin data passes
const int SerOutFrmArdu=3; //Not used, but
SoftwareSerial mySerialPort(SerInToArdu,SerOutFrmArdu);
int myCount =0;
void setup()
{

Serial.begin(9600);//For access to serial monitor channel
Serial.println("Bring an RFID tag near the reader...");
mySerialPort.begin(57600);
 pinMode(13, OUTPUT);


};

void loop()
{
int incomingByte(0);

if (mySerialPort.available() > 0) {

    for(int i=0; i < 10; i++)
    {
       
incomingByte = mySerialPort.read();
              Serial.print(incomingByte);
             
    }
     
  };
}



This has been cut down to just show the bare code doing the reading and printing, but im sure its some encoding problem, or something.

Your help is greatly appreciated smiley-grin

Willie


« Last Edit: December 16, 2012, 02:29:47 am by willievmobile » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You check if there is at least one byte and you start reading 10.

Check for available >=10  iso >0

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You check if there is at least one byte and you start reading 10.

Check for available >=10  iso >0



Thanks Robtillaart,
yes i check to see if there is a byte with the
Code:
if (mySerialPort.available() > 0) {

I read 10 just coz i know its less, no other reason..

i dont understand iso>0 im googling it now.

any other ideas why the two reads are different?

thanks guys smiley-wink
Willie
« Last Edit: December 16, 2012, 08:06:58 am by willievmobile » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In this piece of code you check if there is at least one byte available and you read 10. So it tries to read something that may not be there.
Code:
if (mySerialPort.available() > 0) {

    for(int i=0; i < 10; i++)
    {
       
incomingByte = mySerialPort.read();
              Serial.print(incomingByte);
             
    }
     
  };

When checking there are 10 available you will know that you can read 10.
Code:
if (mySerialPort.available() >= 10)
{
  for(int i=0; i < 10; i++)
  {
    incomingByte = mySerialPort.read();
    Serial.print(incomingByte);
   }
}

 iso ==> Instead of

The reads might be different as the polarity of the signal might be inverted (0=>1  1=>0), although it does not look like that

Does the signal has some kind of start byte to detect begin of transmission?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Rob,

yes sorry i didnt say, i have done the reading with a lot of different read lengths, i just did the 10 to make sure i dont miss anything....

below is the info from the reader protocols which should be relevant to this question:

Quote
8.2.2 Read Data
The command is used to read part or all of a Tag’s Password, EPC, TID, or User memory. To the word as a
unit, start to read data from the designated address.
15
Command:
Len   > Adr  > Cmd > Data[] > CRC-16
0xXX > 0xXX > 0x02 > ——     >LSB MSB
Data as follows:
Data[]
ENum > EPC     > Mem > WordPtr > Num > Pwd   > MaskAdr > MaskLen
0xXX > Variable > 0xXX > 0xXX     > 0xXX > 4Byte > 0xXX      > 0xXX
Parameter Connect:
ENum: EPC length,in word units. The length of EPC is less than 15 words, can be 0 or 15. Otherwise, it
returns the parameters error message.
EPC: Be operated tag’s EPC number. EPC length according to the decision of the EPC number, EPC
numbers in word units, and must be an integer number of lengths. High word first, the high byte of each word first.
Requirement given here is a complete EPC number.
Mem: One byte. It specifies whether the Read accesses Password, EPC, TID, or User memory. 0x00:
Password memory; 0x01: EPC memory; 0x02; TID memory; 0x03: User memory. Other values reserved. Other
value when error occurred.
WordPtr: One byte. It specifies the starting word address for the memory read. For example, WordPtr = 00h
specifies the first 16-bit memory word, WordPtr = 01h specifies the second 16-bit memory word, etc.
Num: One byte. It specifies the number of 16-bit words to be read. The value is less then 120, can not be 0.
Otherwise, it returns the parameters error message.
Pwd: Four bytes, they are Access Password. The most significant word of Access Password is first, the most
significant byte of word is first. The first bit of 32-bit access password is left, and the last bit of 32-bit access
password is right. Only done the memory set to lock and the Tag’s Access Password is not zero, it needs right Pwd.
In other cases, Pwd can be zero.
MaskAdr: One byte, it specifies the starting byte address for the memory mask. For example, MaskAdr =
0x00 specifies the first EPC bytes, MaskAdr = 0x01 specifies the second EPC bytes, etc.
MaskLen: One byte, it is the mask length. That a Tag compares against the memory location that begins at
MaskAdr and ends MaskLen bytes later. MaskAdr + MaskLen must be less the length of ECP number.
Otherwise, it returns the parameters error message.
Notes: That a tag compares against complete EPC number when the MaskAdr and MaskLen vacant.
Respond:
Len   > Adr   > reCmd > Status > Data[]                > CRC-16
0xXX > 0xXX > 0x02    > 0x00   > Word1,Word2,… > LSB MSB


So the reader returns the Len (of data) , adr( of the reader which is 0x00) , reCmd > Status > Data[]> Checksum.

but there is no defined starting bit that i can look for smiley-sad

the structure of that return is however the same as the Demo program gave:
07 . 00 . EE . 00 . 94 . 7B . 00 . BD

but not the same as im reading from arduino :'(

i even tried deducting 48 off the incoming byte to see if its not ascii but didnt work.

any advice is greatly appreciated smiley
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


What if you try to read the datastream with a terminal program on the PC e.g. - putty.exe hyperterminal etc ?

Does it give the same data as the Arduino? Or as the PC demo program?

I assume the PC demo program interprets the header of the stream and the Arduino isn't.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Rob

Ok i did a putty serial and got :
Code:
î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½î{½
I set the baud-rate right so its not a erroneous reading.  smiley-sad-blue
i really dont know anymore, the readings are consistent but just dont match up to the Demo.
The demo gets the returns a byte array like this:
This happens everytime a timer ticks to get the reader scan:
Code:
        Dim ScanModeData(40960) As Byte
        Dim ValidDatalength, i As Integer
        Dim temp, temps As String
        ValidDatalength = 0
fCmdRet = StaticClassReaderB.ReadActiveModeData(ScanModeData, ValidDatalength, frmcomportindex)
        If (fCmdRet = 0) Then
            temp = ""
            temps = ByteArrayToHexString(ScanModeData)
            For i = 0 To ValidDatalength - 1
                temp = temp + temps.Substring(i * 2, 2) + " "
            Next i
            listBox3.Items.Add(temp)
            listBox3.SelectedIndex = listBox3.Items.Count - 1

does this mean i need to send that command the the reader every loop?
and why then would it give data on serial if thats required>?
i would have thought it needs to be setup once and then it will work without a query sent every loop??


thanks again
willie

Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 168
Posts: 12430
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Does the demo program come with source code?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Morning smiley-grin

yes it comes with source but uses a DLL for all functions and communication.

there is a protocol.PDF that explains how the reader communicates but doesn't really help me as maybe im not interpreting it correctly....

they all can be found at :
http://www.rfidshop.com.hk/uhf10.html
the protocol file is in the SDK.

Im thinking that im also missing something on receiving BYTES from the reader, im reading up on it and trying everything i read! haha!

the biggest problem is the fact that i cant find a starting byte, which is making life very difficult!

Thanks again for the help!!!
Willie
Logged

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just some more info,

in the protocol manual it says:
Quote
The reader communicates with host (MCU,MPU,Controller) using serial communication interface RS232 or
RS485 and complete corresponding operation according to the host command. The communication parameter is
57600bps 1 start bit, 8 data bits, 1 stop bit without parity check bit. In the process of serial communication, the
least significant bit of one byte is transmitted first and the least significant byte of command data sequence is
transmitted first.

But i cant find any mention of what that starting bit will be.

im so  smiley-yell i dont know what is going on.

Really hoping someone has some good guesses?
Logged

Africa
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

out of pure curiosity dont i need someting like a max232 chip to talk to the reader?
dont have a clue why im getting these values.

im starting to write code to send info to the reader and then read the reply to see if that works.
at the moment im reading about crc16 check but not understanding the code very well will try some more then post if i get it working or if i donr smiley-wink


im also seriously considering moving interface to wiegand and see if that would be better?

cheers
W
Logged

Pages: [1]   Go Up
Jump to: