Part

LoRa module, SX1278 (Ra-02)

Put two down and they talk: LoRa.h or RadioLib, packets that take as long on the air as real ones, on a shared air line.

or see every part
  • 14 pins
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The LoRa module, SX1278 (Ra-02) in brief

What it is, and where it sits on the bench.

The Ai-Thinker Ra-02 is a Semtech SX1278 LoRa radio for 433 MHz on a shielded board; the SX1276 in the RFM95W has the same registers, so this part covers it too. Its pins are GND, 3.3V, RST, DIO0 to DIO5, NSS, SCK, MISO and MOSI, on 1.8 to 3.7 V, never 5 V. With LoRa.h’s defaults on an Uno, NSS goes to 10, RST to 9, DIO0 to 2 and SPI to 13, 11 and 12 and power from 3V3; on an ESP32, SCK, MISO and MOSI go to GPIO 18, 19 and 23 and LoRa.setPins() names the rest. Mokxi models the datasheet’s register file behind SPI, RegVersion reading 0x12, with its modes, FIFO, IRQ flags, DIO0 and DIO1. Every module’s extra ANT pin joins one shared air, so two modules hear each other with no wire, and packets take LoRa’s real time on air: about 60 ms for 20 bytes at SF7 and 125 kHz, over a second at SF12. A receiver takes only packets whose frequency, sync word, spreading factor and bandwidth match. The classic mistake is changing one on one side only. Distance, walls and fading are not modeled; RSSI always reads -45 dBm.

Family
Clocks and links
Pins
14
Pins

14 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
Role
What it does
GND
Input or output
Ground.
3.3V
Input or output
Supply, 1.8 to 3.7 V. Use the board's 3.3 V pin.
RST
Input
Reset, active low.
DIO0
Output
Packet received, packet sent or channel scan done, as the sketch maps it.
DIO1
Output
Receive timeout. DIO2 to DIO5 stay low.
DIO2
Output
DIO3
Output
DIO4
Output
DIO5
Output
NSS
Input
SPI chip select.
SCK
Input
SPI.
MISO
Output
SPI.
MOSI
Input
SPI.
ANT
Input or output
The air every LoRa module on the canvas shares. Leave it unwired.
How to use it

How to use the SX1278 Ra-02 LoRa module with an Arduino

The Ra-02 is a 3.3 V SPI radio. With LoRa.h’s default pins on an Uno, NSS goes to 10, RST to 9 and DIO0 to 2, SCK, MISO and MOSI to 13, 12 and 11, and the supply to the 3V3 pin, never 5V. This messenger wires two Unos that way, one module each, and no wire between the modules: every LoRa module on the canvas shares one air.

LoRa.begin(433E6) finds the chip, then beginPacket(), print() and endPacket() send, and parsePacket() and read() receive. The sender prints each packet’s time on air, a few tens of milliseconds at the default spreading factor of 7; call LoRa.setSpreadingFactor(12) in both sketches and it is close to a second. Change it, the frequency or the sync word on one side only and nothing arrives. On the bench, the Uno’s 5 V SPI lines want level shifting in front of a 3.3 V chip.

Part pin
Board pin
3.3V
3V3
GND
GND
NSS
Pin 10
RST
Pin 9
DIO0
Pin 2
SCK
Pin 13
MISO
Pin 12
MOSI
Pin 11

An ESP32 is 3.3 V throughout: put SCK, MISO and MOSI on GPIO 18, 19 and 23 and call LoRa.setPins() with your NSS, RST and DIO0 before LoRa.begin().

Arduino Uno: LoRa messengerlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
The sending end, from the LoRa messenger
if (!LoRa.begin(433E6)) {
  Serial.println("Starting LoRa failed!");
  while (1) {
  }
}
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
How it is modeled

What is true about the LoRa module, SX1278 (Ra-02), here

In its help article’s own words: what the simulation gets right, and where it stops.

Not modeled

The radio itself: distance, walls, fading and output power. packetRssi() and getRSSI() always report -45 dBm and packetSnr() 9.5 dB, a strong close signal, because there is no distance in the simulator. The coding rate is stored but does not change the time on air, and modules with different coding rates still hear each other. Invert IQ and implicit header mode are stored and not modeled. The FSK modem is not modeled: in FSK mode nothing is sent or heard. There is no LoRaWAN gateway or network server, so LMIC and The Things Network sketches have nobody to join.

From LoRa module, SX1278 (Ra-02), in full.

Projects

See the LoRa module, SX1278 (Ra-02) in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the LoRa module, SX1278 (Ra-02) in it.

Libraries

Arduino libraries for the LoRa module, SX1278 (Ra-02)

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the LoRa module, SX1278 (Ra-02)

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.