RW-210 13.56Mhz Rfid Reader/Writer

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 :-[

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

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

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

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:

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

Thank you Daniel for your patience :slight_smile:
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

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

hello,

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

Regards, Loïc

HI

software is not really my thing :wink: , 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

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

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)

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

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

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 :slight_smile: 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.

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

@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 :cry: 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

hey

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

D


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

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. :-[

I'm on OS X, I tryed the test application under Parallels, but I can't get the serial port to work in parallels (but that's an other issue). The fact that I got sort of a reply in Zterm makes me believe that there's no hardware error.

Thanx anyway Daniel :slight_smile:

Grtz, Loïc

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...

If you mean the arduino serial monitor, if you print 0xFA and see the characters "250", then something is wrong. Hmm, I gave you the wrong function call; I should have said serial.print(0xfa, BYTE); (I left out ", BYTE"). Sorry about that.

You mention monitoring the communication between the Arduino and the RFID with the arduino serial monitor. What is the hardware configuration there?

You cannot drive rs232 signals from multiple sources, so if you are using the Arduino NG you must disconnect power to the FTDI chip so that the RFID is the only thing driving the arduino's RXD, and vice versa for the RFID's RXD.

If you simply hook the RFID to pins 0 and 1 while the USB chip is still active, you will have unreliable or nonexistant communications.

-j

SUCCES! SUCCES! SUCCES! ;D
Thank you sooo much kg4wsv. After uploading this

void setup() {
  Serial.begin(19200);
}

void loop() {
Serial.print(0xfd, BYTE);
delay(50);
Serial.print(0xfc, BYTE);
delay(50);
}

the red led flashes real fast so at last communication has been established. Now I'll try to read the rfid tags. I'll post every progress.

Euforic regards, Loïc

I'll post every progress.

hey, you know we have an unwritten rule that if you get more than ten responses, you have to write the results up in a tutorial for the Playground? ;D

D

I'll be glad to do that. :wink: