LoRa: How to Send Data 5km with Arduino (No WiFi)

LoRa: How to Send Data 5km with Arduino (No WiFi)


📑Table of Contents
What You'll Need 4 items
NodeMCU ESP8266 (ESP-12E) Need 2 for sender and receiver
Buy
SX1278 LoRa Module (433MHz) Use 868/915MHz version for EU/USA
Buy
Antenna (17.3cm wire for 433MHz)
Buy
Jumper Wires
Buy

Affiliate links help support this site at no extra cost to you.

LoRa: How to Send Data 5km with Arduino (No WiFi)

We are spoiled by WiFi. High speed, video streaming, instant connection. But WiFi has a fatal flaw: Range. Walk 50 meters away from your router, and the signal dies. What if you want to monitor a water tank on a farm? A mailbox at the end of a long driveway? A weather station on a hill?

You don’t need speed (Video). You need Distance. Enter LoRa (Long Range). It can send small packets of data over 5 Kilometers (3 Miles) using a fraction of the power of WiFi. Today, we leave the house and conquer the outdoors.

Hero LoRa Landscape Range


The Physics: How is this Possible?

How can a tiny chips transmit 5km on a coin cell? The secret is Chirp Spread Spectrum (CSS).

1. The Cocktail Party Problem

Imagine you are at a loud party (Noise).

  • AM/FM Radio: You try to shout louder than the noise. (Requires High Power).
  • LoRa: You don’t shout. You whistle a specific rising tone (A Chirp).
    • Even if the whistle is quieter than the noise partition, the human ear (and the LoRa chip) can pick out the “Slope” of the rising tone.

2. Sensitivity (-148 dBm)

  • WiFi dies at -90 dBm.
  • Bluetooth dies at -80 dBm.
  • LoRa works down to -148 dBm. This allows LoRa signals to travel through walls, trees, and essentially “under” the noise floor.

Chirp Spread Spectrum Visual


Hardware: The SX1278 / SX1276 Module

We use the Semtech SX127x series chips.

  • SX1278: 433 MHz (Asia/Europe generic).
  • SX1276: 868/915 MHz (Europe/Americas).

CRITICAL WARNING: 3.3V Logic! Most LoRa modules are 3.3V Only. Connecting them directly to a 5V Arduino Uno will fry the SPI pins.

  • VCC: 3.3V (Do NOT use 5V).
  • MOSI/MISO/SCK/CS: Use a Level Shifter or a 3.3V Board (Arduino Pro Mini 3.3V or ESP8266).

Standard Pinout (SPI):

SX1278 PinArduino Uno/NanoESP8266 (NodeMCU)
VCC3.3V3.3V
GNDGNDGND
MISOD12D6 (MISO)
MOSID11 (Level Shift!)D7 (MOSI)
SCKD13 (Level Shift!)D5 (SCK)
NSS (CS)D10 (Level Shift!)D8 (CS)
DIO0D2D1

SX1278 Wiring Diagram


Project: The P2P Communicator (Sender & Receiver)

We will not use LoRaWAN (The Cloud Gateways) today. We will do raw Point-to-Point. Think of it like Walkie-Talkies.

Library: sandeepmistry/arduino-LoRa (Install via Library Manager).

Code 1: The Sender (Transmitter)

#include <SPI.h>
#include <LoRa.h>

// Define pins for ESP8266 (Change for Arduino)
#define ss 15  // D8
#define rst 16 // D0
#define dio0 5 // D1

int counter = 0;

void setup() {
  Serial.begin(115200);
  LoRa.setPins(ss, rst, dio0);
  
  // 433E6 for Asia, 866E6 for Europe, 915E6 for USA
  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  Serial.println("LoRa Sender Ready");
}

void loop() {
  Serial.print("Sending packet: ");
  Serial.println(counter);

  // Send Logic
  LoRa.beginPacket();
  LoRa.print("Hello LoRa ");
  LoRa.print(counter);
  LoRa.endPacket();

  counter++;
  delay(5000);
}

Code 2: The Receiver

#include <SPI.h>
#include <LoRa.h>

#define ss 15
#define rst 16
#define dio0 5

void setup() {
  Serial.begin(115200);
  LoRa.setPins(ss, rst, dio0);
  
  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

Point to Point Architecture


Antenna Theory: Size Matters

(Troubleshooting Range)

Your module likely came with a small coil spring antenna. It is… garbage. For 5km range, you need a proper Quarter Wave Monopole.

The Math: Wavelength = Speed of Light / Frequency Antenna Length = Wavelength / 4

  • 433 MHz: 300 / 433 = 0.69 meters. Antenna = 17.3 cm.
  • 868 MHz: 300 / 868 = 0.34 meters. Antenna = 8.6 cm.
  • 915 MHz: 300 / 915 = 0.32 meters. Antenna = 8.2 cm.

Pro Tip: Take a solid core wire, cut it to exactly 17.3cm (for 433MHz), and solder it to the ANT pin. This single change can double your range.

Antenna Tuning Guide


Understanding Signal Strength (RSSI & SNR)

When you receive a packet, you get two numbers:

  1. RSSI (Received Signal Strength Indicator):
    • -30 dBm: Perfect (Devices are close).
    • -120 dBm: Warning zone.
    • -140 dBm: Limit of reception.
  2. SNR (Signal-to-Noise Ratio):
    • Positive (+10dB): Signal is stronger than noise.
    • Negative (-20dB): Signal is weaker than noise (but LoRa can still decode it due to Chirp magic!).

RSSI Signal Strength Meter UI


Range Comparison: The Wireless Spectrum

Why not just use WiFi Extenders? Physics.

  • High Frequency (2.4GHz WiFi): High data rate, low penetration, short range. Absorbed by water (leaves).
  • Low Frequency (433MHz LoRa): Low data rate, high penetration, massive range.
ProtocolRangeSpeedPower
WiFi100m100 MbpsHigh (80mA)
Bluetooth10m2 MbpsLow (10mA)
LoRa5km - 15km0.3 KbpsVery Low (10mA transmit)

Note the speed: 0.3 Kbps. You cannot send pictures. Only text/numbers.

Frequency Spectrum Map


Project: The Mailbox Sensor (Faraday Cage Issue)

I built a sensor to tell me when the postman arrives. My mailbox is 300m away, at the bottom of a hill, made of Steel.

The Challenge: Steel blocks radio waves (Faraday Cage). The solution:

  1. Drill a hole: I drilled a 3mm hole in the back.
  2. External Antenna: I ran the wire antenna outside the metal box.
  3. Low Frequency: 433MHz bends around the hill (Diffraction) better than 2.4GHz.

Result: It works reliably at -115dBm. WiFi wouldn’t even detect the network name.

Mailbox Sensor Project Photo


Deep Dive: Spreading Factors (The Range Knob)

The LoRa.begin() function uses default settings. But you can tune the “Spreading Factor” (SF) to trade speed for range. Spreading Factor controls how “stretched” out the chirps are in time.

  • SF7 (Default): Shortest chirps. Fastest data rate (~5 kbps). Shortest Range.
  • SF12 (Max): Longest chirps. Slowest data rate (~0.01 kbps). Maximum Range.

The Trade-off: Increasing SF by 1 step roughly doubles the airtime (battery usage) and gives you ~2.5dB extra sensitivity.

// Tuning for Max Range (but very slow)
LoRa.setSpreadingFactor(12);
LoRa.setSignalBandwidth(125E3);
LoRa.setCodingRate4(5);

warning: If you set SF12, sending “Hello” might take 2 seconds!


LoRaWAN vs P2P: Which one to use?

We used P2P (Point-to-Point) today.

  • Topology: Device A talks to Device B directly.
  • Pros: Simple, Free, No Gateway needed.
  • Cons: If Device B is asleep, it misses the message. No internet integration built-in.

LoRaWAN (The Network Protocol)

  • Topology: Sensors -> Gateway -> The Things Network (Cloud) -> Your App.
  • Pros: Huge scale (thousands of sensors), encryption, internet ready.
  • Cons: Complex setup. You need a Gateway ($100 hardware).

Guideline:

  • Building a mailbox sensor? Use P2P.
  • Covering a whole city with air quality sensors? Use LoRaWAN.

LoRa vs WiFi Range Chart


Advanced: The LoRa Packet Structure

LoRa isn’t just streaming raw bytes. The Semtech chip wraps your data.

  1. Preamble: A series of chirps to wake up the receiver.
  2. Header: Length of payload, Coding Rate.
  3. Payload: Your data (“Hello”).
  4. CRC (Cyclic Redundancy Check): A math check to ensure the data is perfect. If the CRC fails, the chip discards the packet silently.

Code Optimization: Minimize your payload! Sending “Temperature: 24.5C” takes longer than just “24.5”. Longer airtime = More battery usage.

Packet Structure Diagram


Troubleshooting LoRa

  1. “CRC Error” / No Packets:
    • Check Frequency match (Sender 433 vs Receiver 868?).
    • Check Bandwidth/Spreading Factor settings (Must match on both sides).
  2. “Short Range”:
    • Check Antenna connection.
    • Check Power Supply (LoRa spikes current on Transmit). Add a capacitor.
  3. “It worked on desk but not outside”:
    • Line of Sight: Trees and Houses absorb signals. Raise the antenna higher.
    • ** Fresnel Zone:** The cigar-shaped area between antennas needs to be clear.

Glossary: LoRa Terms

  • Chirp: A signal that changes frequency over time.
  • Spreading Factor (SF): How “stretched” the chirp is. SF7 is fast/short range. SF12 is slow/long range.
  • Gateway: A device that listens to LoRa and uploads to the Internet (LoRaWAN).
  • Transceiver: A device that can both Transmit and Receive.
  • RSSI: Received Signal Strength Indicator (in dBm). Closer to 0 is better.
  • SNR: Signal to Noise Ratio. LoRa can work with negative SNR!
  • ISM Band: Industrial, Scientific, and Medical band (Free to use, e.g. 433MHz).
  • Node: An end-device (sensor) in a LoRa network.
  • ADR (Adaptive Data Rate): A LoRaWAN feature that automatically adjusts SF to save battery.

Conclusion

LoRa changes how you think about connectivity. You stop worrying about “Do I have WiFi bars here?” and start thinking in Kilometers. It is the backbone of Smart Agriculture and Smart Cities. Now, go build something that talks to the horizon.

Copyright © 2026 TechnoChips. Open Source Hardware (OSHW).

Comments