Chafon UHF RFID reader CF-RU5106

Hello everyone,

I work on a new project using Arduino Uno and Chafon RFID reader CF-RU5106 connected over RS232 with TTL converter. I need your help in coding, because the received data from reader is not same with the code from the tag.

Here is my code:

void loop() {
if (startup == 1 && millis() >= 30000) {
LastTag = "000A000B000C000D000E000F";
startup = 0;
}

if (digitalRead(IR) == "LOW") { //NOT IN USE
index = 2;
lastIR = millis();
}

if ((millis() - LedTimer) >= 2000) {
digitalWrite(flashLed, LOW);
LedTimer = millis();
delay(10);
}

if (index == 0 and (digitalRead(btn1) == 0 || digitalRead(btn2) == 0)) {//if request to resend again with diferent index
index = 1;
Serial.print("Re-send requested: ");
Serial.println(SentTag);
storeTag(SentTag, index);
//LastTag = SentTag;
for (int i = 0; i < 6; i++) {
digitalWrite(flashLed, HIGH);
Serial.println("Back LED is ON");
delay(350);
digitalWrite(flashLed, LOW);
Serial.println("Back LED is OFF");
delay(350);
}
} else {

if ((millis() - lastReq) > timeBtwRqst ) {
  digitalWrite(RL, LOW);
  delay(500);
  digitalWrite(RL, HIGH);
  lastReq = millis();
  delay(500);
}

if (storedTags == 15) {//if stored tags buffer is full
  digitalWrite(flashLed, HIGH);
  Serial.println("Back LED is ON");
  delay(1000);
  digitalWrite(flashLed, LOW);
  Serial.println("Back LED is OFF");

} else {//If stored tags buffer is under 15
  while (Reader.available() > 0) {
    digitalWrite(flashLed, HIGH);

    rxdata = Reader.read();
    Serial.print(String(rxdata));
    switch (rxstate)
    {
      case 0:  //get head
        if (String(rxdata) == ("0x02"), HEX) {
          rxstate = 1;
          strTagID = "";
          bReadLength = 0;
        }
        break;

      case 1:  //Get TagID
        if (String(rxdata,  HEX) != ("0x03"), HEX) //Not End
        {

          if (CheckIsHexChar(rxdata) == 1) { //check legal char
            strTagID = strTagID + char (rxdata);
            Serial.println(strTagID);
            bReadLength++;
            if (bReadLength == 24) {
              if (storedTags >= 0 || storedTags < 15) {

              }

              if (LastTag != strTagID) {
                if (SentTag == strTagID && (millis() - lastScan) >= timeBtwScans) {
                  LastTag = strTagID;
                  storeTag(strTagID, index);//, time());
                } else if (SentTag != strTagID) {
                  LastTag = strTagID;
                  storeTag(strTagID, index); //, time());
                }
                //Serial.println(strTagID);
                index = 0;
              } else {
                Serial.print("Current: ");
                Serial.println(strTagID);
                index = 0;
              }
            }
            //Serial.println(strTagID);
          } else {
            strTagID = "";
            rxstate = 0;
          }
        } else {
          Serial.println("else");
          if ((bReadLength) % 2 == 0) //TagLength(HEX data) is odd
          {
            if (strTagID != "")
            {
              Serial.print("TagID: ");
              Serial.println(String (strTagID));
            }
          }
          else
          {
            Serial.print("Unlegal Data\r\n");
          }
          strTagID = ""; rxstate = 0; bReadLength = 0;
        }
        break;
    }
    delay(10);
    LedTimer = millis();
  }
}

}
//digitalWrite(flashLed, LOW);
}

this code work perfect with CHAFON CF-RU5300
Thanks in advance!

I don't think that will do what you think. I think you want:
if (rxdata == 0x02) {

Same here:
if (String(rxdata, HEX) != ("0x03"), HEX) //Not End
try:
if (rxdata != 0x03) //Not End

This statement does nothing.

"0x02" check for the first char in TAG and "0x03" result the last char of TAG. All this code work perfect with cf-ru5300, but Chafon stopped manufacturing this. The new version is RU5106 and of course, I found big difference between 5300 and 5106

So, what is the difference you found?

for exemple, the decoding protocol which is very important on data output.
RU5300 data read is: 2453238303638313032303030303030313742314134463632da3
RU5106 data read is: 150ffee053b6ffd72b10ad00ffdc35ffb959ffd9ffe6ffff
And needed output in string is E2806810200000017B1A4F62 (this is the real ID of TAG)

It would help if you print a space between characters.

I don`t print any space between chars. this is all of TAG ID which the reader get

It would help if you print a space between characters.

Tag read by 5106:15 0 ffee 0 53 b 6 ffd7 2b 1 0 a d 0 0 ffdc 35 ffb9 59 ffd9 ffe6 ffff
tag read by 5300 (OK): 2 45 32 38 30 36 38 31 30 32 30 30 30 30 30 30 31 37 42 31 41 34 46 36 32 d a 3
decoded is: E2806810200000017B1A4F62 (this is needed by me)

I found a protocol manual that might help you configure the reader to give you the data you want.

R2000 UHF RFID Reader Protocol.pdf (12.0 KB)

I see nothing in this document.

Sorry. I accidentally had "print selection only" turned on when I printed the .doc file to a .pdf so I could upload it. This version should be all 30 pages.

R2000 UHF RFID Reader Protocol.pdf (332.5 KB)

thanks. but this not same with my readers comm. protocol :pensive:

Looks like a match to me:

15 Message contains 21 bytes
00 Reader Address 0
ee This is a response for a scan
00 Status = Success
Data:
53 0b 06 d7 2b 01 00 0a 0d 00 00 dc 35 b9 59 d9
e6 ff CRC Check

1 Like

Thank you for your effort. Yesterday I decoded the information. In cases where the tag was 00, only 0 was displayed on the screen. This led me astray.
Now all work properly.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.