RFID(CR003t) Not working with uno

For the discussion of Arduino related topics.

Moderator: phalanx

Post Reply
akshaykirti
Posts: 3
Joined: Tue Jul 19, 2011 10:35 am

RFID(CR003t) Not working with uno

Post by akshaykirti » Tue Jul 19, 2011 10:38 am

I got this rfid reader today and it dosnt seem to work.. as i understand, if i connect it's tx to arduinos rx, it should give me an STX value of 02h. Or something like that..
So.. How is this supposed to work exactly..
My code is:

Code: Select all

int incomingByte = 0;	

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

void loop() {


    incomingByte = Serial.read();


Serial.println(incomingByte,BYTE);
  }


As i understand.. i should get a value.


The rx light is also not blinking..

Help!
Have connected everything besides the pin 2 and pin 3..
As required in the datasheet.. have connected an led which is glowing very slightly. And an Antenna.. I do have RFID tags which are supposedly 125 khz but cnt confirm. BUT, It is supposed to return an value to the rx?
Right?
I get an output of ÿÿÿÿÿÿ

Data sheet :http://www.chinareader.cn/images/_20089 ... 722949.pdf

evanrich
Posts: 42
Joined: Thu Jan 27, 2011 8:46 pm

Re: RFID(CR003t) Not working with uno

Post by evanrich » Wed Jul 20, 2011 5:57 pm

akshaykirti wrote:I got this rfid reader today and it dosnt seem to work.. as i understand, if i connect it's tx to arduinos rx, it should give me an STX value of 02h. Or something like that..
So.. How is this supposed to work exactly..
My code is:

Code: Select all

int incomingByte = 0;	

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

void loop() {


    incomingByte = Serial.read();


Serial.println(incomingByte,BYTE);
  }


As i understand.. i should get a value.


The rx light is also not blinking..

Help!
Have connected everything besides the pin 2 and pin 3..
As required in the datasheet.. have connected an led which is glowing very slightly. And an Antenna.. I do have RFID tags which are supposedly 125 khz but cnt confirm. BUT, It is supposed to return an value to the rx?
Right?
I get an output of ÿÿÿÿÿÿ

Data sheet :http://www.chinareader.cn/images/_20089 ... 722949.pdf
I'm by FAR not an expert in this stuff, beginning myself, but I have a similar function to read data coming off TX/RX pins to display text on a LED matrix.

Data is received in 1 byte at a time on the RX pin, so you need to have something like:

Code: Select all

void loop() 
    {
    char inByte;

    if (Serial.available())
        {
        inByte = Serial.read();

        //if (inByte == '\n')
        if (inByte == 13)  //Carriage Return (Enter Key)
            {
            // 'newline' character
            inputBuffer[bufferPointer++] = '\0';
            scrolltextsizexcolor(0,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
            //scrolltextsizey(1,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
            loopstate = digitalRead(LoopSwitch);
            while (loopstate != false) {      //if loop switch is enabled, loop text until it is turned off
            
            loopstate = digitalRead(LoopSwitch);      //check loop value to see if it has changed (gone from high to low, or vice versa.
              scrolltextsizexcolor(0,inputBuffer,1,GREEN, 0,my2font,8,8,'G',40);
              
            }
            bufferPointer = 0;
            }
        else
          if (inByte == 8)    //'backspace' character
             {
               
                inputBuffer[bufferPointer--];
             }   
        else
            {
            // not a 'newline' character
            if (bufferPointer < bufferSize - 1)  // Leave room for a null terminator
                inputBuffer[bufferPointer++] = inByte;                
            }
     }
    }
you can ignore the loopswitch and such, i have the option to make my display repeat. You have to increment each byte from RX, as it comes in 1 byte at a time. When it detects no serial data, then output the results.

Again, I'm no expert so maybe I'm wrong, but I'm receving in serial data just like you and my code works, so it might help you.

akshaykirti
Posts: 3
Joined: Tue Jul 19, 2011 10:35 am

Re: RFID(CR003t) Not working with uno

Post by akshaykirti » Wed Jul 20, 2011 9:45 pm

dude, u have the same reader?... Cr003t?

I'll try this out.. I am going to get confirmed 125khz rfid tags tday.. Had unconfirmed tags maybe 13.somethint mhz.

So, this returns absolutely no seriial value initially if NO tag is present?

Thanks a ton :)

evanrich
Posts: 42
Joined: Thu Jan 27, 2011 8:46 pm

Re: RFID(CR003t) Not working with uno

Post by evanrich » Wed Jul 20, 2011 11:21 pm

akshaykirti wrote:dude, u have the same reader?... Cr003t?

I'll try this out.. I am going to get confirmed 125khz rfid tags tday.. Had unconfirmed tags maybe 13.somethint mhz.

So, this returns absolutely no seriial value initially if NO tag is present?

Thanks a ton :)
No, I am not using a passive reader, but from the datasheet, it uses a TX pin to transmit its data to your arduino. Therefore, I'd assume it follows standard UART process of transmitting, no different than if you were using an FT232 USB->UART chip to provide usb connectivity.

My project uses a FT232RL chip so that i can connect my project to my PC. If I open a terminal to COM4, i can send serial data to the board. The FT232RL feeds serial data in 1 byte at a time, With the code I provided, I can read in all incoming data into a buffer, and then display it on a screen once I hit enter. This of course is a totally different project from yours, but the Serial data works the same. You should have some thing in there that checks for incoming serial data, and then reads the data in one byte at a time. Looking at your datasheet, you should be expecting a start byte, tag Serial number, and then end transmission byte. Fortunately, I know a little about RFID as I work for an RFID company, but I'm fairly new to this microprocessor programming.

Look for the code in my post related to serial.read, and around that, it may help you out until someone smarter responds to this. Sorry I can't be more helpful, but I'm still learning too :)

evanrich
Posts: 42
Joined: Thu Jan 27, 2011 8:46 pm

Re: RFID(CR003t) Not working with uno

Post by evanrich » Thu Jul 21, 2011 8:25 am

you can start with something like this:

Code: Select all

int incomingByte = 0;   

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

void loop() {

if (Serial.available())
        {
    incomingByte = Serial.read();
}
Serial.println(incomingByte,BYTE);
  }
however this will only read one byte. What you need is something more like this:

Code: Select all

int incomingByte = 0;   
const int bufferSize = 32;  //size of a text buffer to hold incomming serial data
char inputBuffer[bufferSize];
int bufferPointer = 0;  //sets bufferpointer at 0

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

void loop() {

if (Serial.available())
        {
    incomingByte = Serial.read();
	
	 if (inByte == ??)  //End of Transmission Byte
            {
            // 'newline' character
            inputBuffer[bufferPointer++] = '\0';
			Serial.println(incomingByte,BYTE);
			}
else
            {
            // not a 'end of transmission' character
            if (bufferPointer < bufferSize - 1)  // Leave room for a null terminator
                inputBuffer[bufferPointer++] = inByte;        //advance to next spot in buffer to receive next byte         
            }
}
}
You'll have to adapt it, I put a "??" in for the end of transmission byte, as I do not know what it would be, but the code is pieced together from my code above. What it does is check to see if serial data is coming in on TX/RX. If it is, it reads one byte at a time into a buffer. Once it detects the 'end of transmission' byte, it prints your result on your serial line.

akshaykirti
Posts: 3
Joined: Tue Jul 19, 2011 10:35 am

Re: RFID(CR003t) Not working with uno

Post by akshaykirti » Thu Jul 21, 2011 9:37 am

Ok, I'll try this out tomorrow. I did grab some Tags from our metro as their cards are writable and are guaranteed not on the 125khz frequency. This is not responding to this tag. The dude ran out of tags but I'll be getting confirmed 125khz stuff tomorrow. Will check it out then. Cause j suppose it wnt respond anyhow if I provide a other frequency.

If you guys are curious. Here are some photos


https://picasaweb.google.com/akshaykirt ... mGgPe2tJRf

Post Reply