Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » ESP32 & LoRa SX1278/76 Transmitter Receiver with OLED
ESP32 Projects IoT Projects LoRa/LoRaWAN Projects

ESP32 & LoRa SX1278/76 Transmitter Receiver with OLED

Mamtaz AlamBy Mamtaz AlamUpdated:May 26, 20233 Comments6 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
ESP32 Lora SX1278
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

In this tutorial, we will make Lora Transmitter & Receiver using Lora Module SX1278 & ESP32 Wifi Module. The communication type is a point to point and data will be transferred wirelessly from one end (transmitter) to another end (receiver).


Overview

In the last couple of years, there is a number of communication technologies available for interaction between IoT devices. The most popular ones are the Wi-Fi Technology and Bluetooth Module. But they have few limitations like limited range, limited access points & high power consumption. So LoRa technology is introduced by Semtech to fix all these issue. Using a single battery the device operates over a year.

In this tutorial, we will interface LoRa Module SX1278/76 with ESP32 Board. We will make a transmitter and receiver circuit. We will display the received parameters on 0.96″ I2C OLED Display. We will take two examples for learning Lora SX1278/76 & ESP32 Communication. First, we will transmit a simple packet and check whether the data is received at the receiver end or not. Then we will add DS18B20 Waterproof Temperature Sensor to transmitter Circuit and send the temperature value wirelessly to the receiver end. The value can be seen on OLED Display

Before getting started, you can visit the following posts:
1. Interfacing SX1278 (Ra-02) LORA Module with Arduino: Check Here
2. Sending Sensor Data Wirelessly with LoRa SX1278 & Arduino: Check Here
3. ESP8266 & LoRa SX1278 Transmitter Receiver with DHT11: Check Here
4. ESP32 LoRa Sensor Data Monitoring on Web Server: Check Here
5. ESP32 LoRa Thingspeak Gateway with LoRa Sensor Node: Check Here



Bill of Materials

Following are the components required for making this project. All the components can easily be purchased from Amazon. The components purchase link is given below.

S.N.ComponentsQuantityPurchase Links
1ESP32 Board2Amazon | AliExpress
2LoRa Module SX12782Amazon | AliExpress
30.96" I2C OLED Display1Amazon | AliExpress
4Connecting Wires20Amazon | AliExpress
5Breadboard1Amazon | AliExpress
6DS18B20 Sensor1Amazon | AliExpress
7Resistor 4.7K1Amazon | AliExpress

Semtech SX1278 LoRa Module

SX1278 Module

The SX1276/77/78/79 transceivers feature the LoRa® long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.

LoRa SX1278

SX1278 can achieve a sensitivity of over -148dBm using a low-cost crystal. The high sensitivity combined with the integrated +20dBm power amplifier yields industry leading link budget making it optimal for any application requiring range or robustness. Lora SX1278 also provides significant advantages in both blocking and selectivity over conventional modulation techniques, solving the traditional design compromise between range, interference immunity and energy consumption. Learn more about it at: Semtech SX1278 Datasheet.

Semtech SX1278 Pinout

There are different versions and types of SX1278 breakout board available in market. But basically all of them has same pinout as LoRa SX1278 is an SPI module. I am using this board as shown in photos below.

SX1278 Pinout

This module version of SX1278 has 12 pins for interfacing with microcontroller & additional two pins for antenna.

SX1278 Pinout




DS18B20 Waterproof Digital Temperature Sensor:

This is a pre-wired and waterproofed version of the DS18B20 sensor. Handy for when you need to measure something far away, or in wet conditions. The Sensor can measure the temperature between -55 to 125°C (-67°F to +257°F). The cable is jacketed in PVC.

Because it is digital, there is no signal degradation even over long distances. These 1-wire digital temperature sensors are fairly precise, i.e ±0.5°C over much of the range. It can give up to 12 bits of precision from the onboard digital-to-analog converter. They work great with any microcontroller using a single digital pin.

DS18B20 Temperature Sensor

The only downside is they use the Dallas 1-Wire protocol, which is somewhat complex and requires a bunch of code to parse out the communication. We toss in a 4.7k resistor, which is required as a pullup from the DATA to the VCC line when using the sensor.

To learn more about this, check here: Temperature Meter using DS18B20 OLED Display & Arduino


0.96″ OLED Display

This is a 0.96 inch blue OLED display module. The display module can be interfaced with any microcontroller using SPI/IIC protocols. It is having a resolution of 128×64. The package includes display board, display,4 pin male header pre-soldered to board.

OLED (Organic Light-Emitting Diode) is a self light-emitting technology composed of a thin, multi-layered organic film placed between an anode and cathode. In contrast to LCD technology, OLED does not require a backlight. OLED possesses high application potential for virtually all types of displays and is regarded as the ultimate technology for the next generation of flat-panel displays.




Required Libraries

First add these following libraries to Arduino IDE. Without these libraries the code won’t compile.

  1. Adafruit_SSD1306 : https://github.com/adafruit/Adafruit_SSD1306
  2. Adafruit_GFX : https://github.com/adafruit/Adafruit-GFX-Library
  3. LoRa Library: https://github.com/sandeepmistry/arduino-LoRa
  4. One Wire Library: https://github.com/PaulStoffregen/OneWire
  5. Dallas Temperature Library: https://github.com/milesburton/Arduino-Temperature-Control-Library

Simple ESP32 & LoRa SX1278/76 Transmitter Receiver

Let us run a simple sketch and check whether the LoRa module is able to communicate or not. The transmitter & Receiver circuit is the same. You can assemble the circuit in a breadboard. Assemble a pair of circuits so that one will be the transmitter and the other will be a receiver.

ESP32 LoRa SX1278
Fig: ESP32 LoRa SX1278 Transmitter & Receiver Circuit

The connection is fairly simple. Similarly, connect the Lora SX1278 & ESP32 as follows.

ESP32 PinsSX1278 Pins
GND GND
3.3VVCC
D5NSS
D23 MOSI
D19 MISO
D18 SCK
D14 RST
D2 DIO0


Source Code for Simple ESP32 LoRa SX1278/76 Transmitter Receiver

The transmitter & receiver code is given below. Upload the transmitter & receiver code to both the ESP32 Board.

Transmitter Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <LoRa.h>
#include <SPI.h>
 
#define ss 5
#define rst 14
#define dio0 2
 
int counter = 0;
 
void setup()
{
  Serial.begin(115200);
  while (!Serial);
  Serial.println("LoRa Sender");
 
  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module
  
  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");
}
 
void loop()
{
  Serial.print("Sending packet: ");
  Serial.println(counter);
 
  LoRa.beginPacket();   //Send LoRa packet to receiver
  LoRa.print("hello ");
  LoRa.print(counter);
  LoRa.endPacket();
 
  counter++;
 
  delay(10000);
}


Receiver Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <LoRa.h>
#include <SPI.h>
 
#define ss 5
#define rst 14
#define dio0 2
 
void setup()
{
  Serial.begin(115200);
  while (!Serial);
  Serial.println("LoRa Receiver");
 
  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module
 
  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");
}
 
void loop()
{
  int packetSize = LoRa.parsePacket();    // try to parse packet
  if (packetSize)
  {
    
    Serial.print("Received packet '");
 
    while (LoRa.available())              // read packet
    {
      String LoRaData = LoRa.readString();
      Serial.print(LoRaData);
    }
    Serial.print("' with RSSI ");         // print RSSI of packet
    Serial.println(LoRa.packetRssi());
  }
}

Once the code is uploaded, you can now open the serial monitor on both port and check whether the data is successfully transmitted or received.


ESP32 LoRa SX1278 Transmitter Receiver with OLED & DS18B20 Sensor

Now let us make an advanced Lora ESP32 Transmitter & Receiver Circuit. Now we will send the DS18B20 Sensor Temperature value wirelessly. In the transmitter End we will add an extra DS18B20 Temeprature Sensor with Lora SX1278 & ESP32. On the receiver end we will ad an 0.96″ I2C OLED Display to ESP32 with LoRa SX1278.

Fig: LoRa SX1278 ESP32 Transmitter Circuit with DS18B20 Sensor
Fig: LoRa SX1278 ESP32 Receiver Circuit with OLED Display

The connection between Lora SX1278 & ESP32 still remains same. But in the transmitter end, we added the DS18B20 Sensor. So, connect its input pin to GPIO4 of ESP32. Supply it with 3.3V VCC. Similarly use a 4.7K resistor as a pull-up resistor and connect it between VCC and digital input pin.

On the receiver side, I added an I2C OLED Display to ESP32 along with LoRa SX1278. Connect the SDA & SCL pin of OLED Display to GPIO21 & GPIO22 of ESP32.

ESP32 Lora SX1278 Transmitter Receiver


Source Code for ESP32 LoRa SX1278 Transmitter Receiver with OLED & DS18B20

Transmitter Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <LoRa.h>
#include <SPI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
 
#define ss 5
#define rst 14
#define dio0 2
 
int counter = 0;
 
// GPIO where the DS18B20 is connected to
const int oneWireBus = 4;    
 
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);
 
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
 
void setup()
{
  Serial.begin(115200);
  sensors.begin();
  while (!Serial);
  Serial.println("LoRa Sender");
 
  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module
  
  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");
}
 
void loop()
{
  sensors.requestTemperatures();
  float temperatureC = sensors.getTempCByIndex(0);
  Serial.print("Sending packet: ");
  Serial.println(counter);
  Serial.print("Temperature: ");
  Serial.print(temperatureC);
  Serial.println("ยบC");
  Serial.println("");
 
  LoRa.beginPacket();   //Send LoRa packet to receiver
  LoRa.print("Pckt: ");
  LoRa.println(counter);
  LoRa.print("Temp: ");
  LoRa.print(temperatureC);
  LoRa.println(" C");
  LoRa.endPacket();
 
  counter++;
 
  delay(4000);
}



Receiver Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <LoRa.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128    // OLED display width, in pixels
#define SCREEN_HEIGHT 64    // OLED display height, in pixels
#define OLED_RESET -1       // Reset pin # (or -1 if sharing Arduino reset pin)
 
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
 
#define ss 5
#define rst 14
#define dio0 2
String LoRaData;
 
void setup()
{
  Serial.begin(115200);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
  {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  delay(2000);
  display.clearDisplay();
 
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 10);
  
  display.println("LoRa Receiver");
  display.display();
  
  while (!Serial);
  Serial.println("LoRa Receiver");
 
  LoRa.setPins(ss, rst, dio0);    //setup LoRa transceiver module
 
  while (!LoRa.begin(433E6))     //433E6 - Asia, 866E6 - Europe, 915E6 - North America
  {
    Serial.println(".");
    delay(500);
  }
  LoRa.setSyncWord(0xA5);
  Serial.println("LoRa Initializing OK!");
}
 
void loop()
{
  int packetSize = LoRa.parsePacket();    // try to parse packet
  if (packetSize)
  {
    
    Serial.println("Received packet");
 
    while (LoRa.available())              // read packet
    {
      LoRaData = LoRa.readString();
      Serial.print(LoRaData);
      
    }
    Serial.print("RSSI: ");         // print RSSI of packet
    Serial.println(LoRa.packetRssi());
    Serial.println("");
    
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(20, 0);
    display.println("LoRa Receiver");
  
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0, 20);
    display.println(LoRaData);
    display.print("RSSI: ");
    display.println(LoRa.packetRssi());
    display.display();
  }
}

Once the code is uploaded, the transmitter will start and will read the temperature data. The temperature data is wirelessly send using LoRa. On the receiver side, the temperature reading is received wirelessly using LoRa. The received data is displayed on OLED Display.

ESP32 Lora OLED


Video Tutorial & Demonstration

ESP32 & LoRa Sensor Data Monitoring ||Sender + Receiver with OLED Display
Watch this video on YouTube.

If you want to send the temperature data to Web Server you can visit this advanced tutorial: ESP32 LoRa Sensor Data Monitoring on Web Server

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleThe History of Printed Circuit Board PCB 1880 – Present
Next Article ESP32 LoRa Sensor Data Monitoring on Web Server

Related Posts

ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

Updated:June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

Updated:June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

Updated:May 10, 20262K
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

Updated:May 2, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

Updated:April 27, 20261K
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

Updated:April 27, 20262K
View 3 Comments

3 Comments

  1. M on May 15, 2020 8:39 PM

    Hello

    i got error whats wrong?

    Documents/Arduino/reciver_lora/reciver_lora.ino: In function ‘void setup()’:
    reciver_lora:37:3: error: ‘LoRa’ was not declared in this scope
    LoRa.setPins(ss, rst, dio0); //setup LoRa transceiver module
    ^
    Documents/Arduino/reciver_lora/reciver_lora.ino: In function ‘void loop()’:
    reciver_lora:56:12: error: ‘LoRa’ was not declared in this scope
    while (LoRa.available()) // read packet
    ^
    reciver_lora:58:7: error: ‘LoraData’ was not declared in this scope
    LoraData = LoRa.readString();
    ^
    reciver_lora:63:20: error: ‘LoRa’ was not declared in this scope
    Serial.println(LoRa.packetRssi());
    ^
    exit status 1
    ‘LoRa’ was not declared in this scope

    Reply
  2. paogah on December 9, 2023 4:38 AM

    need install the library

    Reply
  3. Neil Heckroodt on August 2, 2024 6:05 AM

    Hello,

    Fantastic infomation and working as expected,

    Have you investigated in making this project with a unique identifier? Meaning you have multiple sensors on the transmitter and depending on the sensor it will post to a desired receiver?

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • Designing of MPPT Solar Charge Controller using Arduino
    Designing of MPPT Solar Charge Controller using Arduino
  • RS-485 Simplex Communication with Arduino & MAX485
    RS-485 Simplex Communication with Arduino & MAX485
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.