0

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.

  • wiring? RX to TX and ground? – Juraj Jul 3 at 8:46
  • @juraj Verified connections and added a pic for clarity. Thank you. – Sun Bee Jul 3 at 9:10
  • I believe RYLR896 by default is at 115200. – hcheung Jul 4 at 1:20

Your Answer

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

Browse other questions tagged or ask your own question.