Receiving unrecognized characters at LoRa receiveing station made using Grove LoRa Radio and Heltec

Good Evening Guys,
I am posting this here, in hopes of finding someone, who has mixed and matched their Grove LoRa modules.

I am working on a project where I’d like to send recorded sensor values using LoRa.

For this purpose, I am using a Seeed Studio Grove LoRa Radio as the transmitter. It uses a RFM98 as its base. To connect the LoRa radio, I have a grove basic shield. LoRa is connected at D6 and D7. As far as I can tell, the transmitter side is working well. I am sending a string.

For receiving the transmission, I am using a Heltec LoRa v3, it uses a SX1262 LoRa chip.
The data displayed on the OLED display and the Serial Monitor is a string of unrecognized characters.

TRANSMITTING SIDE CODE

#include <RH_RF95.h>

#ifdef __AVR__
    #include <SoftwareSerial.h>
    SoftwareSerial SSerial(6, 7); // RX, TX
    #define COMSerial SSerial
    #define ShowSerial Serial

    RH_RF95<SoftwareSerial> rf95(COMSerial);
#endif

void setup() {
    ShowSerial.begin(115200);
    ShowSerial.println("RF95 client test.");

    if (!rf95.init()) {
        ShowSerial.println("init failed");
        while (1);
    }

    // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

    // The default transmitter power is 13dBm, using PA_BOOST.
    // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
    // you can set transmitter powers from 5 to 23 dBm:
    //rf95.setTxPower(13, false);

    rf95.setFrequency(433.0);
    rf95.setTxPower(12);
    uint8_t a=1;
}

void loop() {
    ShowSerial.println("Sending to rf95_server");
    // Send a message to rf95_server
    char someString[15] = "battery: %i";
    char test[30];
    snprintf(test, 30, someString, a);
    ShowSerial.println(test);
    
    delay(10);

    rf95.send((uint8_t *)test, 30);
    delay(5000);
}



SERIAL MONITOR OUTPUT

01:06:13.906 -> Sending to rf95_server
01:06:13.906 -> battery: 1
01:06:18.966 -> Sending to rf95_server
01:06:18.966 -> battery: 2
01:06:23.966 -> Sending to rf95_server
01:06:24.001 -> battery: 3
01:06:29.004 -> Sending to rf95_server
01:06:29.037 -> battery: 4
01:12:31.823 -> RF95 client test.
01:12:31.861 -> Sending to rf95_server
01:12:31.861 -> battery: 0
01:12:36.894 -> Sending to rf95_server
01:12:36.894 -> battery: 1
01:12:41.944 -> Sending to rf95_server
01:12:41.944 -> battery: 2
01:12:46.947 -> Sending to rf95_server
01:12:46.985 -> battery: 3

RECEIVER SIDE CODE


// Turns the 'PRG' button into the power button, long press is off 
#define HELTEC_POWER_BUTTON   // must be before "#include <heltec_unofficial.h>"
#include <heltec_unofficial.h>


#define PAUSE               300
#define FREQUENCY           433.0       
// #define FREQUENCY           905.2       // for US
#define BANDWIDTH           125.0
#define SPREADING_FACTOR    7
#define TRANSMIT_POWER      2
#define LORA_PREAMBLE_LENGTH  8
#define CODING_RATE 5
#define SYNC_WORD 0x12

String rxdata;
volatile bool rxFlag = false;
long counter = 0;
uint64_t last_tx = 0;
uint64_t tx_time;
uint64_t minimum_pause;

// Can't do Serial or display things here, takes too much time for the interrupt
void rx() {
  rxFlag = true;
}

struct Data {
  int seq;
  float y;
} data;


void setup() {
  heltec_setup();
  both.println("Radio init");
  RADIOLIB_OR_HALT(radio.begin());
  // Set the callback function for received packets
  radio.setDio1Action(rx);
  // Set radio parameters
  both.printf("Frequency: %.2f MHz\n", FREQUENCY);
  RADIOLIB_OR_HALT(radio.setFrequency(FREQUENCY));
  both.printf("Bandwidth: %.1f kHz\n", BANDWIDTH);
  RADIOLIB_OR_HALT(radio.setBandwidth(BANDWIDTH));
  both.printf("Spreading Factor: %i\n", SPREADING_FACTOR);
  RADIOLIB_OR_HALT(radio.setSpreadingFactor(SPREADING_FACTOR));
  both.printf("TX power: %i dBm\n", TRANSMIT_POWER);
  RADIOLIB_OR_HALT(radio.setOutputPower(TRANSMIT_POWER));
  both.printf("Preamble Length: %i \n", LORA_PREAMBLE_LENGTH);
  RADIOLIB_OR_HALT(radio.setPreambleLength(LORA_PREAMBLE_LENGTH));
  both.printf("Coding Rate: %i \n", CODING_RATE);
  RADIOLIB_OR_HALT(radio.setCodingRate(CODING_RATE));
  both.printf("Sync Word: %i \n", SYNC_WORD);
  RADIOLIB_OR_HALT(radio.setSyncWord(SYNC_WORD));
  // Start receiving
  RADIOLIB_OR_HALT(radio.startReceive(RADIOLIB_SX126X_RX_TIMEOUT_INF));
}

void loop() {
  heltec_loop();

  if (rxFlag) {
    rxFlag = false;
    radio.readData(rxdata);
    if (_radiolib_status == RADIOLIB_ERR_NONE) {
      both.printf("RX [%s]\n", rxdata);
      both.printf("  RSSI: %.2f dBm\n", radio.getRSSI());
      both.printf("  SNR: %.2f dB\n", radio.getSNR());
    }
    RADIOLIB_OR_HALT(radio.startReceive(RADIOLIB_SX126X_RX_TIMEOUT_INF));
  }
  delay(5000);
}



OUTPUT

01:12:25.969 -> ESP-ROM:esp32s3-20210327
01:12:25.969 -> Build:Mar 27 2021
01:12:25.969 -> rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
01:12:25.969 -> SPIWP:0xee
01:12:25.969 -> mode:DIO, clock div:1
01:12:25.969 -> load:0x3fce3808,len:0x4bc
01:12:25.969 -> load:0x403c9700,len:0xbd8
01:12:25.969 -> load:0x403cc700,len:0x2a0c
01:12:25.969 -> entry 0x403c98d0
01:12:26.097 -> Radio init
01:12:26.176 -> [RadioLib] radio.begin() returned 0 (ERR_NONE)
01:12:26.176 -> Frequency: 433.00 MHz
01:12:26.208 -> [RadioLib] radio.setFrequency(433.0) returned 0 (ERR_NONE)
01:12:26.208 -> Bandwidth: 125.0 kHz
01:12:26.274 -> [RadioLib] radio.setBandwidth(125.0) returned 0 (ERR_NONE)
01:12:26.274 -> Spreading Factor: 7
01:12:26.306 -> [RadioLib] radio.setSpreadingFactor(7) returned 0 (ERR_NONE)
01:12:26.338 -> TX power: 2 dBm
01:12:26.377 -> [RadioLib] radio.setOutputPower(2) returned 0 (ERR_NONE)
01:12:26.408 -> Preamble Length: 8 
01:12:26.482 -> [RadioLib] radio.setPreambleLength(8) returned 0 (ERR_NONE)
01:12:26.517 -> Coding Rate: 5 
01:12:26.582 -> [RadioLib] radio.setCodingRate(5) returned 0 (ERR_NONE)
01:12:26.582 -> Sync Word: 18 
01:12:26.647 -> [RadioLib] radio.setSyncWord(0x12) returned 0 (ERR_NONE)
01:12:26.648 -> [RadioLib] radio.startReceive(0xFFFFFF) returned 0 (ERR_NONE)
01:12:31.688 -> RX [��]
01:12:31.688 ->   RSSI: -17.00 dBm
01:12:31.762 ->   SNR: 12.75 dB
01:12:31.826 -> [RadioLib] radio.startReceive(0xFFFFFF) returned 0 (ERR_NONE)
01:12:36.862 -> RX [��]
01:12:36.912 ->   RSSI: -13.00 dBm
01:12:36.928 ->   SNR: 12.75 dB
01:12:36.993 -> [RadioLib] radio.startReceive(0xFFFFFF) returned 0 (ERR_NONE)

This is the library I am using for the Heltec board. The only library I could get this working with.

Solutions I have tried after going through the forums:
I have increased the transmitting power. People said low power could result in such issues.
I have tried sending a struct from one of the solutions, but again, at the receiving side, I did not get the values I was hoping. But this time atleast I didn’t get those unrecognizable characters.

People have also suggested that we should use a proper antenna. Currently I am using a wire as an antenna on the transmitter side, which I will replace with an antenna tomorrow to see if that makes a difference.

I am an absolute novice, both when it comes to using these forums and Arduino/LoRa stuff. Please help me out.

Hi there,
Change the Baud Rate, Your getting the data so adjust it and you should be good to go.
HTH
GL :slight_smile: PJ

But adjust it to what—? Sorry, if that’s a dumb question. I have initialised Grove LoRa radio and Heltec LoRa wifi both with 115200.

EDIT:
Oh I haven’t specified the serial monitor to start with 115200. But if it isn’t specified, how in the serial monitor window for Rx, able to print RSSI and SNR values without any issues?

Hi there,
You may be dealing with the defaults on one end of it, check out the Transmitter side.
You do need to specify the speed. set it all to 9600 and try again.
Do you have a picture of the setup ?
HTH
GL :slight_smile: PJ
:v:
I don’t see it on the heltec side.