RFID read/write problem

I have one rfid module and it works with uart interface. Module has some special codes for read / write rfidcard. This is my rfid module : http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_93&products_id=2156

How can ? use arduino with this module. I can not communicate with this module. I want to read my rfid cards and monitor card number on serial monitor.

How can ? write arduino code ? I am not have enough information about arduino programming. II waiting yours best reply.

Connect GND, VCC, RXD, and TXD to Gnd, 5V, RX (Pin 0), and TX (Pin 1) on the Arduino. Connect RESET pin on Arduino to Gnd pin on Arduino. Start Serial Monitor and switch to 9600 baud. Anything you type will go to the RFID reader. Anything the RFID reader sends will appear on the Serial Monitor.

You don't mean this bit: "Connect RESET pin on Arduino to Gnd pin on Arduino" ... Perhaps connect RESET on the RFID module to GND?

MarkT:
You don’t mean this bit: “Connect RESET pin on Arduino to Gnd pin on Arduino” … Perhaps connect RESET on the RFID module to GND?

If you check what I said you’ll see that it will work. Holding Reset low will disconnect the ATmega from the RX and TX lines so the PC and talk to the RFID module directly. It also eliminates the possibility of an incorrectly programmed sketch. :slight_smile:

Thank you for reply. I try it but it not work. How can ? send rfid commands by arduino.

Example command is :

Arduino send : AB 02 02

RFid will send to arduino : AB 06 02 DE CE C9 61

DE CE C9 61 is card serial number. I want to send these commands how can ? send by arduino and write card serial number on serial monitor.

I wait your help.

I want to send these commands how can ? send by arduino and write card serial number on serial monitor.

You have one phone line. You can call the RFID reader OR the serial monitor, Not both.

You could use NewSoftSerial/SoftwareSerial to talk to the RFID reader, and Serial to talk to the serial monitor.

First ? want to communicate with rfid after it ? want to send data which ? take from rfid to serial monitor. I have arduino mega.

But ? do not know how ? can send data to rfid after take data from rfid.

My code is :

#include "SoftwareSerial.h"

#define txPin 18
#define rxPin 19

//Reader/Writer Commands
#define RFID_READ 0x02

SoftwareSerial RFid(rxPin, txPin);

void setup()
{
Serial.begin(9600);
RFid.begin(9600);

pinMode(txPin, OUTPUT); //pin 18
pinMode(rxPin, INPUT); //pin 19

  Serial.println("RFID TAGS"); 
  delay(2000);   // RFID wait time
}

void loop() {
    RFid.print(RFID_READ);    
        if (RFid.available() > 0){
            int c = RFid.read();
            Serial.print(c, DEC);
        } 
}

But my code is not work. Where is problem ? ? can't find problem yet.

If you have a Mega, you don't need software serial. Use one of the other hardware serial ports for your RFID reader.

If you have a Mega, you don't need software serial.

Not only don't you need it, it doesn't work on the Mega.

pinMode(txPin, OUTPUT); //pin 18
pinMode(rxPin, INPUT); //pin 19

These pins are owned by the Hardware Serial class (the Serial1 instance). YOU CAN NOT USE THEM FOR SOFTWARE SERIAL.

Ok. Thanks for reply. I new user of arduino so how can change my program for read rfid card number ? My rfid have for pins 5V, GND, RX and TX. I connected 5V, GND. And ? connected RFid RX pin to arduino mega TX1 pin18 and RFid TX pin to arduino RX1 pin 19.

RFid Manual :: Send : AB 02 02 and RFid must return AB 06 02 DE CE C9 61

I try it but nothing return from rfid. I thing ? program my arduino wrong. So how can test my rfid with my arduino mega.

I try it but nothing return from rfid. I thing ? program my arduino wrong.

Possibly. You need to show us your latest code.

According to the manual, there are 3 LEDs on the reader. Do any of them do anything?

On RFid tree led has. One led is stat it is on always. One led is card When ? show card it is on. Last led is mode led. ?t is off always so rfid is in basic command mode.

My Last Code is;

#include "SoftwareSerial.h"


#define txPin 22
#define rxPin 24

SoftwareSerial RFID(rxPin, txPin);

void setup()
{
		Serial.begin(9600);
		RFID.begin(9600);
		pinMode(txPin, OUTPUT); //pin 22
		pinMode(rxPin, INPUT); //pin 24

		Serial.println("Seriport Menu");
		Serial.println("a - Test Menu");
		Serial.println("b - Read card"); 
	 
                Serial.println("");
                delay(2000);   // RFID wait time:
}
 void loop() {
    
   if (Serial.available() > 0) {
      char incomingByte = Serial.read();    
      switch (incomingByte) {
      case 'a':            // if user enters 'a' show test print
      Serial.print("Test menu....");
      break;    
      case 'b':            // if user enters 'b' start card reading
      Serial.print("Card Reading Started");
      RFID.write(0xAB);
      RFID.write(0x02);
      RFID.write(0x02);
      if (RFID.available()>0)
        {
        Serial.print("Card number is:"); 
        Serial.print(RFID.read(), HEX);
        Serial.println(" ");
        }
      break;   
      }
   }
 }

But it is not work. I can not see anything on serial mon?tor.

You're still using software serial, on a pins that can't be used for that purpose on a Mega. As it says on the SoftwareSerial reference page:

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Move your RFID reader to one of the other hardware serial ports, RX1/TX1 for example.

Now ? wrote new code:

void setup()
{
        Serial.begin(9600);
        Serial2.begin(9600);
        Serial.println("Seriport Menu");
        Serial.println("a - TEST MENU");
        Serial.println("b - CARD READ"); 

                Serial.println("");
                delay(2000);   //
}
 void loop() {
    
   if (Serial.available() > 0) {
      char incomingByte = Serial.read();    
      switch (incomingByte) {
      case 'a':            // if user enters 'a' then store tag number
      Serial.print("TEST MENU");
      break;    
      case 'b':            // if user enters 'a' then store tag number
      Serial.println("CARD RETURN:");
      Serial2.write(0xAB);
      Serial2.write(0x02);
      Serial2.write(0x02);
      if (Serial2.available()>0)
        { 
        Serial.print(Serial2.read(), HEX);
        Serial.print(Serial2.read(), HEX);
        }
      break;   
      }
   }
 }

It is work but not right work. When reiceve only 2AB. But after send AB 02 02 ; RFid must be return AB 06 02 DE CE C9 61 and ? must take rfid returns. Where is my code mistake ? How can ? take rfid return sentence ?

      if (Serial2.available()>0)
        { 
        Serial.print(Serial2.read(), HEX);
        Serial.print(Serial2.read(), HEX);
        }

If there is at least one byte to read, read two values. No, that will not work.

You don't seem to understand that serial data transfer is not instantaneous. It is, in fact, slow, especially at 9600 baud.

You need to separate the sending of the data to the RFID reader from the reading of the data.