Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: Parallax RFID Read/Write Module 28440 on: June 01, 2013, 08:19:22 am
The blue tags you are using are the 'legacy' tags so you need to use the RFID_ReadLegacy command (0x0F) in order to get a valid read.

Per the datasheet, "A visual indication of the RFID Read/Write Module’s state is given with the on-board LED (Light Emitting Diode). When the module is successfully powered-up and is in an idle state, the LED will be GREEN; when the module is in an active state (for example, searching for a valid tag or performing an operation on the tag), the LED will be RED."

So the fact that it stays green is no surprise, it means that at least the module is powered up.  Try sending a command and seeing if it flashes red, if so, then you know the Arduino and the tag are communicating. If not, check your comm set up, are Tx and Rx reversed? are you using softwareserial or the older NewSoftwareSerial (yes it is confusing). Try it out on another serial device or on an Uno which this was coded for.

Good Luck
2  Using Arduino / Sensors / Re: Parallax RFID Read/Write Module 28440 on: March 29, 2011, 05:09:30 pm
The two tags that are commented out are from an earlier program which reads the legacy tags. You can also see the hex code for reading a legacy code (0x0F) also commented out. You can pretty much just use the code from the old read only module:

http://www.arduino.cc/playground/Learning/PRFID

To get a read on a legacy tag, hence I didn't bother posting that since its pretty much a solved problem. But as far as I could tell, no one had written any code for the read/write module. Good luck
3  Using Arduino / Sensors / Re: Parallax RFID Read/Write Module 28440 on: March 13, 2011, 08:38:31 pm
Arduino 5v = RFID VCC (Vcc means positive voltage)
Arduino D6 = RFID SIN  (Serial In)
Arduino D8 = RFID SOUT (Serial Out)
Arduino GND = RFID GND (Ground)

Also, Here is the link to the tag writing code, I haven't reposted it cause I'm lazy.

http://forums.parallax.com/showthread.php?129430-Interface-Arduino-to-RFID-Read-Write
4  Using Arduino / Sensors / Re: Parallax RFID Read/Write Module 28440 on: February 24, 2011, 08:35:09 pm
I haven't gotten around to sketching any code to write to RFID tags, but from the documentation provided for the 28440, it should be fairly easy. Just have to watch that the data you're writing is in byte.
5  Using Arduino / Sensors / Re: Parallax RFID Read/Write Module 28440 on: February 19, 2011, 01:01:11 pm
Here is code to read the old (EM4100) tags
Quote
//Interface Arduino USB with Parallax 28440 125 Khz UART RFID Reader/Writer
//Current program reads a legacy tag and lights an LED based on which tag it is.
//Coded by Uberdude

#include "NewSoftSerial.h"
#define txPin 6
#define rxPin 8

//Reader/Writer Commands
//#define RFID_READ 0x01
//#define RFID_WRITE 0x02
#define RFID_LEGACY 0x0F

//Error Codes
//#define ERR_OK 0x01

NewSoftSerial mySerial(rxPin, txPin);
char statusCode;
int  val = 0;
char code[11];     //Note this is 11 for the extra null char?
int bytesread = 0;

//Tags
char TAG1[11] = "0800E28C60";
char TAG2[11] = "0800D9E43E";

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);

  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(txPin, OUTPUT);     //pin 6
  pinMode(rxPin, INPUT);      //pin 8

  Serial.println("RFID Read/Write Test");
}

void loop()
{
  mySerial.print("!RW");
  mySerial.print(RFID_LEGACY, BYTE);
  //mySerial.print(32, BYTE);

  if(mySerial.available() > 0) {          // if data available from reader

    if((val = mySerial.read()) == 10) {   // check for header
      bytesread = 0; 
      while(bytesread<10) {              // read 10 digit code
        if( mySerial.available() > 0) {
          val = mySerial.read();
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading
            break;                       // stop reading
          } 
          code[bytesread] = val;         // add the digit           
          bytesread++;                   // ready to read next digit 
        } 
      } 

      if(bytesread == 10) {              // if 10 digit read is complete
        Serial.print("TAG code is: ");   // possibly a good TAG
        Serial.println(code);            // print the TAG code
      } 
      bytesread = 0;

      if (memcmp(code, TAG1, 10) == 0){
        digitalWrite(2, HIGH);          //light the Green LED
      }

      if (memcmp(code, TAG2, 10) == 0){
        digitalWrite(4, HIGH);        //light the Red LED
      }      
      delay(500);                       // wait for a 1/2 second
      digitalWrite(2, LOW);
      digitalWrite(4, LOW);            //reset LEDs to off
    } 
  } 

6  Using Arduino / Sensors / Parallax RFID Read/Write Module 28440 on: February 19, 2011, 12:59:50 pm
Looking through the forums here and on parallax it looks like several people have had trouble getting the Parallax RFID Read/Write Module 28440 to correctly interface with the Arduino. The read/write module is a vast improvement over the old, read only module. The old module has numerous examples of how to code it for an Arduino. The new module is 4 times as fast, backwards compatible with with old reader tags and also supports write functionality.

I finally got it working so I thought I'd share my code. Note that this is a very rough and ugly code, but it works. I will be refining it over the next few days, but figured I'd post it as soon as I got it working to relieve frustration and also let others play with the code.

Here is the code for reading new style (EM4x50) tags.
Quote
//Interface Arduino USB with Parallax 28440 125 Khz UART RFID Reader/Writer
//Program reads a EM4x50 tag and reports the ID on the serial monitor.
//Coded by Uberdude

#include "NewSoftSerial.h"
#define txPin 6
#define rxPin 8

//Reader/Writer Commands
#define RFID_READ 0x01
//#define RFID_WRITE 0x02
//#define RFID_LEGACY 0x0F

NewSoftSerial mySerial(rxPin, txPin);
int  val = 0;
//char code[6];     //Note this is 11 for the extra null char?
//int bytesread = 0;
//int flag = 0;

//Tags
//char TAG1[11] = "0800E28C60";
//char TAG2[11] = "0800D9E43E";

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);

  //  pinMode(2, OUTPUT);
  //  pinMode(4, OUTPUT);
  pinMode(txPin, OUTPUT);     //pin 6
  pinMode(rxPin, INPUT);      //pin 8

  Serial.println("RFID Read/Write Test");
}

void loop()
{
  mySerial.print("!RW");
  mySerial.print(RFID_READ, BYTE);
  mySerial.print(3, BYTE);

  //0th read
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("Error Code:");
      Serial.println(val, HEX);
    }
  } 

  //1st byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("1st:");
      Serial.println(val, HEX);
    }
  } 

  //2nd byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("2nd:");
      Serial.println(val, HEX);
    }
  } 

  //3rd byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("3rd:");
      Serial.println(val, HEX);
    }
  } 

  //4th byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("4th:");
      Serial.println(val, HEX);
    }
  } 

  delay(500);                       // wait for a 1/2 second
}  

Note that if you have a rectangular read/write tag from parallax like I have, they come pre loaded with 0xFEEDBEEF in the first data address. If you didn't get your tags from there, or have a round tag, it should show up as 4 zeros. Alternately just change the the mySerial.print(3, BYTE); to mySerial.print(33, BYTE); which will read the unique serial ID. One thing that screwed me up for a long time is that the first byte of data in the ID could be a 1 which I was thinking was the error code. Hence why I went to this ugly code explicitly stating what the bytes I was getting.

Enjoy
Pages: [1]