Interfacing SX1278 (Ra-02) LORA Module with Arduino

A variety of communication methods for interaction amongst IoT devices have been available in recent years. Wi-Fi Technology and Bluetooth modules are the most common. However, they have a few drawbacks, such as limited range and access points. If you use a battery-powered mobile device, the power consumption of Wi-Fi and Bluetooth technologies is considerable, which quickly drains the battery.

The same can be said for cellular networks and local area networks, both of which have severe power consumption issues. To cover a large area, both a LAN and a cellular network are relatively expensive. IoT sectors have introduced a slew of new technologies in recent years, but none of them has proven to be optimal. IoT devices must be able to send data over vast distances without consuming a lot of power. When LoRa technology was released, it caused a revolution in the IoT area. LoRa Technology allows for very long-range transmission while consuming very little power. Smart water monitoring, remote appliance control, smart parking, autonomous irrigation, smart agriculture, and soil health monitoring are just a few of the Lora uses.

In this tutorial, we’ll learn how to connect an Arduino to an SX1278 (Ra-02) LORA Module. We’ll use the SX1278 LORA and Arduino to build a transmitter and receiver circuit. Using a potentiometer, we will regulate the brightness of the LED wirelessly. Any LoRa module based on one of the following chips can be utilized with the LoRaLib library: SX1272 or SX1273, SX1276, SX1277, SX1278, or SX1279, RFM95, RFM96, RFM97, or RFM98.

Need for LoRa Communication Module

Today’s IoT devices employ a variety of different technologies to facilitate their connections, but none of them are truly optimal for the purpose and application at hand. Wi-Fi is popular at the moment, but it consumes a lot of energy and sends a lot of data. While this is fantastic, it isn’t the best answer for IoT devices that don’t have as much energy or want to communicate little quantities of data. There are also restrictions in the modulation techniques utilized, thus access points can only manage a small number of devices at once.

Bluetooth devices provide local connection; however, their range is quite limited in version 4.0. They also need an excessive amount of electricity. Even newer Bluetooth Low Energy devices utilize far more power than is required. Until recently, the best available technology on the market was thought to be ZigBee low-power modules, which transmit across longer distances and at lower transfer rates, often a few kilometers in a clear route.

LoRa Technology:

LoRa is a new wireless protocol intended primarily for long-distance, low-power communications. LoRa, which stands for Long Range Radio, is primarily intended for M2M and IoT networks. This technology will allow public or multi-tenant networks to link many applications that are running on the same network.

LoRa Alliance is a non-profit organization that was founded to standardize LPWAN (Low Power Wide Area Networks) for IoT. Its membership includes a number of significant market stockholders such as CISCO, activity, MicroChip, IBM, STMicro, SEMTECH, Orange mobile, and many more. This partnership is critical for ensuring interoperability among numerous national networks.

LoRa is based on chirp spread spectrum modulation, which, like FSK modulation, has low power characteristics yet may be utilized for long-distance communications. LoRa may be used to wirelessly link sensors, gateways, machines, devices, animals, and humans to the cloud. LoRa Technologies works in several frequency bands in different regions: in the United States, it operates in the 915 MHz band, in Europe, in the 868 MHz band, and in Asia, in the 865 to 867 MHz, 920 to 923 MHz bands. Learn more about LoRa frequency bands by clicking here

Understanding the LoRa technology & its working

The core idea is that chirp is used to encode information (a gradual increase or decrease in the frequency of the carrier wave over time). The LoRa transmitter will send out a chirp signal before transmitting a message to ensure that the band is free to send the message. The conclusion of the preamble is signaled by the reverse chirp, which signals the LoRa transmitter that it is okay to commence transmission once the LoRa receiver has picked up the preamble chirp from the transmitter.

Lora Architecture

The architecture shown in this figure is explained below:

1. Devices:

  • LoRa Modulation: The physical (PHY) silicon layer, or wireless modulation, used to produce the long-range communication link is known as LoRa Technology.
  • Transceivers & End-Nodes: LoRa Technology-enabled transceivers are integrated into end-nodes, or sensor devices, for a variety of industry applications.
  • Picocells & Gateways: Sensors collect and send data to gateways over short and long distances, indoors and out, with little power consumption.

2. Network Server

Gateways provide data to the network server by Wi-Fi, Ethernet, or cellular, which handles network management operations such as over-the-air activation, data de-duplication, dynamic frame routing, adaptive rate control, traffic management, and administration.

3. Application Servers & Cloud IoT Services:

Applications analyze data generated by LoRa-enabled devices, using machine learning and artificial intelligence techniques to address business challenges for a Smarter Planet.

Semtech SX1278 LoRa Module

The LoRa® long-range modem in the SX1276/77/78/79 transceivers delivers ultra-long range spread spectrum communication and high interference immunity while consuming minimal current.

LoRa SX1278

Using a low-cost crystal, SX1278 can reach a sensitivity of over -148dBm. The combination of high sensitivity and an integrated +20dBm power amplifier results in an industry-leading link budget, making it ideal for any application needing range or durability. Lora SX1278 also outperforms existing modulation approaches in terms of blocking and selectivity, resolving the classic design compromise between range, interference immunity, and energy consumption.

Semtech SX1278 Applications

  • Automated Meter Reading
  • Home and Building Automation
  • Wireless Alarm and Security Systems
  • Industrial Monitoring and Control
  • Long-range Irrigation Systems

Semtech SX1278 Pinout

In the market, there are various varieties and variants of the SX1278 breakout board. However, because the LoRa SX1278 is an SPI module, they all have the same pinout. This is the board I’m using in the photographs below.

SX1278 Pinout

This module version of the SX1278 features 12 pins for microcontroller interfacing and two additional pins for the antenna.

SX1278 Pinout

Interfacing SX1278 LoRa Module with Arduino

The SX1278 Ra-02, which works at 433MHz, is the LoRa module I’m utilizing here. However, this module cannot be breadboarded and does not have a soldered antenna. To make it breadboard compatible, I just soldered a few 2.54′′ male connectors. The antenna was also soldered by myself.

Lora SX1278 Connector

Let’s get started using SX1278 Arduino Interfacing. We’ll use two LoRa modules and two Arduino boards to send and receive data from one board to the other. On the transmitter side, we’ll use an Arduino Nano, and on the receiving side, an Arduino Uno.

Interfacing SX1278 LORA Arduino

Let us see the circuit of the transmitter and receiver parts separately.

Arduino LoRa SX1278 Transmitter

The Arduino LoRa SX1278 Transmitter circuit diagram is shown below. This circuit can either be built on a PCB or assembled on a breadboard.

Arduino Lora Transmitter Circuit

Since the LoRa SX1278 is not 5V compatible, do not power it with 5V. Otherwise, the board will be broken. Connect the Arduino’s 3.3V pin to the VCC pin. All of the GND pins should be connected to GND. Connect Arduino’s RST pin to D9 and DIO0 to D2. As indicated in the circuit diagram above, connect the SPI pins NSS, MOSI, MISO, and SCK to Arduino D10, D11, D12, and D13, respectively.

Connect the middle pin of any potentiometer, such as a 10K, to A0 on the Arduino and the remaining two pins to GND and 5V.

Arduino LoRa Transmitter

Arduino LoRa SX1278 Receiver

The circuit diagram for the Arduino LoRa SX1278 Receiver is also provided below. This circuit can either be built on a PCB or assembled on a breadboard.

Arduino Lora Receiver Circuit

Since the LoRa SX1278 is not 5V compatible, do not power it with 5V. Otherwise, the board will be broken. Connect the Arduino’s 3.3V pin to the VCC pin. All of the GND pins should be connected to GND. Connect Arduino’s RST pin to D9 and DIO0 to D2. As indicated in the circuit diagram above, connect the SPI pins NSS, MOSI, MISO, and SCK to Arduino D10, D11, D12, and D13, respectively.

Use any LED and connect it to D3 of Arduino as shown in the photos above.

Arduino LoRa Receiver

Source Code/Program

You’ll need a LoRa library to communicate between two LoRa modules. To install the LoRa Library, go to Library Manager and search for LoRa.

LORA Library

Transmitter Code

#include <SPI.h>
#include <LoRa.h>
int pot = A0;

void setup() {

while (!Serial);
Serial.println(“LoRa Sender”);
if (!LoRa.begin(433E6)) { // or 915E6, the MHz speed of yout module
Serial.println(“Starting LoRa failed!”);
while (1);

void loop() {
int val = map(analogRead(pot),0,1024,0,255);

Receiver Code

#include <SPI.h>
#include <LoRa.h>
int LED = 3;
String inString = “”; // string to hold input
int val = 0;

void setup() {

while (!Serial);
Serial.println(“LoRa Receiver”);
if (!LoRa.begin(433E6)) { // or 915E6
Serial.println(“Starting LoRa failed!”);
while (1);

void loop() {

// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// read packet
while (LoRa.available())
int inChar =;
inString += (char)inChar;
val = inString.toInt();
inString = “”;

analogWrite(LED, val);

After the code has been uploaded, you may begin testing by spinning the potentiometer knob and checking the LED’s brightness. You can also use serial monitor to check the value.

ConclusionI hope all of you understand how to Interface SX1278 (Ra-02) LORA Module with Arduino. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.