Go Down

Topic: Arduino UNO-R3 + Parallax RFID Read/Write Module (Read 2461 times) previous topic - next topic

Analog_M0n

Oct 07, 2012, 11:13 am Last Edit: Oct 07, 2012, 11:44 am by Analog_M0n Reason: 1
I know many people have asked this before, but I still need help.

RFID datasheet: http://www.parallax.com/Portals/0/Downloads/docs/prod/rf/28440-RFIDReadWrite-v1.0.pdf
EM-4100 Card : http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/ProductID/115/List/0/Default.aspx?SortField=ProductName,ProductName

I have followed the tutorial on http://arduino.cc/playground/Learning/ParallaxRFIDreadwritemodule. The red led on the RFIG lighted up and the serial monitor displayed "RFID Read/Write Test". However, no matter how I tab the card, nothing happened.

For your convenience, the code is below:
Code: [Select]
#include <SoftwareSerial.h>
#define txPin 6
#define rxPin 8
#define RFID_LEGACY 0x0F


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

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.write(byte(RFID_LEGACY));

 //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;

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


****NOTE**** I am using Arduino 1.0.1 software - NewSoftSerial and BYTE cannot work

Please help. Thanks

PaulS

Code: [Select]
  pinMode(txPin, OUTPUT);     //pin 6
  pinMode(rxPin, INPUT);      //pin 8

You told SoftwareSerial that these were it's pins. Why are you now diddling with them?

What, exactly, did you connect between the Arduino and the RFID reader? Show a picture.

Quote
A status/error byte and a varying number of
data bytes will be returned depending on the command called.

Why don't you read this data?


Analog_M0n

The code was from  http://arduino.cc/playground/Learning/ParallaxRFIDreadwritemodule, I merely followed what was stated there.
Is there something wrong with the code?

and

Quote
A status/error byte and a varying number of
data bytes will be returned depending on the command called.

Where did you get that?

PaulS

Quote
Is there something wrong with the code?

Yes. You should not be diddling with the SoftwareSerial instance's pins.

You should most likely NOT be sending !RW and the other value every pass through loop.

You should be reading the response from the device, each time you send it an instruction.

Quote
Where did you get that?

The RFID datasheet.

Analog_M0n

#4
Oct 07, 2012, 04:38 pm Last Edit: Oct 07, 2012, 04:41 pm by Analog_M0n Reason: 1
Thanks for telling me, but I am at a loss right now, what can I do to get the RFID to work properly? Sorry to trouble you
I got to get to bed now, will be back in around 12 hours. Apologies

PaulS

Quote
what can I do to get the RFID to work properly?

Start with demonstrating that it is connected correctly.

Are you positive that the cards that you have are compatible with the reader?

Analog_M0n

RFID 
|VCC| -> Arduino +5v
|SIN| -> Arduino pin 6
|SOUT| -> Arduino pin 8
|GND| -> Arduino GND

I also have a 16x2 LCD monitor connected to the Arduino which I intend to use as a display later

  1|VSS| -> Arduino GND
  2|VDD| -> Arduino +5v
  3|VO | -> Arduino GND pin
  4|RS | -> Arduino pin 12
  5|RW | -> Arduino GND
  6|E  | -> Arduino pin 10
  7|D0 | -> Arduino - Not Connected
  8|D1 | -> Arduino - Not Connected
  9|D2 | -> Arduino - Not Connected
10|D3 | -> Arduino - Not Connected
11|D4 | -> Arduino pin 5
12|D5 | -> Arduino pin 4
13|D6 | -> Arduino pin 3
14|D7 | -> Arduino pin 2
15|A  | -> Not Connected
16|K  | -> Not Connected

Quote
EM-4100 Card : http://www.parallax.com/Store/Accessories/CommunicationRF/tabid/161/ProductID/115/List/0/Default.aspx?SortField=ProductName,ProductName

According to this, the card is compatible to the RFID, but it can only be read.

Analog_M0n

I also like to ask: Should the SIN pin act as an Enable for the RFID to read?

Analog_M0n

Hi PaulS
I just did some try outs here and I meraculously succeeded in getting the program to work.

Here's the story:
I decided to try out the program back at http://arduino.cc/playground/Learning/ParallaxRFIDreadwritemodule that reads the newer EM4x50 tags.
Again nothing happens when I scan the cards for obvious reasons.
So I used the first program again and somehow the whole thing works properly.

Probably the input wires were a little loose or there is a small mistake in the code when I tried to use it earlier. But everythings fine now.

Sorry for all the trouble I caused and thanks for trying to help me out.

Go Up