After mining the forums I've yet to see a fully working arduino sketch that demonstrates the use of the Parallax RFID Read/Write module. I was hoping that someone on this forum might be able to shed some light onto this issue and help what appear to be a sizable group of people out. For more background please see:
http://www.arduino.cc/cgi-bin/yabb2/...1285104792/all
I've basically tried the code posted on the above forum but seem to get read errors associated when a tag is placed in proximity to the reader. At this point I am not trying to write, only read. After diving into the documentation and looking at the returned error codes I am usually getting errors 2 and 3 followed by the occasional 7 (parity error).
I am using the following products specifically:
28440 RFID Read/Write Module
28142 50mm Round RFID Tag
Am I just a bonehead and using the wrong tag or is there something more wrong?
Below is the code that is run on the arduino. For the record I'm running using an Arduino Pro 5V/18MHz. I've tried running the system using the USB port and also from an external supply.
Cheers,
Brian
#####################
//Interface Arduino USB with Parallax 125 Khz UART RFID Reader/Writer
#include "NewSoftSerial.h"
#define rxPin 8
#define txPin 6
//Reader/Writer Commands
#define RFID_READ 0x01
#define RFID_WRITE 0x02
//Memory Locations for Data
#define DATA_ADDR_0 3
#define DATA_ADDR_1 4
//Error Codes
#define ERR_OK 0x01
NewSoftSerial mySerial(rxPin, txPin);
char statusCode;
void setup()
{
Serial.begin(9600);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
Serial.println("RFID Read/Write Test");
}
void loop()
{
Serial.println("Reading Tag Data...");
//1st 4 bytes
mySerial.print("!RW");
mySerial.print(RFID_READ, BYTE);
mySerial.print(32, DEC);
while(mySerial.available())
{
//this is where it halts..
}
Serial.print("Read Status:");
statusCode = mySerial.read();
if(statusCode == ERR_OK)
{
Serial.println("OK");
Serial.print("RFID Data:");
Serial.print(mySerial.read(), BYTE);
Serial.print(mySerial.read(), BYTE);
Serial.print(mySerial.read(), BYTE);
Serial.println(mySerial.read(), BYTE);
}
else
{
Serial.print("NOT OK. Error Code:");
Serial.println(statusCode, HEX);
}
}



Reply With Quote



Bookmarks