Show Posts
Pages: [1]
1  Topics / Science and Measurement / RFID reader not responding to query on: April 10, 2012, 01:38:54 am
Hi,

I'm currently using an arduino uno to query a RFID reader, after query, it should return the version of the rfid reader. The RFID reader im using is of the following: "http://www.rfidshop.com.hk/datasheet/UHF-Reader/CD-UHF-MP-RW-232.zip". Can somebody please tell me what im doing wrong? I've used a rs232 -ttl converter before plugging it into the arduino board. Also, the checksum bit is XOR.  The myserial.write function doesnt seem to get through because when i measure the tx pin on the arduino board using a multimeter, the voltage remains constant and it doesnt fluctuate. When i open the serial terminal, myserial.available, is always 0, hence it doesnt go into that if function.

Thanks.

#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 4
#define ledPin 13

//byte GetData[] = {0x0A,0xFF,0x02,0x22,0xD5};
// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
 

void setup()  {
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  Serial.begin(9600);
  mySerial.begin(9600);

}

void loop() {
 byte GetData[] = {0x0A,0xFF,0x02,0x22,0xD5};
  Serial.println("creating query");
  delay(2000);
  mySerial.write(GetData,sizeof(GetData));
    Serial.println(sizeof(GetData));
    Serial.println("sending query");
   delay(2000);
   if (mySerial.available() > 0) {
  char someChar = mySerial.read();
  Serial.println(someChar, HEX);
   
     // listen for new serial coming in:
  //
 // delay(1000);
   Serial.println("received: ");
   //delay(1000);
  digitalWrite(13, HIGH);   // set the LED on
  //delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
 // delay(1000);   
   }
   
   Serial.println("nothing ");
   delay(2000);
}
2  Topics / Home Automation and Networked Objects / rs232 rfid reader to arduino uno on: April 05, 2012, 09:48:47 am
The output of my RFID reader is rs232 and im currently using a rs232-ttl converter to connect it to my arduino MCU.(http://www.lipoly.de/index.php?main_page=product_info&cPath=880_2612_2669&products_id=163671). I currently cant get any output . Im using a simple code where the LED will blink and it will print "receive" on the serial monitor when there is data coming in. (codes shown below). when i scan the card on the RFID reader, the LED on the arduino wont blink and when i open the serial monitor, i wont get the message "received". Do i have to initialize the RFID reader or some sort? or am i connecting it wronly?  The TXD from the rs232-ttl is connected to pin 2 while the RXD from the rs232-ttl device is connected to pin 3 of the arduino ( i have tried connecting them in the other fashion) , the ground and vcc are connected to the arduino accordingly as well.
The RFID im using is this one:  http://www.rfidshop.com.hk/datasheet/UHF-Reader/CD-UHF-MP-RW-232.zip

Thanks ,
Jason


#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3
#define ledPin 13

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);


void setup()  {
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() {
   if (Serial.available() > 0) {
  // listen for new serial coming in:
  char someChar = mySerial.read();

   Serial.print("received: ");
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);   
   }
}
Pages: [1]