Trying to send and receive data TX/RX - M30Z134 - 134.2 KHz

Hey Arduino community.

Trying to understand the basics of sending and receiving through the D-Think M30Z134
module.

Datasheet of the product is attached.

Trying to mange how i send the commands of
“Header Length Identifier Command Parameters Checksum”

Mentioned on page 5 at the datasheet submitted

Each is represented by 2BYTE except checksum that is 1BYTE
How do i send this command to receive the result of rfid 134.2 chip is nearby the antenna?

Appreciate your help,
Itamare

D-Think_M30Z134 DataSheet_ EN.pdf (585 KB)

Trying to mange how do i send the commands of
"Header + Length + Device identifier code + Command + Status + Parameters +
Checksum"

What have you tried?

Sorry. Forgot to mention.

UNO R3 - M30Z134

TX - RX
RX - TX
3.3v - 3.3v
GND - GND


char c;

void setup() { 
Serial.begin(9600);
Serial.write("AABB");
Serial.write("0600H");
Serial.write("0000H");
Serial.write("0103H");
Serial.write("01H");
Serial.write("03H"); 
}  


 void loop() { 
  if(Serial.available() > 0) { 
    c = Serial.read();
    Serial.println(c);
  }
}

You seem to be trying to use Pins 0 and 1 for two purposes - to connect to your device and to communicate with the Arduino Serial Monitor. That won't work.

You should create a second serial connection with SoftwareSerial and use that to communicate with your device

...R

Thank you, but still it doesn’t work.
That’s the new code:
All is wired properly

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  mySerial.write("AABB");
  mySerial.write("0600H");
  mySerial.write("0000H");
  mySerial.write("0103H");
  mySerial.write("01H");
  mySerial.write("03H"); 
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

I guess that the problem is in “mySerial.write(string)”. Maybe i’m transmitting the wrong bytes to the M30Z134 module? (Referred to the datasheet submitted above).

You're sending strings, not binary values. Wrong.

Header: 2BYTE,0xAABB

That would be sent using

Serial.write(0xAA);
Serial.write(0xBB);

not that rubbish you wrote.

Thank you PaulS.

So if ill send the sequence

Serial.write(0xAA);
Serial.write(0xBB);

What is the right way to send "0600H", "0000H", "01H", "03H" BYTES?

Itamare:
Thank you PaulS.

So if ill send the sequence

Serial.write(0xAA);

Serial.write(0xBB);




What is the right way to send "0600H", "0000H", "01H", "03H" BYTES?

The same way @PaulS sent "AABB". :slight_smile:

Still not sure i’ve got it.
when i’m sending the sequence:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  mySerial.write(0xAABB);
  mySerial.write(0x0600H);
  mySerial.write(0x0000H);
  mySerial.write(0x0103H);
  mySerial.write(0x01H);
  mySerial.write(0x03H);
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

I get this error:
error: invalid suffix “H” on integer constant
invalid suffix “H” on integer constant

As mentioned on the datasheet the BYTES needs to include ‘H’ at the end, is there another way to mange it?

Thanks again.

Still not sure i've got it.

We are. You have not.

  mySerial.write(0xAABB);

The write() method takes a byte. 0xAABB will NOT fit in a byte. I've shown you how to send that value. Why do you keep f**king it up?

Why do you not get the fact that your stupid Hs on the end of values are wrong?

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);

uint8_t open_ANT[] = {0xAA, 0xBB, 0x06, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x03};

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  mySerial.write(open_ANT, sizeof(open_ANT));
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

https://www.arduino.cc/en/Serial/Write

@PaulS Appreciate your kindly words.

@aarg You're great! Thank you. i'll try it later on.