Parallax RFID kit

got my parallax RFID kit working. I'm a little disappointed that it only has a max read range of 3" but it will be a good start. I grabbed the code from the playground and messed around with it so I could compare a tag with a "known" tag id using strcmp(). Here's the code:

#define TAG_LEN 12

char tag[12] = {'0', '1', '0', '3', '6', 'A', 'F', '2', 'B', '1'};
char code[12]; 
int bytesread = 0; 
int ledPin = 13; // Connect LED to pin 13
int rfidPin = 2; // RFID enable pin connected to digital pin 2
int val=0; 
void setup() { 

Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin 
pinMode(ledPin,OUTPUT); // Set ledPin to output

digitalWrite(rfidPin, LOW); // Activate the RFID reader 
} 

 void loop() { 

  if(Serial.available() > 0) {          // if data available from reader 
    if((val = Serial.read()) == 10) {   // check for header 
      bytesread = 0; 
      while(bytesread<10) {              // read 10 digit code 
        if( Serial.available() > 0) { 
          val = Serial.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 
        
       if(strcmp(code, tag) == 0) {
         Serial.print("Tag matches: ");
         Serial.println(code);
         blink();
       }
       else {
         Serial.print(code);
         Serial.println(" does not match");
         digitalWrite(ledPin,HIGH);
       }
       
 
      } 
      bytesread = 0; 
           delay(500);                       // wait for a second 
    } 
  } 
} 

void blink() {
  digitalWrite(ledPin, HIGH);
  delay(250);
  digitalWrite(ledPin, LOW);
  delay(250);
}

// extra stuff
// digitalWrite(2, HIGH);             // deactivate RFID reader

Ideally, I'd like to be able to read multiple tags to make sure that an "inventory" of objects is complete. According to the documentation, this is not possible with this particular kit. Does anyone have any suggestions for a reader with a range of something more like 3-5 feet with the ability to somehow read multiple tags simultaneously?

Thanks,
Dale

After doing some more poking around, I see that I would need to use a high frequency RFID reader module. Anyone have any experience with this? It appears that they have collision detection and a higher read range.

thanks,
Dale

I don't think anythings impossible when it comes to rfid, there's a few exciting things going on over at (http://www.openbeacon.org/) for example, unfortunately, passive rfid has a few limitations. Like, collision detection is possible using 13.56, but there is a limit on the number of objects that can be simultaneously interrogated.

Also, 13.56 still only has an effective read range of about 6", depending on the size of the tag and a few other variables. I think there's a few creative solutions being used by casino's for chip interrogation, so you could google that to determine if there's anything suitable for the application you've got in mind.

You could also start with the ASPX RW210, there is code around Arduino for that somewhere, and it's a step up on the parallax which is one of the lowest of low-powered 125khz readers, I did the parallax "thing" as well and it was quite disappointing.

Basically,
I have anywhere from 5 to 15 or so tools in a designated area that's about 10"-14" across and a couple feet high. The tags will be on the bottom of the tools so the vertical is not that important. The items are removed frequently throughout the day. It is a common occurrence for someone to remove several items at once to keep from having to make multiple trips to get the right tool. Once the correct tool is determined and used, it is not uncommon for the unused tools to be left at the site of the repair. I would like to be able to program the id tags for the tools and for the arduino / rfid reader to keep a real-time inventory of the tools. If all the tools are not in the proper location, it is obvious to the tech.

I have my arduino working to the extent that I recognize a single tag, and light a green led. If the wrong tag is scanned, I light a red led for a brief time. After a predefined amount of time without reading the proper tag, I blink the red led until the missing tag is read. This would be some sort of audible alarm or something if I could get it all working.

Thanks,
Dale

So I'm still having fun playing with the arduino and the parallax RFID reader, even if it won't do exactly what I'm after. Here's the latest code that does the following.

Has a single tag id stored as tag.
Reads tags and outputs debug code to serial
Lights green LED if tag is recognized
Lights red LED if not recognized
After set amount of time without reading known tag, sounds a piezo buzzer and flashes red LED

The piezo is connected - positive to digital pin 7 and negative to breadboard ground

#define TAG_LEN 12

char tag[12] = {'0', '1', '0', '3', '6', 'A', 'F', '2', 'B', '1'};
char code[12]; 
int bytesread = 0; 
int redPin = 13; // Connect red LED to pin 13
int grnPin = 8; // Connect green LED to pin 8
int buzPin = 7; // Connect buzzer to pin 7
int rfidPin = 2; // RFID enable pin connected to digital pin 2
int val=0; 
long time;
long lastUpdate=0;
void setup() { 

Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
pinMode(rfidPin,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin 
pinMode(redPin,OUTPUT); // Set ledPin to output
pinMode(grnPin,OUTPUT);
pinMode(buzPin,OUTPUT);
digitalWrite(rfidPin, LOW); // Activate the RFID reader 

} 

 void loop() { 
  digitalWrite(buzPin,0); 
  time = millis();
  if(Serial.available() > 0) {          // if data available from reader 
    if((val = Serial.read()) == 10) {   // check for header 
      bytesread = 0; 
      while(bytesread<10) {              // read 10 digit code 
        if( Serial.available() > 0) { 
          val = Serial.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     
       if(strcmp(code, tag) == 0) {
         Serial.print("Tag matches: ");
         Serial.println(code);
         lastUpdate = millis();
         Serial.print("time elapsed = ");
         Serial.println(time);
         digitalWrite(grnPin,HIGH); // good read light green LED
         digitalWrite(redPin,LOW); // turn off red LED
       }
       else {
         Serial.print(code);
         Serial.println(" does not match");
         digitalWrite(redPin,HIGH); // not recognized tag light red LED
         digitalWrite(grnPin,LOW); // turn off green LED
       } 
      } 
      bytesread = 0; 
           delay(500);                       // wait for a 1/2 second 
    } 
  } 
  if((time - lastUpdate) >= 60000) {
         blink_fast();
  }
} 

void blink() {
  digitalWrite(redPin, HIGH);
  delay(250);
  digitalWrite(redPin, LOW);
  delay(250);
}

void blink_fast() {
  digitalWrite(buzPin,HIGH); //play annoying buzzer :)
  Serial.print("Time = ");
  Serial.println(time);
  digitalWrite(grnPin,LOW); //turn off green led
  digitalWrite(redPin, HIGH);
  delay(50);
  digitalWrite(redPin, LOW);
  delay(50);
}

// extra stuff
// digitalWrite(2, HIGH);             // deactivate RFID reader

Dale

Nice, still you have the issue of only being able to scan tags within 3-5cm, or so, depending on tag size?

With the parallax it sometimes needs the tag to be waived around 'wildly' at an angle, for it to take a reading. I think it's possible to do what your wanting to do, just not with the parallax, unless you invent a means of extending its range, and read only a single tag at a time.

You're right. I'm looking into HF RFID reader module, but haven't gotten a response back from the vendor. (had to contact for pricing) Runs at 13.56MHz. The only issue I see is that the tags are a mostly the paper ones like the ones you get in books from the book store. I have been reading about external antenna options that might address the range issue. If that will work I just need to worry about collision control (reading multiple tags simultaneously)

This seemed a lot easier before I got into it. It's still a fun exercise. Maybe I'll just build a robot.... :stuck_out_tongue:

Dale