Go Down

Topic: RFID ID-12 reader returning 255 only (Read 1 time) previous topic - next topic

marksmall

Hi There,

I recently bought:

2 x ID-12 reader module
1 X RFID Tag (Card) - 125kHz
1 X RFID Tag (Card) - Dual 125KHz/13.56Mhz MIFARE 4K

I have used a number of examples, most notably from the playground but none seem to work, they all return decimal 255.

Here is an example of one of the few code samples I've used:

#include <NewSoftSerial.h>

NewSoftSerial mySerial(4, 5);

void setup() {
//Start serial output
Serial.begin(38400);
Serial.println("RFID Reader is ready...");

mySerial.begin(9600); //Set the data rate for the NewSoftSerial port
}

void loop() {
byte tagString = 0;

if (mySerial.available()) {
tagString = mySerial.read();
Serial.println(tagString, DEC);
}
}

This produces the output 255 13 times, I was expecting some variance in the values received as the cards are supposed to be pre-programmed with a unique 32-bit id.

The wiring I've used is:

1 = GND
2 = 5V
3
4
5
6
7 = GND
8
9 = Digital Pin 4 (on arduino)
10
11 = 5V

Do you have any ideas what my problem could be, or are you able to direct me to somewhere I can possibly get the answers.

Many Thanks

MARK

nickgammon

I got hardware virtually identical to yours and this sketch worked:

Code: [Select]
#include <Tone.h>

Tone tone1;

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
  tone1.begin(8);

}
 
#define MAX_ID 20

char cur_id [MAX_ID] = "";
int len = 0;

void loop()
{
  char inByte;
 
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
   
    switch (inByte)
    {
      case 2:   len = 0;
                break;
     
      case 3:  cur_id [len] = 0;
               Serial.println (cur_id);
               if (strcmp (cur_id, "4400ABCD553F") == 0)
                  {
                  tone1.play(NOTE_C4, 100);
                  delay (100);
                  tone1.play(NOTE_D4, 100);
                  delay (100);
                  tone1.play(NOTE_E4, 100);
                  delay (1000);
                  }     
                  else
                  {
                  tone1.play(NOTE_E4, 100);
                  delay (100);
                  tone1.play(NOTE_D4, 100);
                  delay (100);
                  tone1.play(NOTE_C4, 100);
                  delay (1000);
                  }     
              break;
             
        case 10:
        case 13:
             break;
         
        default:
             if (len >= (MAX_ID - 1))
               break;
             
             cur_id [len++] = inByte;
             break;
             
     
    }  // end of switch
   
  }  // end of incoming data
}  // end of loop


I had a speaker on pin 8, and it played a "good" tune for one of the cards and another one for the others. I just plugged the RFID reader into D0 (Rx) so I could read from the ID-12 but output back to the Arduino. You need to unplug it for programming though.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Raihaan

I'm having the same issue now... Any solutions yet?
Eat. Sleep. Code.

PaulS

Quote
I'm having the same issue now
That would be a problem involving NewSoftSerial? Specifically, what IS your problem? Where are the links to your hardware? Where is your schematic?
The art of getting good answers lies in asking good questions.

Raihaan

That would be a problem involving NewSoftSerial? Specifically, what IS your problem? Where are the links to your hardware? Where is your schematic?
Hi,
My schematic is the same as the standard configuration for the ID12LA with the Arduino - i.e. the circuit on the Sparkfun Hookup guide. Except, when I bring the RFID tag into proximity with the reader, the reader outputs 255 13 times. Now this happens with ALL of my 20 tags (10 cards, 10 fobs) so that obviously can't be right. I assumed that the reader was faulty, but then found out that ID12LAs are only compatible with EM-4001 ISO type RFID tags - I had no idea which tags I used - the Amazon page gave no details. It has nothing to do with NewSoftSerial - I use SoftwareSerial without any hickups.

Any help?
Eat. Sleep. Code.

PaulS

Quote
Any help?
Without seeing your code? No.
The art of getting good answers lies in asking good questions.

Go Up