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.
- 14 pins
- In 1 project
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
14 pins
Named as the editor names them, so a wire lands where you expect it.
DIO2 to DIO5 stay low.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.
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().
if (!LoRa.begin(433E6)) {
Serial.println("Starting LoRa failed!");
while (1) {
}
}
LoRa.beginPacket();
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();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.
See the LoRa module, SX1278 (Ra-02) in a project
One built-in project uses it. It opens in the editor, already wired.
The boards it is shown on
This board has a built-in project with the LoRa module, SX1278 (Ra-02) in it.
The rest of the bench
Every one of these is drawn and simulated the same way.
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.