Interfacing Reyax RYLR896 with Software Serial

Hello folks,

Since two weeks I have two of these LoRa transceivers. I got them working with Hardware Serial, with this code:

String message;
int prevTime;
bool sendON = true;
void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:
  if (message == "ON"){
  if (message == "OFF"){

void blink() {
  if (millis() - prevTime > 2000) {
    prevTime = millis();

    if (sendON == true) {
      send("ON", 1);
      sendON = false;

    else {
      send("OFF", 1);
      sendON = true;

void receive() {
  if (Serial.available() == 1){

  String readString = Serial.readString();

  int delimiter, delimiter_1, delimiter_2, delimiter_3;
  delimiter = readString.indexOf(",");
  delimiter_1 = readString.indexOf(",", delimiter + 1);
  delimiter_2 = readString.indexOf(",", delimiter_1 + 1);
  delimiter_3 = readString.indexOf(",", delimiter_2 + 1);
  int lengthMessage=readString.substring(delimiter_1+1,delimiter_2).toInt();
  String message = readString.substring(delimiter_2 + 1 , lengthMessage);


void send(String Transmit, int address) {
  int TransmitLength = Transmit.length();
  String message = "AT+SEND=" + String(address) + "," + String(TransmitLength) + "," + Transmit + "\n\r";

void setUp() {


  delay(100);   //wait for module to respond

  Serial.print("AT+BAND=868000000\r\n");    //Bandwidth set to 868.5MHz
  delay(100);   //wait for module to respond

  Serial.print("AT+ADDRESS=2\r\n");   //needs to be unique
  delay(100);   //wait for module to respond

  Serial.print("AT+NETWORKID=6\r\n");   //needs to be same for receiver and transmitter
  delay(100);   //wait for module to respond

But the disadvantage of using Hardware Serial is that you can’t communicate with the arduino without sending that same message to the LoRa module (because the LoRa module is connected to the Hardware Serial pins as well) .

To fix this I tried to use SoftwareSerial, so I don’t use Hardware Serial for communicating with the LoRa module. I changed the baudrate of the module; tried different pins and different arduino’s , but that didn’t work. I’ve tried NeoSWSerial and AltSoftSerial as well but still no result.

When I open the Serial Monitor with this sketch running

#include <SoftwareSerial.h>

SoftwareSerial LoRa(2, 3);  // RX, TX.

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port

void loop() { // run over and over
  if (LoRa.available()) {
  if (Serial.available()) {
// I tried saving the received data in a char as well but didn't work as well

I get something like “⸮⸮⸮⸮⸮”

So in short: is it possible to communicate with the Reyax RYLR896 without using Hardware Serial?

Arduino - LoRa Module
TX → voltage divider circuit (using as R1 5.1 kΩ and R2 10 kΩ) → RX
3.3v - VVD

Any help is much appreciated

You mean "AltSoftSerial" ?
I prefer that over SoftwareSerial, but it can not do high baudrates. With an Arduino Uno, about 28800 baud is the maximum. However, I have AltSoftSerial running in a project with an Arduino Uno at 38400 baud and never have any errors.

The normal SoftwareSerial should work better at 115200 baud. But I doubt if that is reliable.

In the documentation it says 300 ... 115200 baud.
Can you do the AT+IPR command to lower the baudrate ? Use a hardware serial port for that command just once. According to the documentation, the setting will be stored in EEPROM.
I suggest to go down to 9600 and use AltSoftSerial. I think that is the most reliable if you want to use a software serial library.

Any software implementation can cause trouble. I prefer a hardware serial port.

The SAMD boards are 3.3V boards and have an extra serial port. They are the Arduino Zero and most MKR boards: Serial - Arduino Reference.
Do not buy the Arduino Due.

AFAIK the regular SoftwareSerial library does not perform as well as AltSoftSerial or NeoSwSerial. On a 16MHz Arduino I think 39400 baud would be the max and 9600 baud would be a better choice - at least to start with.

Serial Input Basics - simple reliable non-blocking ways to receive data.

You mean “AltSoftSerial” ?


I once again tried what you said, but still no succses. I don’t know why

I’ve also tried using a USB to TTL breakout, that worked!
So I used the breakout bord to set the baudrate to 9600.\

After that I connected the LoRa module back to the Arduino then started the ‘Test’ example-sketch from the AltSoftSerial library.

Still no result

Okay, that is valuable information, the usb-to-ttl-serial to the computer works and the hardware serial port of the Arduino works.

Can you check these things:

  1. Did you use the right pins for the AltSoftSerial ?
  2. Do you use a breadboard ? They have often bad contacts. Try to move everything to an other location on the breadboard.
  3. Check the GND connections. They are the most important connections of all.
  4. When everything is turned on, but no serial data active, please measure the voltages of RX and TX. You can make a sketch with Serial.begin() or altSerial.begin(), and a empty loop(). Measure it with the Arduino board (TX after the voltage divider) and with the usb-to-ttl-serial module.

I assume that the chip on the usb-to-ttl-serial module makes makes 3.3V signals.
Your voltage divider for Arduino-TX might make the signal too weak.
The LoRa-TX could be 3.0V, that could be too low for the Arduino. When the serial bus is initialized but not active, then you can measure that voltage high level.

What is your Arduino board ? Are you using a homemade design with a weird chip without decoupling capacitors ?
Are you running too many interrupts that influences the AltSoftSerial ?


I don't know how, but I fixed it!!!!!

I'll leave a tutorial here:

  1. Make the 'LoRa wiring.png' 2x

Arduino - LoRa

8 - TXD
9 - Voltage divider (R1: 5.1K ohm & R2: 10K ohm)
3V3 - VDD

  1. Upload "LoRa 1" to one arduino

  2. Upload"LoRa 2" to the other arudino

Now you can chat with each other using the Serial Monitor

LoRa wiring.png
update: don't forget to connect the ground rail to the arduino as well!

LoRa wiring.png (2.1 KB) (1.89 KB)

Thanks for sharing.

So you are using the SoftwareSerial at 9600 baud.
As long as you don't do a lot of other things, then it is okay.
And you still have the option to use AltSoftSerial in case the SoftwareSerial causes trouble.