Heltec Wifi Lora-32 v2 gateway not receive LORA messages from other Heltec Lora

I’m a newbie and I have just 2 Heltec wifi Lora v2 boards. Loading a simple code (Sender-Receiver in 868 band) in both boards the program works properly.

Now, trying to go one step forward, I just loaded OpenMqttGateway software (Heltec-wifi-Lora 32 V2 868E9) in one of the boards, connected to Mosquitto Broker (correct and receiving standard messages from the board system, version,…) but it´s unable to receive messages from the Sender board.

I´ve uploaded simple code in the sender (like send Hello +counter) or even create a Json message with the values of the DHT11 sensor. But the gateway does not receive or reply to the broker anything.

The software loaded in the gateway it´s just the code loaded from the Web and just modified the parameter to the connector to Wifi and Mosquitto., so the configuration parameters file, etc are the default loaded from the Web.

Any advice on what I´m doing wrong?

Sender Code:
// Lora setup (based in Heltec Example)
#include “heltec.h”
#include “images.h”
#include “Arduino.h”
#include “DHT.h”
#define BAND 868E6 //you can set band here directly,e.g. 868E6,915E6

void setup()
{
if (serial_msg){
Serial.begin(115200);
while (!Serial);
}

//WIFI Kit series V1 not support Vext control
Heltec.begin(true /DisplayEnable Enable/, true /Heltec.Heltec.Heltec.LoRa Disable/, true /Serial Enable/, true /PABOOST Enable/, BAND /long BAND/);

Heltec.display->init();
Heltec.display->flipScreenVertically();
Heltec.display->setFont(ArialMT_Plain_10);
logo();
delay(1500);
Heltec.display->clear();

Heltec.display->drawString(0, 0, “Heltec.LoRa Initial success!”);
Heltec.display->display();
delay(1000);
}

///// Lora Send packet
// send packet

LoRa.beginPacket();

dtostrf(temperaturaC, 4, 1, tempStr);
dtostrf(humedad, 4, 1, humStr);
dtostrf(hic, 4, 1, hicStr);

String jsonData = “{"nodeid":”;
jsonData += String(nodeId);
jsonData += “,"tempc":”;
jsonData += String(tempStr);
jsonData += “,"hum":”;
jsonData += String(humStr);
jsonData += “,"pres":”;
jsonData += String(hicStr);
jsonData += “}”;

LoRa.print(jsonData);
LoRa.endPacket();
…///

1 Like

Same problem here any help ?

Hello,

I have the same issue. Here are the setups I’ve tried so far (I have 2 heltec wifi lora-32 v3 boards and 1 heltec wifi lora-32 v2). I want to use the v2 with openmqtt gateway.

I wrote a very simple example program (let’s call it P1) which uses Radiolib for the v3 board that display received messages and send messages on demand.

Setup 1: P1 on the two v3 boards. Everything works as expected: both boards can send and receive messages.

Setup 2: P1 on v3 board, OMG on v2 board. v2 board does not receive message but if it sends message (using commands/MQTTtoLORA topic), the v3 board receives it.

Setup 3: I wrote a simple program (call it P2) for the v2 board that display received messages. It uses the same library as OMG (although the most recent version). Everything works: v3 board with P1 can send messages that are received by P2 on v2 board.

I assumed one of the LORA_* constants was not defined correctly between P1 and OMG so I reviewed every parameter one by one without success. The only difference seems to be what can be ingested by crc configuration (OMG library takes a bool while P1 takes 0, 1 or 2).

At this point, I’m convinced all my boards are working correctly (there all demonstrated they can receive and send Lora messages).

In case it matters, here is P2:


#include "heltec.h"
#include "lora/LoRa.h"


void setup() {
  Heltec.begin(
    true,
    true,
    true,
    true,
    868E6);
  LoRa.setTxPower(10, PA_OUTPUT_PA_BOOST_PIN);
  LoRa.setSpreadingFactor(9);
  LoRa.setSignalBandwidth(125E3);
  LoRa.setCodingRate4(7);
  LoRa.setPreambleLength(8);
  LoRa.setSyncWord(0x12);
  LoRa.enableCrc();

  LoRa.beginPacket();
  LoRa.print("v2_up");
  LoRa.endPacket();
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    Heltec.display->setColor(WHITE);
    Heltec.display->drawString(0, 33, String(packetSize));
    Heltec.display->display();

    String packet = receive_packet(packetSize);
    Serial.print("Received packet");
    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());

    Heltec.display->clear();
    Heltec.display->flipScreenVertically();
    Heltec.display->setColor(WHITE);
    Heltec.display->drawString(0, 31, String(packet));
    Heltec.display->display();

    Serial.println("normally we should have displayed something ");
  }
}

String receive_packet(int packetSize) {
  char packet[packetSize];
  int i = 0;
  for (int i=0; i<packetSize; i++) {
    char c = (char)LoRa.read();
    packet[i] = c;
  }

  Serial.println("packet: " + String(packet));
  
  return String(packet);
}

Here is my OMG config:

[env:beehive_receiver]
extends = heltec-wifi-lora-32
platform = ${com.esp32_platform}
board = heltec_wifi_lora_32_V2
build_flags =
  ${env:heltec-wifi-lora-32.build_flags}
  '-DGatewayName="OMG-Beehive-1"'
  '-DBase_Topic="beehive/"'
  '-DESPWifiManualSetup=true'
[...]
  '-DNET_DNS="8.8.8.8"'
  '-DLED_RECEIVE=LED_BUILTIN'
  '-DLED_RECEIVE_ON=LOW'
  '-DLORA_SPREADING_FACTOR=9'
  '-DLORA_CODING_RATE=5' 
  '-DLOG_LEVEL=LOG_LEVEL_TRACE'
  '-DLORA_SIGNAL_BANDWIDTH=125E3'
  '-DLORA_BAND=868E6'

monitor_speed = 115200
lib_deps =
  ${libraries.ssd1306}
  ${libraries.pubsubclient}
  ${libraries.arduinojson}
  ${libraries.arduinolog}
  ${libraries.wifimanager32}
  ${libraries.lora}

@1technophile would you have a suggestion on how to debug this further please?

Did you try the example given to send a LoRa msg, it should work with it:

Thanks for your answer.

I’ve tried to use the demo sender (on the heltec lora V3 board) indeed but it fails to initialize lora.
I think it is due to Any plans to support the 1262 module which is replacing the 1276 for many applications? · Issue #667 · sandeepmistry/arduino-LoRa · GitHub

Here is the simplified code I’ve used:

#include <LoRa.h>
#include <SPI.h>
#include <WiFi.h>
#include <Wire.h>
#include <stdio.h>

#include "SSD1306.h"
#include "rom/ets_sys.h"
#include "soc/rtc_cntl_reg.h"
#include "soc/sens_reg.h"

// from https://github.com/espressif/arduino-esp32/blob/b98255d8d1be7280e767f15a8c759e13e00f4b4a/variants/heltec_wifi_lora_32_V3/pins_arduino.h#L3
#define SCK  9 
#define MISO 11 
#define MOSI 10
#define SS   8 
#define RST  12
#define DI0  14
#define BAND 868E6

unsigned int counter = 0;

String rssi = "RSSI --";
String packSize = "--";
String packet;


void setup() {
  Serial.begin(115200);
  while (!Serial)
    ;
  Serial.println();
  Serial.println("LoRa Sender Test");

  SPI.begin(SCK, MISO, MOSI, SS);
  Serial.println("checkpoint1");
  LoRa.setPins(SS, RST, DI0);
  Serial.println("checkpoint2");
  if (!LoRa.begin(BAND)) {
    Serial.println("Starting LoRa failed!");
    while (1)
      ;
  }

  Serial.println("init ok");
  

  delay(1500);
}

void loop() {
  

  

  String NodeId = WiFi.macAddress();
  float temp = 42;
  // send packet
  LoRa.beginPacket();
  // Build json string to send
  String msg = "{\"model\":\"ESP32TEMP\",\"id\":\"" + NodeId + "\",\"tempc\":" + String(temp) + "}";
  // Send json string
  LoRa.print(msg);
  LoRa.endPacket();

  Serial.println(msg);
  
  

  delay(5000);

  // Send makerfab soil sensor example packet
  LoRa.beginPacket();
  String msg2 = "ID010770 REPLY : SOIL INEDX:5862 H:100.00 T:1.77 ADC:624 BAT:857";
  LoRa.print(msg2);
  LoRa.endPacket();

  Serial.println(msg2);

  counter++;

  delay(60000); // wait for 60 seconds
}

okay, let’s go back to your P1 program. If you have look at the OMG Logs in trace mode (can be configured from the WebUI), do you see something when a packet is sent by the nodes ?

Thanks for your reply. I’m not seing any trace when I send a message from P1 on the v3 board.

Latest traces on OMG are:

T: Dequeue JSON
N: Send on /SSD1306toMQTT msg {"onstate":true,"brightness":39,"display-flip":true,"idlelogo":true,"log-oled":false,"json-oled":true}
T: jsonPubl - ON
T: [ OMG->MQTT ] topic: beehive/OMG_ESP32_LORA/SSD1306toMQTT msg: {"onstate":true,"brightness":39,"display-flip":true,"idlelogo":true,"log-oled":false,"json-oled":true} 
T: Dequeue JSON
N: Send on /WebUItoMQTT msg {"displayMetric":true,"webUISecure":true,"displayQueue":1}
T: jsonPubl - ON
T: [ OMG->MQTT ] topic: beehive/OMG_ESP32_LORA/WebUItoMQTT msg: {"displayMetric":true,"webUISecure":true,"displayQueue":1}

I’ve added a trace line here and we never enter (packetSize is constantly zero).

Do you think you could try to add RadioLib for the OMG LoRa reception ?
The library is already used for RTL_433.

I can try for sure but in about one month (I’ll be without a computer for a few weeks).

1 Like

I looked a bit at the code and I don’t think I can do it with my current abilities.
Sorry!

That’s OK, thanks for looking