LoRa sends small packets over kilometres on very little power, which makes it the radio for farm sensors, water-tank level reports from a rooftop, or a gate alert far from the house. The Ra-02 module with the Semtech SX1278 chip is the common 433 MHz version in India.
It is more work on a 5 V Uno than on an ESP32, for two reasons. The chip is 3.3 V-only and not 5 V tolerant, so the four lines the Uno drives (NSS, SCK, MOSI, RST) go through a level shifter, while MISO and DIO0 come back directly. And it draws over 100 mA while transmitting, more than the Uno’s 3.3V pin should supply, so it gets its own small AMS1117 3.3 V regulator fed from the Uno’s 5V.
The sketch is one file for both ends. The sender transmits a numbered “Hello” every 5 seconds; the receiver prints each packet with its signal strength (RSSI) and SNR.
Wiring
| Arduino Uno R3 | SX1278 LoRa module (Ra-02, 433 MHz) | Wire | Notes |
|---|---|---|---|
| AMS1117 3.3 V module (input from the Uno 5V) · 3V3 | 3.3V | red | Up to about 120 mA while transmitting — more than the Uno’s 3.3V pin should give. Feed the AMS1117 from the Uno’s 5V and GND. |
| AMS1117 3.3 V module (input from the Uno 5V) · GND | GND | black | |
| GND | GND | black | Common ground with the Uno. |
| D10 | NSS | yellow | Via level shifter — Shifter LV = 3.3 V (from the AMS1117), HV = 5V, GND shared. |
| D13 | SCK | blue | Via level shifter |
| D11 | MOSI | green | Via level shifter |
| D12 | MISO | purple | 3.3 V output into the Uno — reads as HIGH, no shifter needed. |
| D9 | RST | orange | Via level shifter |
| D2 | DIO0 | cyan | Packet-done interrupt; D2 is INT0. 3.3 V output, direct. |
3.3 V only (1.8–3.7 V) part, 5 V board. The SX1278 is a 3.3 V part and its pins are not 5 V tolerant. ESP32 and Pico connect directly. With an Uno or Nano, level-shift NSS, SCK, MOSI and RST, and power the module from a 3.3 V regulator that can supply about 120 mA while transmitting.
Board quirks
- The SX1278 is 3.3 V-only and not 5 V tolerant. Unlike the nRF24L01, its inputs can be damaged by the Uno’s 5 V SPI signals, so NSS, SCK, MOSI and RST go through the level shifter.
- Never transmit without an antenna: the reflected power can destroy the RF stage. Solder or screw the antenna on first.
- Ra-02 modules have 1.27 mm pads, not breadboard pins. Use an adapter board or solder short wires.
- Ra-02 is a 433 MHz module. India’s LoRaWAN band is 865–867 MHz (SX1276/RFM95 modules). For point-to-point hobby links on 433 MHz, keep the power low and check the current WPC rules for low-power devices.
- The library and SPI fit easily on the Uno (this sketch uses about 4 KB of the 32 KB flash), so there’s room for a sensor on the sender.
Code
// SX1278 (Ra-02, 433 MHz) LoRa module on an Arduino Uno R3, Sandeep Mistry's LoRa library.
// The SX1278 is 3.3 V-only. 3.3V from an AMS1117 3.3 V regulator (fed from 5V), GND → GND.
// Through a level shifter: NSS → D10, SCK → D13, MOSI → D11, RST → D9.
// Direct (3.3 V outputs into the Uno): MISO → D12, DIO0 → D2.
// Upload with SENDER = true on one Uno and false on the other. Never power it without an antenna.
#include <SPI.h>
#include <LoRa.h>
const bool SENDER = true;
const long FREQ = 433E6;
void setup() {
Serial.begin(9600);
LoRa.setPins(10, 9, 2); // NSS, RST, DIO0
if (!LoRa.begin(FREQ)) {
Serial.println(F("LoRa init failed - check 3.3V, the level shifter and SPI wiring"));
for (;;) {}
}
LoRa.setTxPower(14); // dBm; keep within your local limits
LoRa.setSpreadingFactor(9); // higher = longer range, slower
LoRa.enableCrc();
Serial.println(SENDER ? F("LoRa sender ready") : F("LoRa receiver ready"));
}
void loop() {
if (SENDER) {
static unsigned int n = 0;
LoRa.beginPacket();
LoRa.print(F("Hello #"));
LoRa.print(n);
LoRa.endPacket(); // waits until sent (about 0.2 s at SF9)
Serial.print(F("Sent #"));
Serial.println(n++);
delay(5000);
} else {
int size = LoRa.parsePacket();
if (size) {
Serial.print(F("Received '"));
while (LoRa.available()) Serial.print((char)LoRa.read());
Serial.print(F("' RSSI "));
Serial.print(LoRa.packetRssi());
Serial.print(F(" dBm SNR "));
Serial.println(LoRa.packetSnr(), 1);
}
}
}// SX1278 (Ra-02, 433 MHz) LoRa module on an Arduino Uno R3, Sandeep Mistry's LoRa library.
// The SX1278 is 3.3 V-only. 3.3V from an AMS1117 3.3 V regulator (fed from 5V), GND → GND.
// Through a level shifter: NSS → D10, SCK → D13, MOSI → D11, RST → D9.
// Direct (3.3 V outputs into the Uno): MISO → D12, DIO0 → D2.
// Upload with SENDER = true on one Uno and false on the other. Never power it without an antenna.
#include <SPI.h>
#include <LoRa.h>
const bool SENDER = true;
const long FREQ = 433E6;
void setup() {
Serial.begin(9600);
LoRa.setPins(10, 9, 2); // NSS, RST, DIO0
if (!LoRa.begin(FREQ)) {
Serial.println(F("LoRa init failed - check 3.3V, the level shifter and SPI wiring"));
for (;;) {}
}
LoRa.setTxPower(14); // dBm; keep within your local limits
LoRa.setSpreadingFactor(9); // higher = longer range, slower
LoRa.enableCrc();
Serial.println(SENDER ? F("LoRa sender ready") : F("LoRa receiver ready"));
}
void loop() {
if (SENDER) {
static unsigned int n = 0;
LoRa.beginPacket();
LoRa.print(F("Hello #"));
LoRa.print(n);
LoRa.endPacket(); // waits until sent (about 0.2 s at SF9)
Serial.print(F("Sent #"));
Serial.println(n++);
delay(5000);
} else {
int size = LoRa.parsePacket();
if (size) {
Serial.print(F("Received '"));
while (LoRa.available()) Serial.print((char)LoRa.read());
Serial.print(F("' RSSI "));
Serial.print(LoRa.packetRssi());
Serial.print(F(" dBm SNR "));
Serial.println(LoRa.packetSnr(), 1);
}
}
}Library: LoRa (Sandeep Mistry) — compiled with LoRa 0.8.0.
Expected serial output
LoRa receiver ready
Received 'Hello #0' RSSI -47 dBm SNR 9.8
Received 'Hello #1' RSSI -48 dBm SNR 9.5LoRa receiver ready Received 'Hello #0' RSSI -47 dBm SNR 9.8 Received 'Hello #1' RSSI -48 dBm SNR 9.5
Common errors
“LoRa init failed”
The library reads a version register over SPI and got nothing. Check the shifter has LV and HV supplied, NSS is on D10, and the module has 3.3 V.
Sender works, receiver prints nothing
Frequency, spreading factor or CRC setting differ between the two sketches. Upload the same sketch to both, changing only SENDER.
Short range (a few metres)
No antenna or the wrong one (868 MHz antenna on a 433 MHz module), or a weak 3.3 V supply sagging during transmit.