Go Down

Topic: RW-210 13.56Mhz Rfid Reader/Writer (Read 5 times) previous topic - next topic

Loic

Aug 04, 2007, 06:50 pm Last Edit: Aug 04, 2007, 07:14 pm by Loic Reason: 1
Hi everybody,

I've been a happy learning Arduino user for 1 year now so I decided to do something a bit more challenging. I've bought a 13.56 Mhz rfid reader from APSX (http://www.apsx.com/RW210.aspx). I decided to go for this reader after reading this blog article http://www.digitaldawgpound.org/nick84/post=189 . The reader works by sending it a command via serial and then it sends the rfid code back. To test the serial connection I tried to send the "FD" command wich should turn on the red onboard led. I've already been trying to get it to work for 3 weeks now and I'm still not getting anywhere. To check for an Rfid tag you should send "FA". From what I've understood all these commands should be sent in HEX format.

This is what I have so far  :-[
Code: [Select]
void setup() {
 Serial.begin(19200);
}

void loop() {
 int on = 253;
 int off = 252;
 Serial.print(on, HEX);
 delay(500);
 Serial.print(off, HEX);
 delay(500);
}


This a pdf with an overview of all the commands: http://www.apsx.com/documents/directalk.zip
This the working Basic Stamp code from the DigitalDawgpound blog article: http://www.digitaldawgpound.org/wp-content/uploads/2007/03/rw210_rfid_reader.bse

Could someone please help me get a bit further in communicating with this great Rfid reader?

Kind Regards, Loïc

Daniel

#1
Aug 04, 2007, 07:47 pm Last Edit: Aug 04, 2007, 08:02 pm by Daniel Reason: 1
hi

there is code in the PLaygorund to make the Parallax RFID work. It's a similar process.

What you have above will just send some data, it doesn't receive anything. You'll need some kind of loop to check the serial port to see if data has come back from the RFID. Usually this is something like
while (Serial.available != -1) {}

A 500ms delay is a lifetime in serial, try not to use them at all if possible. Third, you need ot check the character encoding (DEC, BIN, HEX) etc to see that you're sending the data in the right format



D

Loic

#2
Aug 04, 2007, 08:10 pm Last Edit: Aug 04, 2007, 08:43 pm by Loic Reason: 1
Thank you for your reply Daniel but I think there is a misunderstanding
The Parallax RFID reader is enabled by just "giving LOW" to a certain pin, this reader is enabled by a serial command. This is exactly the problem that I'm having, I'm having trouble sending the serial command. The example code that I posted was just to test serial communication by just blinking the red onboard led. After this issue is sorted I can proceed with sending the "FA" command and read the resulting Tag code. The problem now is only getting the arduino talk to the reader. I'll be happy to provide more details if necessary.
Regards, Loïc

Daniel

#3
Aug 04, 2007, 08:45 pm Last Edit: Aug 04, 2007, 08:51 pm by Daniel Reason: 1
Hi Loic,

sure, I understand. What do you need to know then? I gave the parallax as an example because it's the same process: request data and read data. It has most of the code you would need to read back the data from the RFID.

What part do you need help with? Does straight serial not work to make the request to the RFID?

Seems like you just need something like this, in pseudo-paper-napkin code:

Code: [Select]
void setup(){
Serial.print ()  \\ use appropriate values to initialize RFID
}


void loop(){
Serial.print ()      \\ use appropriate values to request data

while(Serial.available != -1){  \\ if serial port has data , get it

// put some code here to  parse the data from the RFID.

}

}


You can use the Arduino Serial monitor in the software  to get the transmit codes working correctly, and to see what comes back from the
Arduino.

D

Loic

#4
Aug 04, 2007, 11:42 pm Last Edit: Aug 04, 2007, 11:49 pm by Loic Reason: 1
Thank you Daniel for your patience  :)
Straight serial doesn't work... Via the serial monitor I see the right output but the rfid reader keeps quiet . I tested it with a second reader to make sure it was not a hardware malfunction. Mayby I have to use software serial or the Wire lib?  The FAQ of APSX http://www.apsx.com/FAQ.aspx says the reader needs 19200baud 8N1 TTL but I guess this is pretty standard.
Kind Regards, Loïc

Daniel

hi

those are the default Arduino baud settings: 8N1.

Have you tried sending the request sequence in different formats? Eventually you will see the correct response in the  serial window.

D

Loic

hello,

I've tryed a lot of different formats and no result  :( I'm sending the "FD" command wich should light up the onboard led...

Regards, Loïc

Daniel

#7
Aug 05, 2007, 03:08 am Last Edit: Aug 05, 2007, 03:27 am by Daniel Reason: 1
HI

software is not really my thing  ;) , but it strikes me that "FD" is actually a string composed of "F" and "D", so whatever you are sending has to be in string format. Seeing as this is software though, I could be completeley wrong.

D

PS: I would also check if the hardware is wired and configured right, by using a terminal program to send the FD/FD commands.
You can just pull the Atmega out of the Arduino and use the board as an interface; if you do this, the RX pin becomes the TX data from the host, etc. Serial is a headache huh? I wonder how invented it.
D

Loic

#8
Aug 05, 2007, 05:13 pm Last Edit: Aug 05, 2007, 07:02 pm by Loic Reason: 1
Hi,

I've tryed to do something with the "string" formater but to be honest it's just plain guesswork and it's still not giving any results. The FAQ of APSX explains this
Quote
Bytes or Chars?: You need to be able to send and receive in bytes not chars. Chars does not cover all byte needs of the system.
And when I go true the DigitalDawgpound article (http://www.digitaldawgpound.org/nick84/post=189) it states that you have to send in HEX and not ASCII. So basically my problem is putting all this information together and translate this in the wright arduino commands.
I've found someone on the internet who has eventually succeeded in getting the RW-210 to work with an AVR microcontroller. I've contacted him and he send me this BASCOM AVR code (it covers the whole rfid reading process, but it's interesting to see how to send a command, here it is the FB command for fast reading. I will first try to send the FD command to serial communication)
Code: [Select]

i've opened two pins of the portD (PORTD.3 and PORTD.4)
the first one for output and the second one for input and so i've plugged directly the APSX RX210 reader to these pins.

Open "comd.3:19200,8,N,1" For Output As #3
Open "comd.4:19200,8,N,1" For Input As #4

commands can be sent with the PrintBin() function
example:
sub ScanRFID()
dim B as byte
dim S as string * 20

 B = &HFB
 printbin #3, B
 s = ""
 for i = 1 to 7
   B = waitkey(#4)
   ID(i) = B
   s = s + hex(B) + " "
 next i
 print #1, S; ' #1 is an other output device (a wireless module for getting in touch the robot and a PC)
end sub


Can someone help me find the proper way of sending the command?

Kind Regards, Loïc


Update:

I've been digging a bit deeper in the Arduino reference and I've found this PrintHex and PrintByte command. Looking at the Bascom code I tryed this
Code: [Select]
void setup() {
 Serial.begin(19200);
}

void loop() {
 int b = -4099;
 printHex(b);
}


The -4099 is "&HFD" converted from hex to decimal ("&H" is used in the Bascom code and "FD" is the command for lighting the red led). This resulted in the red led lighting for a brief moment wich is different from what happened in the past. I don't know if this is usefull but I'm trying every possibillity.

cheers, Loïc

Daniel

#9
Aug 05, 2007, 08:56 pm Last Edit: Aug 05, 2007, 08:56 pm by Daniel Reason: 1
Hi
I think you may be getting close....

What we need here is someone who knows code. Hopefully they'll read this far through the thread :) Hello coder person? Jump in here.

Re sending bytes, there is a standard command for this:
Serial.print(whatever, BYTE);

D

PS: did you try a terminal program like Zterm? I'm sure this would help things, as you can just type in codes until you get the right format.

kg4wsv

I suspect the problem is some confusion on terminology.  The way I read the data sheet and the BASIC example (after a quick glance) is that you want to use Serial.print(0xFA); to send the 8 bits represented by the hex digits FA.  When you do  Serial.print(0xFA, HEX); what you really send is two bytes, values 0x46 0x41, whic are the ASCII values for characters F and A.

I suspect the "send in HEX and not ASCII" terminology is telling you to send them in a binary form, rather than sending a string.  The datasheet reinforces this, at least in my mind.

Anyway, try serial.print(0xfa); and see if that gets you on the right track.

You may also want to try the FF FE FD commands to see if you can make the LEDs blink.  That's actually a bit simpler test, as you have one way communication from the Arduino to the RFID.

-j

Loic

#11
Aug 06, 2007, 12:44 pm Last Edit: Aug 06, 2007, 12:48 pm by Loic Reason: 1
@Daniel: I've tryed speaking to it directly from Zterm and I got some weird and surprising results: At 19200baud->No response. At 38400baud->At last result! red led responses to the FD and FC command but it's not consistent, sometimes no response or response from other random commands... At 115200 the green led gives response to the commands but also to other random commands and not always consistently. I also tryed with other terminal/serial applications like goSerial and these trigger no response at all, strange...

@kg4wsv: I've tryed a number combinations in your format via the atmega168 but its not responding  :'( In the Serial monitor I get the corresponding decimal numbers 250, 253, 252 etc...

Thank you guys for all the effort, I'll keep trying any suggestions.

Kind Regards, Loïc

Daniel

hey

take a picture so we can see what the hardware connections look like...

D

Loic


I soldered the pins on the board.
In case of arduino to rfid: RC rfid to TX arduino, TX rfid to RX arduino
In case of Zterm to rfid: RC rfid to RX "arduino", TX rfid to TX "arduino"
But I doubt that it's a hardware issue..

Loïc

Daniel

#14
Aug 06, 2007, 03:54 pm Last Edit: Aug 06, 2007, 03:55 pm by Daniel Reason: 1
hi

are you on windows? the manufacturer's site has site has software for testing the module.

D

PS: other than that suggestion, I officially throw in the towel.  :-[

Go Up