ID-12LA only reading at a very short range?

Hi all,

I’ve got an ID-12LA RFID tag reader hooked up to an Arduino Duemilanove via a Sparkfun breakout board. Currently, it is reading the RFID tag, but only when I hold it about 1cm or closer to the RFID reader. I have tested this running off both USB and a 9VDC plugpack, and with multiple RFID tags. However, when I tested it using a USB breakout board (i.e. directly connected into the PC), it was able to read the RFID tag at 12cm - which is the range for this model of RFID reader.

Here’s how I have it set up:

D0 on the RFID reader goes to Pin 0 (Serial RX) on the Duemilanove. It will eventually go to a software serial (as the hardware serial is required for an XBee), but for testing purposes I’m using the hardware. Gnd and FORM on the ID-12LA go to the Arduino’s Ground, and VCC & RES on the ID-12LA go to +5V on the Arduino.

Here’s the code I’m using - it’s pretty much the Arduino Playground ID-12LA example:

#include <SoftwareSerial.h>

//SoftwareSerial rfidSerial(6, 7); // RX, TX
char val = 0;

void setup() {
  // put your setup code here, to run once:
  //rfidSerial.begin(9600);
  Serial.begin(9600);
}

void loop () {
  byte i = 0;
  byte val = 0;
  byte code[6];
  byte checksum = 0;
  byte bytesread = 0;
  byte tempbyte = 0;

  if(Serial.available() > 0) {
    if((val = Serial.read()) == 2) {                  // check for header 
      bytesread = 0; 
      while (bytesread < 12) {                        // read 10 digit code + 2 digit checksum
        if(Serial.available() > 0) { 
          val = Serial.read();
          if((val == 0x0D)||(val == 0x0A)||(val == 0x03)||(val == 0x02)) { // if header or stop bytes before the 10 digit reading 
            break;                                    // stop reading
          }

          // Do Ascii/Hex conversion:
          if ((val >= '0') && (val <= '9')) {
            val = val - '0';
          } else if ((val >= 'A') && (val <= 'F')) {
            val = 10 + val - 'A';
          }

          // Every two hex-digits, add byte to code:
          if (bytesread & 1 == 1) {
            // make some space for this hex-digit by
            // shifting the previous hex-digit with 4 bits to the left:
            code[bytesread >> 1] = (val | (tempbyte << 4));

            if (bytesread >> 1 != 5) {                // If we're at the checksum byte,
              checksum ^= code[bytesread >> 1];       // Calculate the checksum... (XOR)
            };
          } else {
            tempbyte = val;                           // Store the first hex digit first...
          };

          bytesread++;                                // ready to read next digit
        } 
      } 

      // Output to Serial:

      if (bytesread == 12) {                          // if 12 digit read is complete
        Serial.print("5-byte code: ");
        for (i=0; i<5; i++) {
          if (code[i] < 16) Serial.print("0");
          Serial.print(code[i], HEX);
          Serial.print(" ");
        }
        Serial.println();

        Serial.print("Checksum: ");
        Serial.print(code[5], HEX);
        Serial.println(code[5] == checksum ? " -- passed." : " -- error.");
        Serial.println();
      }

      bytesread = 0;
    }
  }
}

I do need to be reading the RFID tags at 12cm, as they are mounted in model locomotives that will be passing beneath the RFID reader (to track them in and out of hidden storage tracks). As such, the 12cm range will cover from the reader all the way down to the tracks. Can anyone please provide any advice or suggestions as to why I may not be getting this range, now that it’s connected to the Arduino?

Thanks,
Tbdanny

Have you measured the voltage on the sensor with each supply?

Weedpharma

Hi,

I've just checked it:

USB: 5.1V Plugpack: 4.59V

I had to measure at the start of the cables to the sensor. When I put the leads to my multimeter on the actual solder connections on the breadboard, the Arduino kept shutting down.

Cheers, Tbdanny

I would say the problem is due to the lower voltage.

What is the current rating of your 9v supply?

Weedpharma

The 9V supply (again, which is only being used for testing) is rated at 0.55A. When it's installed on the model railroad, the Arduino will be powered by a supply capable of 4A.

The supply is a bit light for the use, it drops under load.

Try a larger supply.

Weedpharma

I was thinking, could the Arduino not be supplying enough current to the RFID reader? I have a spare voltage regulator board that can be set to 5V. Maybe it would work if I powered the RFID reader from the regulator, and had it coming off the same 9V power supply? This would provide the common gnd connection required for the serial connection to work.

This does not help if the 9v supply cannot supply enough current. You need a higher current supply.

Weedpharma

Weedpharma,

This will be coming off the 1A 9V power supply on the model railroad.

If you are running the sensor and Arduino from a 1A supply, it should be ok. However if you also run the trains off the same supply, you will get a lot of electrical noise that may interfere with the working of the electronics.

Try using the larger supply without anything else connected to see if the problem is due to current.

Weedpharma

I'll give that a shot. The 1A supply is a dedicated accessory supply - the trains are run off a separate AC adapter & power supply system completely.

Thank-you for all your help and advice.