Contents

Interfacing RDM6300 RFID Reader Module with Arduino

RDM6300 RFID Reader Module Features

If you are a little familiar with electronics then you have probably heard of RFID (Radio-Frequency-Identification). The RDM6300 model is one type of RFID modules with 125 kHz frequency. This module is designed for reading code from 125KHz (ID) compatible read-only tags and read/write 125KHz cards.

Features:

  • Support external antenna
  • Maximum effective distance: up to 50 mm
  • Uart interface
  • Small outline design

RDM6300 RFID Reader Module Pinout

This module has 9 pins:

  • VCC: Module power supply – 5V
  • GND: Ground
  • RX: Data Receive pin
  • TX: Data Transmit pin
  • ANT1: Antenna connection pin
  • ANT2: Antenna connection pin
  • LED: LED pin – This pin will be HIGH when there is no tag near module. When a tag is near module, it will change from HIGH to LOW for a short period of time.

You can see the pinout of this module here.

Required Material

Hardware component

Arduino UNO R3 × 1
RDM6300 125 kHz RFID Reader Module × 1
Male to Female Jumper wire × 1

Software Apps

Arduino IDE

Interfacing RDM6300 RFID Reader Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to RDM6300 module. Connect wires accordingly.

Step 2: Code

Upload the following code to Arduino.

 /*
  RDM6300-125KHz-RFID
  modified on 20 Jan 2020
  by Amir Mohammad Shojaee @ Electropeak
  
Home
based on www.mschoeffler.de Arduino Examples */ #include <SoftwareSerial.h> const int BUFFER_SIZE = 14; // RFID DATA FRAME FORMAT: 1byte head (value: 2), 10byte data (2byte version + 8byte tag), 2byte checksum, 1byte tail (value: 3) const int DATA_SIZE = 10; // 10byte data (2byte version + 8byte tag) const int DATA_VERSION_SIZE = 2; // 2byte version (actual meaning of these two bytes may vary) const int DATA_TAG_SIZE = 8; // 8byte tag const int CHECKSUM_SIZE = 2; // 2byte checksum SoftwareSerial ssrfid = SoftwareSerial(6,8); uint8_t buffer[BUFFER_SIZE]; // used to store an incoming data frame int buffer_index = 0; void setup() { Serial.begin(9600); ssrfid.begin(9600); ssrfid.listen(); Serial.println(" INIT DONE"); } void loop() { if (ssrfid.available() > 0){ bool call_extract_tag = false; int ssvalue = ssrfid.read(); // read if (ssvalue == -1) { // no data was read return; } if (ssvalue == 2) { // RDM630/RDM6300 found a tag => tag incoming buffer_index = 0; } else if (ssvalue == 3) { // tag has been fully transmitted call_extract_tag = true; // extract tag at the end of the function call } if (buffer_index >= BUFFER_SIZE) { // checking for a buffer overflow (It's very unlikely that an buffer overflow comes up!) Serial.println("Error: Buffer overflow detected! "); return; } buffer[buffer_index++] = ssvalue; // everything is alright => copy current value to buffer if (call_extract_tag == true) { if (buffer_index == BUFFER_SIZE) { unsigned tag = extract_tag(); } else { // something is wrong... start again looking for preamble (value: 2) buffer_index = 0; return; } } } } unsigned extract_tag() { uint8_t msg_head = buffer[0]; uint8_t *msg_data = buffer + 1; // 10 byte => data contains 2byte version + 8byte tag uint8_t *msg_data_version = msg_data; uint8_t *msg_data_tag = msg_data + 2; uint8_t *msg_checksum = buffer + 11; // 2 byte uint8_t msg_tail = buffer[13]; // print message that was sent from RDM630/RDM6300 Serial.println("--------"); Serial.print("Message-Head: "); Serial.println(msg_head); Serial.println("Message-Data (HEX): "); for (int i = 0; i < DATA_VERSION_SIZE; ++i) { Serial.print(char(msg_data_version[i])); } Serial.println(" (version)"); for (int i = 0; i < DATA_TAG_SIZE; ++i) { Serial.print(char(msg_data_tag[i])); } Serial.println(" (tag)"); Serial.print("Message-Checksum (HEX): "); for (int i = 0; i < CHECKSUM_SIZE; ++i) { Serial.print(char(msg_checksum[i])); } Serial.println(""); Serial.print("Message-Tail: "); Serial.println(msg_tail); Serial.println("--"); long tag = hexstr_to_value(msg_data_tag, DATA_TAG_SIZE); Serial.print("Extracted Tag: "); Serial.println(tag); long checksum = 0; for (int i = 0; i < DATA_SIZE; i+= CHECKSUM_SIZE) { long val = hexstr_to_value(msg_data + i, CHECKSUM_SIZE); checksum ^= val; } Serial.print("Extracted Checksum (HEX): "); Serial.print(checksum, HEX); if (checksum == hexstr_to_value(msg_checksum, CHECKSUM_SIZE)) { // compare calculated checksum to retrieved checksum Serial.print(" (OK)"); // calculated checksum corresponds to transmitted checksum! } else { Serial.print(" (NOT OK)"); // checksums do not match } Serial.println(""); Serial.println("--------"); return tag; } long hexstr_to_value(char *str, unsigned int length) { // converts a hexadecimal value (encoded as ASCII string) to a numeric value char* copy = malloc((sizeof(char) * length) + 1); memcpy(copy, str, sizeof(char) * length); copy[length] = '\0'; // the variable "copy" is a copy of the parameter "str". "copy" has an additional '\0' element to make sure that "str" is null-terminated. long value = strtol(copy, NULL, 16); // strtol converts a null-terminated string to a long value free(copy); // clean up return value; }

In this program, SoftwareSerial is used because we need to access to 2 other serial pins. When we bring the tag close to the RFID module, the tag will be read and its special ID will be displayed on the Serial Monitor.

We bring two different tags closer to the module one after another and then take them away. You can see that, at first, each tag is identified and then its specific data is displayed on the Serial Monitor.

Liked What You See?​
Get Updates And Learn From The Best​

Comments (2)

  • Luis Suarez Bernaldo Reply

    Could you help me?
    I want to use the module RDM6300 to read tags RFID de 125 KHz. I see in the technical information there are two different modes of reading:
    Standard design — card can’t be read again within the range of read antenna after read once. User must move it out of reading antenna range first, swipe card again & can be read.
    Special design — card can be read continuously within the range of read antenna.
    I need use the first option, Standard desing, but my modules work reading multiple times the same tag while it was over the antenna. ¿What is the solution? Tank you

    April 4, 2024 at 2:03 pm
    • Mohammad Damirchi Reply

      Hi,
      You can easily implement a method to compare the last read ID with the new one. If they’re the same, you can simply ignore the interruption.
      Additionally, you can include a section to track the time of the last read. If this time exceeds, let’s say, 1 minute, you can erase the last read ID to prepare for a new one.

      April 8, 2024 at 6:10 am

Leave a Reply

Your email address will not be published. Required fields are marked *