Help with LoRa communication between two boards

Hi guys,
I have a problem making LoRa connection between MKR WAN 1300 and WEMOS d1 mini esp32 boards.
I’ve connected WEMOS d1 mini esp32 to LoRa grove module (868mhz). The sender code is working .fine but the receiver code is not giving me the output I’m looking for
i changed the code multiple times. i tried different serial ports on esp32 (UART0, URT1, UART2) and also changed the baud rates on both codes but still the output I’m getting is either “Recv failed” or some weird characters on my serial monitor.
What could possibly be wrong with this code?
I also make sure to connect the right pins on esp32 to LoRa module each time that I change the serial port.

Receiver code

#include <Arduino.h>

#include <RH_RF95.h>

RH_RF95 rf95(Serial2);

#define RXD2 16

#define TXD2 17

void setup() {

  // Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);


  // Serial.println("test");

  //Serial1.begin(9600, SERIAL_8N1, RXD2, TXD2);

  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);

  Serial.println("Serial Txd is on pin: "+String(TX));

  Serial.println("Serial Rxd is on pin: "+String(RX));


void loop() { //Choose Serial1 or Serial2 as required


  if (rf95.available()) {


    Serial.println("Receiving message...");

        uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];

        uint8_t len = sizeof(buf);

        if(rf95.recv(buf, &len)){


          Serial.print("got request: ");






    Serial.println("Recv failed");



Sender code

#include <SPI.h>

#include <LoRa.h>

int counter = 0;

void setup() {


  while (!Serial);

  Serial.println("LoRa Sender");

  if (!LoRa.begin(868E6)) {

    Serial.println("Starting LoRa failed!");

    while (1);


   LoRa.setTxPower(20);  // Set transmit power to 20 dBm (maximum)


void loop() {

  Serial.print("Sending packet: ");


  // send packet


  LoRa.print("hello ");







Hi there,
So it looks to be working … Either the Baud rate is Incorrect or You must #DEFINE the Serial2 params, OUTLOUD …LOL (Speed, Data bits , Parity, etc.)
Also I would set all the serial stuff to 9600 (IDK where folks get this Idea that 115200 is beneficial for M/M com’s it’s not) but I digress.
You are close, keep looking. One other thing is be sure you have same logic (3.3v) or (5v) not both. and also be sure the GND is connected (3 wires) TXD, RXD, GND. be sure not to invert the RXD and GND or your data will be upside-down :face_with_peeking_eye:
GL :slight_smile: PJ :v:

Thank you for your advice. I implemented the things you said but sadly I still encounter the same problem.

Hi there,
OK, So can you connect the Lora board Directly to the PC?
Can you? Do you have a picture of this setup?
Can you post the code , You tried. and have you tried 1200 Baud?
GL :slight_smile: PJ :v:

No, It’s nor possible to connect the LoRa module directly to PC, It should be connected to a board. I don’t have access to my code right now but I’ll surely try 1200 Baud and let you know.

1 Like