K
K
Konstantin Malyarov2019-08-08 18:36:25
Arduino
Konstantin Malyarov, 2019-08-08 18:36:25

How to interact with RFID on TX and RX?

1pcs-7941W-dual-frequency-read-write-car
RFID 7941W came.
When connected to the Arduino, it shows signs of life, but refuses to accept commands.

#include <SoftwareSerial.h>
SoftwareSerial rfidSerial(1, 0); // RX, TX

byte read_UID[6] = {0xAB, 0xBA, 0x00, 0x10, 0x00, 0x10};
byte read_PID[6] = {0xAB, 0xBA, 0x00, 0x15, 0x00, 0x15};
int read_UID_size = sizeof(read_UID) - 1;
int read_PID_size = sizeof(read_PID) - 1;

void setup()
{
  Serial.begin(115200);
  Serial.println("Goodnight moon!");
  rfidSerial.begin(115200);
}

void loop()
{
  if (read_PID_size != 0) {
    for (read_PID_size; read_PID_size >= 0; read_PID_size--) {
      rfidSerial.write(read_PID[read_PID_size]);
    }
  }
  Serial.println("[|||||||||||||||||||||||||||||||]");
  if (read_UID_size != 0) {
    for (read_UID_size; read_UID_size >= 0; read_UID_size--) {
      rfidSerial.write(read_UID[read_UID_size]);
    }
  }

  read_UID_size = sizeof(read_UID) - 1;
  read_PID_size = sizeof(read_PID) - 1;
  delay(500);
}

When reading:
if (Serial.available() > 0) {  
        Serial.println(Serial.read(), DEC);
    }

Returns:
spoiler

91 B9 A2 FF 67 68 74 20 6D 6F 6F 6E 21 D A 39 31 20 42 39 20 41 32 20 46 46 20 36 37 20 36 38 20 37 34 20 32 30 20 36 44 20 36 46 20 36 46 20 36 45 20 32 31 20 44 20 41 20 33 39 20 33 31 20 32 30 20 34 32 20 33 39 20 32 30 20 34 31 20 33 32 20 32 30 20 34 36 20 34 32 33 33 32 33 33 32 33 33 32 33 33 32 33 34 32 33 34 32 33 34 32 33 34 32 33 33 32 34 32 34 32 33 33 32 33 33 32 33 33 32 33 33 32 33 33 32 33 33 32 33 далее просто 33

If you disable the sensor, the same bytes are returned.
How to properly communicate with RFID?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kalapanga, 2019-08-09
@kalapanga

Find the documentation for the device and read how to work with it there.
In the sketch and in addition to direct work with the device, nonsense is written. You have SoftwareSerial on the same pins where the Arduino has a hardware serial. Do you really expect this to work? Next, for SoftwareSerial 115200 a lot. Formally supported, but rarely works in reality. And are you sure that this device works at this speed?

1
1337DOMINATOR228, 2021-05-28
@1337DOMINATOR228

Good day, in order to communicate with this module, you need to send certain messages to it, which are described in the technical documentation:
At the moment I am writing a desktop program for this module, I can share the beta version if interested.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question