Ttgo-lora32-v21 lora payload missed

hello all,
trying to get the gateway working - everything seems ok except the mqtt msg looks like this everytime the test tx sends a lora msg:
{“rssi”:-32,“snr”:9.5,“pferror”:-2088,“packetSize”:11}
instead of
{“rssi”:-16,“snr”:9.5,“pferror”:-3581,“packetSize”:9,“message”:“hello 37”}

what could be the reason? and how to get it working?

btw: on a test RX the message shows up correctly

Hello,

The development branch has an example of temperature sensor and more advanced LoRa features if you want to try it:

Did you successfully built the node and it is sending data?

thanks - with the temperature-example it works :grin: Its important to adapt the pinmapping to the v21 hardware. this worked for me:

// pinmapping for TTGO-Lora-v21
#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”

#define SCK 5 // GPIO5 – SX1278’s SCK
#define MISO 19 // GPIO19 – SX1278’s MISnO
#define MOSI 27 // GPIO27 – SX1278’s MOSI
#define SS 18 // GPIO18 – SX1278’s CS
//#define RST 14 // GPIO14 – SX1278’s RESET
#define RST 23 // GPIO14 – SX1278’s RESET
#define DI0 26 // GPIO26 – SX1278’s IRQ(Interrupt Request)
#define BAND 868E6

unsigned int counter = 0;

//SSD1306 display(0x3c, 4, 15);
SSD1306 display(0x3c, 21, 22);
String rssi = “RSSI --”;
String packSize = “–”;
String packet;

float intTemperatureRead() {
SET_PERI_REG_BITS(SENS_SAR_MEAS_WAIT2_REG, SENS_FORCE_XPD_SAR, 3,
SENS_FORCE_XPD_SAR_S);
SET_PERI_REG_BITS(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_CLK_DIV, 10,
SENS_TSENS_CLK_DIV_S);
CLEAR_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_POWER_UP);
CLEAR_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_DUMP_OUT);
SET_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_POWER_UP_FORCE);
SET_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_POWER_UP);
ets_delay_us(100);
SET_PERI_REG_MASK(SENS_SAR_TSENS_CTRL_REG, SENS_TSENS_DUMP_OUT);
ets_delay_us(5);
float temp_f = (float)GET_PERI_REG_BITS2(SENS_SAR_SLAVE_ADDR3_REG,
SENS_TSENS_OUT, SENS_TSENS_OUT_S);
float temp_c = (temp_f - 32) / 1.8;
return temp_c;
}

void setup() {
// pinMode(16, OUTPUT);
// pinMode(2, OUTPUT);
pinMode(25, OUTPUT);

// digitalWrite(16, LOW); // set GPIO16 low to reset OLED
// delay(50);
// digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high

Serial.begin(115200);
while (!Serial)
;
Serial.println();
Serial.println(“LoRa Sender Test”);

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

Serial.println(“init ok”);
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);

delay(1500);
}

void loop() {
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);

display.drawString(0, 0, "Sending packet: ");
display.drawString(90, 0, String(counter));

String NodeId = WiFi.macAddress();
float temp = intTemperatureRead();
// 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(String(msg));

display.drawString(0, 15, String(NodeId));
display.drawString(0, 30, “tempc: " + String(temp) + " C”);
display.display();

counter++;
// digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(25, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
// digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
digitalWrite(25, LOW); // turn the LED off by making the voltage LOW
delay(60000); // wait for 60 seconds
}

1 Like

well, the internal temperature example works - but all other simple (as the LilyGO tx sketch mentioned in the Lora gateway doc) examples dont show the message on the OLED nor on the Webui and are not retransmitted through the gateway. Maybe a config issue - but I could not find out until now. Any hints?

Could you describe your goal/use case ?

the goal is to send a signal from a reed-contact to iobroker using lora and mqtt - something similar was described in here or in the mailbox contact youtube movie with as little overhead as possible.

edit:
found one reason of my problems, obviously the msg has now to be sent as json

{
“model”: “ESP32TEMP”,
“id”: “ESP32_MAC_ADDRESS”,
“tempc”: “TEMPERATURE_IN_CELSIUS”
}

this way I get all msgs on mqtt now,
but only tempc is displayed on oled and webui mainpage

"Auto-discovery, when the node sends an id and one of the following keys … " here only tempc seems to work or is this only meant for HASS - (which I am not using here) ?

Lora node ID as a subtopic makes sense - very useful in my case.

We can add other properties to the example and the gateway.
Something like status:open/close for example

yes please. thanks btw. for this piece of software, its the ultimate link between lora and iobroker in my case.