1

enter image description hereI am setting up a LoRa module (transmitter) with nodemcu (ESP8266). The module (Reyax RYLR896) accepts AT commands over serial interface. I created an additional serial port using pins D7 and D8 on the nodemcu using SoftwareSerial.h in Arduino IDE to try and set up the transmitter following this example.

I coded up the sketch below to read an AT command from native serial interface, pass it on to the LoRa module via the additional serial port, read the response and print it in serial monitor. The LoRa module should respond with "+OK" to an AT command like "AT" or with data for a command like "AT+ADDRESS". However, I get no response. So far, I have tried:

  1. Experimenting with different baud rates (9600 and 115200)
  2. Hard-coding AT command(s)
  3. Using read/write and readString/print.

The string sent via serial monitor is read correctly but the second if block is never entered.

#include <SoftwareSerial.h>

#define Rx D7
#define Tx D8

SoftwareSerial LoRaSerial(Rx, Tx);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  while (!Serial) {
    ; // Wait until native serial interface is ready.
  }
  Serial.println("Native serial interface ready!");

  LoRaSerial.begin(9600); // Also tried 115200
  LoRaSerial.println("LoRa serial interface ready!");
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available()) {
    String serial_command = Serial.readString();
    Serial.print(serial_command);
    LoRaSerial.print("AT\r\n"); // hard-coded to test
  }
  delay(200);
  if (LoRaSerial.available()) {
    String LoRa_response = LoRaSerial.readString();
    Serial.print("Done!");
    Serial.print(LoRa_response);
  }
}

The module is brand new and I have tried with two different ones. Any help is appreciated!

Connections are as follows: Node

mcu <> RYLR896

  • GND <> GND
  • D7 (Rx) <> TX
  • D8 (Tx) <> RX
  • 3V3 <> VDD

The RST on RYLR896 is not wired.

4
  • wiring? RX to TX and ground?
    – Juraj
    Jul 3 '20 at 8:46
  • @juraj Verified connections and added a pic for clarity. Thank you.
    – Sun Bee
    Jul 3 '20 at 9:10
  • I believe RYLR896 by default is at 115200.
    – hcheung
    Jul 4 '20 at 1:20
  • 2
    Has anyone solved the issue above?I have the same arrangement as above and i am not getting any response to the AT command at all. Does anyone know a simple way to test if the Reyax rylr896 is working by giving it AT command?
    – Ace
    Nov 29 '20 at 8:22
0

In order to test AT commands for Reyax Rylr 896 module, you need to connect rxd of lora module with rx(D7) of nodemcu and txd of lora module with tx(D8) of nodemcu.

0

Connect your RX to RX and TX to TX and enjoy.

1
  • 1
    This is exactly the same answer as the one from @Seetharam but with less details. Seems kind of superfluous.
    – StarCat
    Jul 21 at 10:56
0
  1. Experimenting with different baud rates (9600 and 115200)

Beware that the maximum RX baud rate is 57600 with SoftwareSerial on the Arduino. See Limitations of SoftwareSerial for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.