http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1278457441
Hi
I’m having a similar problem as the one addressed in the topic above. The clock is really ticking for me and I need a resolution FAST :~
Connection is as follows:
RFID → ARDUINO
TX → TX (pin 4)
RX → RX (pin 3)
+5V → +5V
GND → GND
and I’ve also tried:
RFID → ARDUINO
TX → TX (pin 3)
RX → RX (pin 4)
+5V → +5V
GND → GND
I had some help from somebody who modified the code from cool componenets as below. This is the only output I’m getting… (nothing happens when I place a card over the antenna)
The RFID test program has started
Header = AA
Station ID = 00
Data Length = 1
Command = 20
Checksum = 21
Footer = BB
Listening for response…
Header = AA
Station ID = 00
Data Length = 1
Command = 20
Checksum = 21
Footer = BB
CODE:
#include <NewSoftSerial.h>
/*
This program tests communication with the Seeeduino 13.56 RFID Reader by sending a request for the unit's serial number and getting a response.
www.coolcomponents.co.uk 2010
We need 4 pins connected from the RFID to the Arduino : These all come from connector J2
RFID -> ARDUINO
===================
TX -> TX (pin 4)
RX -> RX (pin 3)
+5V -> +5V
GND -> GND
NOTES :
1.Debug info and received data will be sent through the Arduino to your serial monitor. You should have it open to see anything!
You should see something like this :
The RFID test program has started
Header = AA
Station ID = 00
Data Length = 1
Command = 83
Checksum = 82
Footer = BB
Listening for response...
I received: AA
I received: 0
I received: A
I received: 0
I received: 0
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: FF
I received: A
I received: BB
NOTES (Continued)
2.The reset pin on the RFID should be tied to GND, either on the RFID or the Arduino
3.Please note that this test program outputs debug data with no trailing zero : so for example '00' becomes '0' and '0A' becomes 'A'
4.If you're not seeing any response from the RFID unit, chances are that you have your RX and TX pins round the wrong way.
5.This code uses the 'NewSoftSerial' library to set up another serial port on pins 3+4 of your Arduino. You must download the library and 'include' it in your code (using Sketch:Import Library from the Menu bar). Library can be found at : arduiniana.org/libraries/newsoftserial/
6.The code used to send the data section of the packet has not been properly tested.
*/
NewSoftSerial rfid(4,3);
byte DATA[255] = {};
void send_command(int CMD, byte DATA[])
{
int i; //an index for the data send loop
int checksum;
int DATALENGTH;
byte STX=0xAA;
byte STATIONID = 0x00;
Serial.print("Header = ");
Serial.print(STX,HEX); //STX command begin code
Serial.println();
rfid.print(STX,BYTE);
Serial.print("Station ID = ");
Serial.print("00"); //RFID reader address use zero for all readers to respond)
Serial.println();
rfid.print(STATIONID,BYTE);
DATALENGTH = sizeof(DATA)/2;
Serial.print("Data Length = ");
Serial.print(DATALENGTH,HEX); //send the length of the data section
Serial.println();
rfid.print(DATALENGTH,BYTE);
Serial.print("Command = ");
Serial.print(CMD,HEX); //send the command word
Serial.println();
rfid.print(CMD,BYTE);
checksum = (STATIONID ^ DATALENGTH ^ CMD);
i=0;
while (DATA[i])
{
Serial.print("Data Word ");
Serial.print(i);
Serial.print(" = ");
Serial.print(DATA[i],HEX); //send each byte of the data
Serial.println();
rfid.print(DATA[i],BYTE);
checksum = checksum ^ DATA[i];
i++;
}
Serial.print("Checksum = ");
Serial.print(checksum,HEX); //
Serial.println();
rfid.print(checksum,BYTE);
Serial.print("Footer = ");
Serial.print(0xBB,HEX); //ETX command end code
Serial.println();
rfid.print(0xBB,BYTE);
Serial.println();
}
void read_response()
{
byte incomingByte;
Serial.println("Listening for response...");
while (rfid.available() > 0)
{
// read the incoming byte:
incomingByte = rfid.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, HEX);
}
}
void setup()
{
//start serial port at 9600 bps: This is for the debug info we send to your PC/Mac
Serial.begin(9600);
//start a NewSoftSerial serial port at 9600bps : This is to talk to the RFID.
rfid.begin(9600);
Serial.println("The RFID test program has started");
}
void loop()
{
send_command(0x20, DATA); //This command is requests the serial number of the RFID unit
read_response(); //This just displays the raw data recieved
delay(1000);
//while(1) {} //loop forever
}