Comments on: ESP32 LoRa Sensor Monitoring with Web Server (Long Range Communication) https://randomnerdtutorials.com/esp32-lora-sensor-web-server/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Fri, 16 Jan 2026 19:05:53 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Jim Chisholm https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1151232 Fri, 16 Jan 2026 19:05:53 +0000 https://randomnerdtutorials.com/?p=90811#comment-1151232 In reply to Sara Santos.

Hi Sara..

Note the OLED settings..

The original sketch was missing a delay parameter and a display.display() line, thus the display was never getting properly initialized and the entire process was just hanging at that point.
Working great now !

Cheers

Jim

//initialize OLED
display.begin(OLED_SDA, OLED_SCL);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { // Address 0x3C for 128×32
Serial.println(F(“SSD1306 allocation failed”));
for(;;); // Don’t proceed, loop forever
}
delay(100);
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0,0);
display.print(“LORA SENDER”);

}

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1151142 Fri, 16 Jan 2026 11:13:11 +0000 https://randomnerdtutorials.com/?p=90811#comment-1151142 In reply to Jim Chisholm.

Hi.
What changes did you make?
Regards,
Sara

]]>
By: Jim Chisholm https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1150984 Thu, 15 Jan 2026 22:01:01 +0000 https://randomnerdtutorials.com/?p=90811#comment-1150984 In reply to Alf.

Had the same problem..

This fixed it

/*********
Rui Santos & Sara Santos – Random Nerd Tutorials
Complete project details at https://RandomNerdTutorials.com/esp32-lora-sensor-web-server/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/

//Libraries for LoRa
#include <SPI.h>
#include <LoRa.h>

//Libraries for OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//Libraries for BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

//define the pins used by the LoRa transceiver module
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26

//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6

//OLED pins
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//BME280 definition
#define SDA 21
#define SCL 13
//#define BME_SCK 13
//#define BME_MISO 12
//#define BME_MOSI 11
//#define BME_CS 10

TwoWire I2Cone = TwoWire(1);
Adafruit_BME280 bme;

//packet counter
int readingID = 0;

int counter = 0;
String LoRaMessage = “”;

float temperature = 0;
float humidity = 0;
float pressure = 0;

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);

//Initialize OLED display
void startOLED(){
//reset OLED display via software
pinMode(OLED_RST, OUTPUT);
digitalWrite(OLED_RST, LOW);
delay(20);
digitalWrite(OLED_RST, HIGH);

//initialize OLED
display.begin(OLED_SDA, OLED_SCL);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { // Address 0x3C for 128×32
Serial.println(F(“SSD1306 allocation failed”));
for(;;); // Don’t proceed, loop forever
}
delay(100);
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0,0);
display.print(“LORA SENDER”);

}

//Initialize LoRa module
void startLoRA(){
//SPI LoRa pins
SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);

while (!LoRa.begin(BAND) && counter < 10) {
Serial.print(“.”);
counter++;
delay(500);
}
if (counter == 10) {
// Increment readingID on every new reading
readingID++;
Serial.println(“Starting LoRa failed!”);
}
Serial.println(“LoRa Initialization OK!”);
display.setCursor(0,10);
display.clearDisplay();
display.print(“LoRa Initializing OK!”);
display.display();
delay(2000);
}

void startBME(){
I2Cone.begin(SDA, SCL, 100000);
bool status1 = bme.begin();
if (!status1) {
Serial.println(“Could not find a valid BME280_1 sensor, check wiring!”);
while (1);
}
}

void getReadings(){
temperature = bme.readTemperature();
humidity = bme.readHumidity();
pressure = bme.readPressure() / 100.0F;
}

void sendReadings() {
LoRaMessage = String(readingID) + “/” + String(temperature) + “&” + String(humidity) + “#” + String(pressure);
//Send LoRa packet to receiver
LoRa.beginPacket();
LoRa.print(LoRaMessage);
LoRa.endPacket();

display.clearDisplay();
display.setCursor(0,0);
display.setTextSize(1);
display.print(“LoRa packet sent!”);
display.setCursor(0,20);
display.print(“Temperature:”);
display.setCursor(72,20);
display.print(temperature);
display.setCursor(0,30);
display.print(“Humidity:”);
display.setCursor(54,30);
display.print(humidity);
display.setCursor(0,40);
display.print(“Pressure:”);
display.setCursor(54,40);
display.print(pressure);
display.setCursor(0,50);
display.print(“Reading ID:”);
display.setCursor(66,50);
display.print(readingID);
display.display();
Serial.print(“Sending packet: “);
Serial.println(readingID);
readingID++;
}

void setup() {
//initialize Serial Monitor
Serial.begin(115200);
startOLED();
startBME();
startLoRA();
}
void loop() {
getReadings();
sendReadings();
delay(10000);
}

]]>
By: Jim Chisholm https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1150983 Thu, 15 Jan 2026 21:59:34 +0000 https://randomnerdtutorials.com/?p=90811#comment-1150983 In reply to Sara Santos.

Got it fixed..
Here’s my working .ino

/*********
Rui Santos & Sara Santos – Random Nerd Tutorials
Complete project details at https://RandomNerdTutorials.com/esp32-lora-sensor-web-server/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/

//Libraries for LoRa
#include <SPI.h>
#include <LoRa.h>

//Libraries for OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//Libraries for BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

//define the pins used by the LoRa transceiver module
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26

//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6

//OLED pins
#define OLED_SDA 4
#define OLED_SCL 15
#define OLED_RST 16
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//BME280 definition
#define SDA 21
#define SCL 13
//#define BME_SCK 13
//#define BME_MISO 12
//#define BME_MOSI 11
//#define BME_CS 10

TwoWire I2Cone = TwoWire(1);
Adafruit_BME280 bme;

//packet counter
int readingID = 0;

int counter = 0;
String LoRaMessage = “”;

float temperature = 0;
float humidity = 0;
float pressure = 0;

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);

//Initialize OLED display
void startOLED(){
//reset OLED display via software
pinMode(OLED_RST, OUTPUT);
digitalWrite(OLED_RST, LOW);
delay(20);
digitalWrite(OLED_RST, HIGH);

//initialize OLED
display.begin(OLED_SDA, OLED_SCL);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { // Address 0x3C for 128×32
Serial.println(F(“SSD1306 allocation failed”));
for(;;); // Don’t proceed, loop forever
}
delay(100);
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0,0);
display.print(“LORA SENDER”);

}

//Initialize LoRa module
void startLoRA(){
//SPI LoRa pins
SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);

while (!LoRa.begin(BAND) && counter < 10) {
Serial.print(“.”);
counter++;
delay(500);
}
if (counter == 10) {
// Increment readingID on every new reading
readingID++;
Serial.println(“Starting LoRa failed!”);
}
Serial.println(“LoRa Initialization OK!”);
display.setCursor(0,10);
display.clearDisplay();
display.print(“LoRa Initializing OK!”);
display.display();
delay(2000);
}

void startBME(){
I2Cone.begin(SDA, SCL, 100000);
bool status1 = bme.begin();
if (!status1) {
Serial.println(“Could not find a valid BME280_1 sensor, check wiring!”);
while (1);
}
}

void getReadings(){
temperature = bme.readTemperature();
humidity = bme.readHumidity();
pressure = bme.readPressure() / 100.0F;
}

void sendReadings() {
LoRaMessage = String(readingID) + “/” + String(temperature) + “&” + String(humidity) + “#” + String(pressure);
//Send LoRa packet to receiver
LoRa.beginPacket();
LoRa.print(LoRaMessage);
LoRa.endPacket();

display.clearDisplay();
display.setCursor(0,0);
display.setTextSize(1);
display.print(“LoRa packet sent!”);
display.setCursor(0,20);
display.print(“Temperature:”);
display.setCursor(72,20);
display.print(temperature);
display.setCursor(0,30);
display.print(“Humidity:”);
display.setCursor(54,30);
display.print(humidity);
display.setCursor(0,40);
display.print(“Pressure:”);
display.setCursor(54,40);
display.print(pressure);
display.setCursor(0,50);
display.print(“Reading ID:”);
display.setCursor(66,50);
display.print(readingID);
display.display();
Serial.print(“Sending packet: “);
Serial.println(readingID);
readingID++;
}

void setup() {
//initialize Serial Monitor
Serial.begin(115200);
startOLED();
startBME();
startLoRA();
}
void loop() {
getReadings();
sendReadings();
delay(10000);
}

]]>
By: Jim Chisholm https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1150935 Thu, 15 Jan 2026 16:56:08 +0000 https://randomnerdtutorials.com/?p=90811#comment-1150935 In reply to Alf.

Hey Alf

Do you recall if you ever got this sorted out?

Same here

Temperature: +�L{�b�T °C

]]>
By: Jim Chisholm https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1150932 Thu, 15 Jan 2026 16:53:46 +0000 https://randomnerdtutorials.com/?p=90811#comment-1150932 In reply to Ramey Douglas.

Hey Ramey
Do you recall if you ever got this working?
Same thing here..

Temperature: +�L{�b�T °C

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1149871 Mon, 12 Jan 2026 17:59:37 +0000 https://randomnerdtutorials.com/?p=90811#comment-1149871 In reply to Alf.

It seems maybe there is some sort of hardware problem with the board.
Regards,
Sara

]]>
By: Alf https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1149713 Mon, 12 Jan 2026 11:29:25 +0000 https://randomnerdtutorials.com/?p=90811#comment-1149713 In reply to Sara Santos.

Yes
Yes, that works fine, no problem, but unfortunately I can’t get Wi-Fi either.
All other projects work fine with the ESP32 board (not a LoRa board). The weather station and all other projects are great.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1147979 Fri, 09 Jan 2026 11:11:44 +0000 https://randomnerdtutorials.com/?p=90811#comment-1147979 In reply to Alf.

Hi.
I’m not sure.
What kind of data are you sending?
Did you test a more simple example from the library to test the transmitter?
regards,
Sara

]]>
By: Alf https://randomnerdtutorials.com/esp32-lora-sensor-web-server/#comment-1147528 Thu, 08 Jan 2026 10:36:51 +0000 https://randomnerdtutorials.com/?p=90811#comment-1147528 Hello I recreated this with a TTGO Lora32 OLED board. The lora_sender_BME280 file works fine on my display, but the monitor outputs all kinds of junk. Everything looks fine, and I’ve downloaded the instruction manual. I have no idea what I’m doing wrong. The web server isn’t working either, but that’s because the transmitter isn’t

�������n�;rn�#ll�$Ǜ�N���n�svn�#l��$���n���n�;rn�#l��$���n���n�srn�#ll`ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4660
load:0x40078000,len:15576
load:0x40080400,len:4
load:0x40080404,len:3152
entry 0x400805a0

8�nllln��n�8n~���?�N�lbl���n���n�svn�#l���n���n�srn�#llǛ�N��|�;rn�#�lǛ�N��|�srn�#�l`Ǜ�N��|�srn�#�;$Ǜ�N���n�srn�#l�$Ǜ�

Hi.
Have you adjusted the baud rate of the Serial Monitor?
Regards,

Sara

As you can see, my baud rate is correct, otherwise you wouldn’t be able to see the board’s data properly. rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4660
load:0x40078000,len:15576
load:0x40080400,len:4
load:0x40080404,len:3152
entry 0x400805a0
This is working fine, but the translation from the display to LoRa is not working properly. I’ve checked and tested the lib you provided. What’s wrong? The board driver is the TTGO-Lora32-OLED (no TF card). The only difference is that you’re using the TTGO-Lora32-OLED V1. I’d love to hear from you.

]]>