Program for 125MHz RFID Reader

Dear all,

i want to ask,how to know the distance between RFID tags and RFID reader when read within?
is it possible we can know the distance when the tags read by the reader? can we programmer it or we insert that code into that tags?

please your advice, if consider i hope you can share about that program.

Thanks,
Riko

Hey , it seems the RFID doesn’t have this function: it has no sensor to detect the distance…

Dear Jacky,

Have you ever coding using rfid 125khz grove?
could you share your code how to read that data uniq/tag using arduino?

The program have been posted on the wiki:

#include <SoftwareSerial.h>
 
SoftwareSerial SoftSerial(2, 3);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
void setup()
{
  SoftSerial.begin(9600);               // the SoftSerial baud rate   
  Serial.begin(9600);             // the Serial port of Arduino baud rate.
 
}
 
void loop()
{
  if (SoftSerial.available())              // if date is comming from softwareserial port ==> data is comming from SoftSerial shield
  {
    while(SoftSerial.available())          // reading data into char array 
    {
      buffer[count++]=SoftSerial.read();     // writing data into array
      if(count == 64)break;
  }
    Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
    clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
    count = 0;                       // set counter of while loop to zero
 
 
  }
  if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
    SoftSerial.write(Serial.read());       // write it to the SoftSerial shield
}
void clearBufferArray()              // function to clear buffer array
{
  for (int i=0; i<count;i++)
    { buffer[i]=NULL;}                  // clear all index of array with command NULL
}

And it works well.
1.png

Also,you can use UART port(TX/RX)

Actually, i used UART in that output. in my program that program on wiki can compiler, but it doesn’t give me any output in the serial :open_mouth:
is that hardware problem?
i used arduino mega 2560 R2 + Grove Rfid 125 Khz and grove 4 pin to grove pin converter.
pin TX from Grove reader into RX arduino, VCC and ground plug same from reader and arduino.

you can use Mega with RFID, and it works well. So you need confirm that whether you have used a 125khz tag? Also ,don’t forget to turn the RFID mode jumper to “U”