Wemos D1 mini pro + LoRa Ra-02 gibberish text

Hi,

I want to transfer data between an Arduino UNO (transmitter) and a Wemos D1 mini pro (transceiver) using two LoRa modules (SX1278 Ra-02 LoRa Module 433Mhz (OT3206)), both equipped with an external antenna.

One LoRa modules is connected to the Arduino UNO as follows:

  • RA-02 VCC to Arduino Uno 3.3V
  • RA-02 GND to Arduino Uno GND
  • RA-02 MISO to Arduino Uno pin 12
  • RA-02 MOSI to Arduino Uno pin 11
  • RA-02 SCK to Arduino Uno pin 13
  • RA-02 NSS to Arduino Uno pin 10

The other LoRa module is connected to the Wemos D1 mini pro as follows:

  • RA-02 VCC to ESP8266 3.3V
  • RA-02 GND to ESP8266 GND
  • RA-02 MISO to ESP8266 GPIO
  • RA-02 MOSI to ESP8266 GPIO
  • RA-02 SCK to ESP8266 GPIO
  • RA-02 NSS to ESP8266 GPIO )

The following code is used at the transmitter side to send a simple message:

#include <SPI.h>
#include <LoRa.h>

#define LORA_SDA 11
#define LORA_SCL 13
#define LORA_SS 10
#define LORA_RST 9
#define LORA_FREQUENCY 433E6  

void setup() {
  Serial.begin(19200);
  while (!Serial);

  if (!LoRa.begin(LORA_SS)) {
    Serial.println("LoRa init failed. Check your connections.");
    while (true);
  }
  
  LoRa.setFrequency(LORA_FREQUENCY);  // Set the frequency
  Serial.println("LoRa init succeeded. Frequency set to 433MHz.");
}

void loop() {
  String message = "Hello, ESP8266!";
  LoRa.beginPacket();
  LoRa.print(message);
  LoRa.endPacket();
  
  Serial.println("Message sent: " + message);
  delay(2000);
}

The following code is used at the transceiver side to receive the message:

#include <SPI.h>
#include <LoRa.h>

#define LORA_SDA 7
#define LORA_SCL 5
#define LORA_SS 8
#define LORA_RST 4
#define LORA_FREQUENCY 433E6 

void setup() {
  Serial.begin(19200);
  while (!Serial);

  if (!LoRa.begin(LORA_SS)) {
    Serial.println("LoRa init failed. Check your connections.");
    while (true);
  }
  
  LoRa.setFrequency(LORA_FREQUENCY);  // Set the frequency
  Serial.println("LoRa init succeeded. Frequency set to 433MHz.");
  LoRa.receive();
}

void loop() {
  int packetSize = LoRa.parsePacket();
  
  if (packetSize) {
    String received = "";
    while (LoRa.available()) {
      received += (char)LoRa.read();
    }
    Serial.print("Received packet with size: ");
    Serial.println(packetSize);
    Serial.print("Received message: ");
    Serial.println(received);
  }
  else {
    Serial.println("No packet received");
  }
  delay(1000);
}

Looking at the serial monitor of the transmitter side it appears that the message is being sent every 2s such as desired. However, at the receiver side i am getting gibberish text. I have checked for the correct COM port and baud rate of the serial monitor. I have tried another Ra-02 module at the transceiver side as well.

Any help or suggestions are greatly appreciated!

Kind Regards,
Emilebe

The RA-02 LoRa module uses 3.3V logic levels and should not be connected directly to the Arduino UNO which uses 5V logic levels, you need to use logic level conversion circuits.

https://stuartsprojects.github.io/2020/11/28/Do-not-connect-LoRa-devices-to-5V-Arduinos.html

The UNO 3.3V pin may not be able to supply enough current for the LoRa module as transmitter, you need a seperate 3.3V supply here.

Much much easier to use 3.3V logic level Arduinos with LoRa modules.

1 Like

Hi,

Thanks for the help.
I have connected the transmitter to an Arduino Pro Mini (3.3V) and uploaded the code through an FTDI232. However, I am still getting the same error, where the transmitter appears to send the message, but only gibberish text is produced at the transceiver side.
Any idea if there is something wrong with the code at the Wemos D1 mini pro side?

Kind regards,

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.