Arduino Uno & JRD-100 RFID reader not working as intended(weird outputs)

Hello!

Me and my teammates have this issue with our Arduino Uno not working with JRD-100 RFID reader as intended.

The goal is that when a tag is scanned by the rfid module, we should be able to extract the epc of the tag from the received data, but many issues have risen.

  1. even if the tags are way out of reach, the serial monitor is still showing output
  2. weird "data" is being printed in the serial monitor. (not sure if said data is from the module or the code)
  3. Supposed "manual" included is in Chinese, so many of the info is lost in transalation
  4. Not sure if the code/wiring is the issue
  5. not much online resource to refer to, so I'm trying my luck here.

We will try to provide any useful information I can give, if more info is need please share it in comments, as this is a new account, we are limited to the media we are allowed to embed and we can't attach files yet

So first, we found this 1 blog post about the JRD-100 - Arduino UHF-RFID Module

we tried following it accordingly:


Below is the code I modified to suit our situation

#include <Arduino.h>
#include <SoftwareSerial.h>

SoftwareSerial Serial2(10, 11);
bool DEBUG = true;

//an array of commands that is given to control the module
const uint8_t RFID_cmdnub[39][26] =
{
  {0xBB, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x7E,},       //0. Hardware version 
  {0xBB, 0x00, 0x03, 0x00, 0x01, 0x01, 0x05, 0x7E,},       //1. Software version 
  {0xBB, 0x00, 0x03, 0x00, 0x01, 0x02, 0x06, 0x7E,},       //2. manufacturers  
  {0xBB, 0x00, 0x22, 0x00, 0x00, 0x22, 0x7E,},             //3. Single polling instruction 
  {0xBB, 0x00, 0x27, 0x00, 0x03, 0x22, 0x27, 0x10, 0x83, 0x7E,}, //4. Multiple polling instructions 
  {0xBB, 0x00, 0x28, 0x00, 0x00, 0x28, 0x7E,},             //5. Stop multiple polling instructions 
  { 0xBB, 0x00, 0x0C, 0x00, 0x13, 0x01, 0x00, 0x00, 0x00, 0x20,
    0x60, 0x00, 0x30, 0x75, 0x1F, 0xEB, 0x70, 0x5C, 0x59, 0x04,
    0xE3, 0xD5, 0x0D, 0x70, 0xAD, 0x7E,
  },                        //6. Set the SELECT parameter instruction 
  {0xBB, 0x00, 0x0B, 0x00, 0x00, 0x0B, 0x7E,},              //7. Get the SELECT parameter 
  {0xBB, 0x00, 0x12, 0x00, 0x01, 0x01, 0x14, 0x7E,},        //8. Set the SELECT mode 
  { 0xBB, 0x00, 0x39, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x03,
    0x00, 0x00, 0x00, 0x08, 0x4D, 0x7E,
  },                      //9. Read label data storage area 
  { 0xBB, 0x00, 0x49, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x03,
    0x00, 0x00, 0x00, 0x04, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x71, 0x7E
  },   //10. Write the label data store 
  { 0xBB, 0x00, 0x82, 0x00, 0x07, 0x00, 0x00, 0xFF,
    0xFF, 0x02, 0x00, 0x80, 0x09, 0x7E,
  },                       //11. Lock the LOCK label data store 
  { 0xBB, 0x00, 0x65, 0x00, 0x04, 0x00, 0x00, 0xFF, 0xFF, 0x67,
    0x7E,
  },                                                //12. Inactivate the kill tag 
  {0xBB, 0x00, 0x11, 0x00, 0x02, 0x00, 0xC0, 0xD3, 0x7E,}, //13. Set communication baud rate 
  {0xBB, 0x00, 0x0D, 0x00, 0x00, 0x0D, 0x7E,},            //14. Get parameters related to the Query command 
  {0xBB, 0x00, 0x0E, 0x00, 0x02, 0x10, 0x20, 0x40, 0x7E,}, //15. Set the Query parameter 
  {0xBB, 0x00, 0x07, 0x00, 0x01, 0x01, 0x09, 0x7E,},      //16. Set up work area 
  {0xBB, 0x00, 0x08, 0x00, 0x00, 0x08, 0x7E,},            //17. Acquire work locations 
  {0xBB, 0x00, 0xAB, 0x00, 0x01, 0x01, 0xAC, 0x7E,},      //18. Set up working channel 
  {0xBB, 0x00, 0xAA, 0x00, 0x00, 0xAA, 0x7E,},            //19. Get the working channel 
  {0xBB, 0x00, 0xAD, 0x00, 0x01, 0xFF, 0xAD, 0x7E,},      //20. Set to automatic frequency hopping mode
  { 0xBB, 0x00, 0xA9, 0x00, 0x06, 0x05, 0x01, 0x02,
    0x03, 0x04, 0x05, 0xC3, 0x7E,
  },                             //21. Insert the working channel 
  {0xBB, 0x00, 0xB7, 0x00, 0x00, 0xB7, 0x7E,},            //22. Acquire transmitting power 
  {0xBB, 0x00, 0xB6, 0x00, 0x02, 0x07, 0xD0, 0x8F, 0x7E,}, //23. Set the transmitting power 
  {0xBB, 0x00, 0xB0, 0x00, 0x01, 0xFF, 0xB0, 0x7E,},      //24. Set up transmitting continuous carrier 
  {0xBB, 0x00, 0xF1, 0x00, 0x00, 0xF1, 0x7E,},            //25. Gets the receiving demodulator parameters 
  {0xBB, 0x00, 0xF0, 0x00, 0x04, 0x03, 0x06, 0x01, 0xB0, 0xAE, 0x7E,}, //26. Set the receiving demodulator parameters 
  {0xBB, 0x00, 0xF2, 0x00, 0x00, 0xF2, 0x7E,},            //27. Test the RF input block signal 
  {0xBB, 0x00, 0xF3, 0x00, 0x00, 0xF3, 0x7E,},            //28. Test the RSSI signal at the RF input 
  {0x00},
  {0xBB, 0x00, 0x17, 0x00, 0x00, 0x17, 0x7E,},            //30. Module hibernation 
  {0xBB, 0x00, 0x1D, 0x00, 0x01, 0x02, 0x20, 0x7E,},      //31. Idle hibernation time of module
  {0xBB, 0x00, 0x04, 0x00, 0x03, 0x01, 0x01, 0x03, 0x0C, 0x7E,}, //32. The IDLE mode 
  {0xBB, 0x00, 0xE1, 0x00, 0x05, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xE4, 0x7E,}, //33.NXP G2X label supports ReadProtect/Reset ReadProtect command 
  {0xBB, 0x00, 0xE3, 0x00, 0x05, 0x00, 0x00, 0xFF, 0xFF, 0x01, 0xE7, 0x7E,}, //34. The NXP G2X label supports the CHANGE EAS directive 
  {0xBB, 0x00, 0xE4, 0x00, 0x00, 0xE4, 0x7E,},            //35. The NXP G2X tag supports the EAS_ALARM directive 
  {0xBB, 0x00, 0xE0, 0x00, 0x06, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xE4, 0x7E,}, //36.NXP G2X label 16bits config-word 
  { 0xBB, 0x00, 0xE5, 0x00, 0x08, 0x00, 0x00, 0xFF,
    0xFF, 0x01, 0x01, 0x40, 0x00, 0x2D, 0x7E,
  },                   //37.Impinj Monza 4 Qt tags support Qt instructions 
  { 0xBB, 0x00, 0xD3, 0x00, 0x0B, 0x00, 0x00, 0xFF,
    0xFF, 0x01, 0x03, 0x00, 0x00, 0x01, 0x07, 0x00, 0xE8, 0x7E,
  },   //38.The BlockPermalock directive permanently locks blocks of a user's Block 

};

//sends the command to the module
void Sendcommand(uint8_t com_nub)
{
  uint8_t b = 0;
  while (RFID_cmdnub[com_nub][b] != 0x7E)
  {
    Serial2.write(RFID_cmdnub[com_nub][b]);
    if(DEBUG) {
      Serial.print(" 0x");
      Serial.print(RFID_cmdnub[com_nub][b], HEX);
    }
    b++;
  }
  Serial2.write(0x7E);
  Serial2.write("\n\r");
  Serial.println();
}
uint8_t DATA_I[256];

//where the output is stored
void Readcallback()
{
  uint8_t DATA_I_NUB = 0;
  while(!Serial2.available());
  while (Serial2.available())
  {
    delay(2);
    DATA_I[DATA_I_NUB] = Serial2.read();
    if (DEBUG == 1)
    {
      if(DATA_I[DATA_I_NUB] < 16) {
        Serial.print(" 0x0");
      } else {
        Serial.print(" 0x");
      }
      Serial.print(DATA_I[DATA_I_NUB], HEX);
    }
    DATA_I_NUB++;
  }
  Serial.println();
}


/* code */
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("begin of UHF-Reader");
  Serial2.begin(115200);

}

//main driver
void loop() {
  
  for (size_t i = 0; i < 10; i++) {
    Serial.println("Single polling:");
    Sendcommand(3);
    Serial.println("Recieving:");
    Readcallback();
    Serial.println("Requesting data:");
    Sendcommand(9);
    Serial.println("Recieving data:");
    Readcallback();
    delay(3000);
    Serial.println();
  }
   Serial.println("End of programm");
  delay(5000);
}

After uploading that to the board I get these kinds of output

Single polling:
 0xBB 0x0 0x22 0x0 0x0 0x22
Recieving:
 0xBB 0x02 0x22 0x00 0x11 0xC8 0x34 0x00 0xE2 0x00 0x47 0x10 0x13 0xC0 0x60 0x23 0x62 0xD1 0x01 0x0B 0x8C 0x53 0xDE 0x7E 0xBB 0x02 0x22 0x00 0x11 0xC5 0x30 0x00 0xE2 0x80 0x69 0x95 0x00 0x00 0x40 0x05 0xEF 0x43 0x86 0x88 0x92 0x35 0xD6 0x7E
Requesting data:
 0xBB 0x0 0x39 0x0 0x9 0x0 0x0 0x0 0x00x3 0x0 0x0 0x0 0x8 0x4D
Recieving data:
 0xBB 0x01 0xFF 0x00 0x10 0xA3 0x0E 0x30 0x00 0xE2 0x80 0x69 0x95 0x00 0x00 0x40 0x05 0xEF 0x43 0x86 0x88 0xD6 0x7E

Single polling:
 0xB00@&�0@00�2�j U��)W:
 0xBB 0x02 0x22 0x00 0x11 0xC3 0x34 0x00 0xE2 0x00 0x47 0x10 0x13 0xC0 0x60 0x23 0x62 0xD1 0x01 0x0B 0x8C 0x53 0xD9 0x7E 0xBB 0x02 0x22 0x00 0x11 0xC2 0x30 0x00 0xE2 0x80 0x69 0x95 0x00 0x00 0x40 0x05 0xEF 0x43 0x86 0x88 0x92 0x35 0xD5 0x7E
Requesting data:
 0xBB 0x0 0x39 0x0 0xx` ��0@x` ��0�0�00x8 0x4D
Recieving data:
 0xBB 0x01 0xFF 0x00 0x10 0xA3 0x0E 0x30 0x00 0xE2 0x80 0x69 0x95 0x00 0x00 0x40 0x05 0xEF 0x43 0x86 0x88 0xD6 0x7E

Single polling:
 0xBB 0x0 0x22 0x0 0x0 0x22
Recieving:
 0xFE 0xFE 0xFE
Requesting data:
 0xBB 0x0 0x39 0x0 0x9 0x0 0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x8 0x4D
Recieving data:
 0xFC

As you can see there are these weird symbols popping up. There are some decent ones her and there so at first, I thought that the code worked and the "receiving data" is where I need to extract the EPC of the tag.

According to the translated manual below about the polling, and the data to be received, the EPC should be between the PC and and CRC fields

So, in this received data: 0xBB 0x01 0xFF 0x00 0x10 0xA3 0x0E 0x30 0x00 0xE2 0x80 0x69 0x95 0x00 0x00 0x40 0x05 0xEF 0x43 0x86 0x88 0xD6 0x7E

The EPC should be: 0xE280699500004005EF438688 which is congruent with the "app/gui" that the seller of the module gave to me.

BUT HERE ARE WHERE THE PROBLEMS ARISE

Though the tag is very far away, there is still "output" in the serial monitor.
It just keeps on printing line after line, it's making it seem that the module is very high range though the module is just supposed to be only 2-3 meters in range. we even tried going outside and separating the reader and the tag by larger distances

we even tried reconnecting the rfid module to the arduino board directly

Nothing we are trying is working so far.

If any one could help me, I would appreciate it GREATLY, thank you and good day

You know that this is using half of the available RAM on the UNO, don't you?

SoftwareSerial doesn't work reliably above 19200 baud. At 115200 baud your UNO is doing not much more than handling the serial interface.

Your Readcallback() routine reads as long as there are bytes in the buffer. As it mostly waits (it's not clear what for and there is no comment explaining that) it might get too much output as it depends on the opposite side to send exactly what it expects as there is no range checking.

These are a lot of possibilities for something going wrong. My guess at the moment is an out of memory situation as you use almost 1700 bytes for globals.

Thank you for responding! what can you suggest I should change?

Remove that command array first. You use two commands from that 39 items array which have 8 bytes. So by defining them directly you save about half of the available RAM. Fix that an post the resulting code again.

Do you need the serial connection to the PC? If your RFID reader communicates at 115200 baud it should be better connected by the hardware serial but that isn't available if you need the PC connection (for whatever reason).

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