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

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

CONTENTS.log
📑 Table of Contents
Bill of Materials
QTY: 5
[1x]
NodeMCU (ESP8266)
SOURCE_LINK
[2x]
SX1278 LoRa Module (433MHz)
SOURCE_LINK
[10x]
Jumper Wires
SOURCE_LINK
[2x]
830-Point Breadboard
SOURCE_LINK
[2x]
Micro-USB Cable
SOURCE_LINK

* SYSTEM.NOTICE: Affiliate links support continued laboratory research.

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.

LoRa Long Range Signal Path

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: Shouting louder than the noise (High Power).
  • LoRa: Whistling a rising tone (Chirp) that the chip can pick out from the noise floor.

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).
  • Logic: Use Level Shifters when connecting to 5V Arduinos.

Standard Pinout (SPI):

SX1278 PinArduino UnoESP8266
VCC3.3V3.3V
GNDGNDGND
MISOD12D6
MOSID11 (Shift)D7
SCKD13 (Shift)D5
NSS (CS)D10 (Shift)D8
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=cfWavelength = \frac{c}{f} AntennaLength=Wavelength4Antenna Length = \frac{Wavelength}{4}

  • 433 MHz: 17.3 cm
  • 868 MHz: 8.6 cm
  • 915 MHz: 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:

  • RSSI (Received Signal Strength Indicator):

  • -30 dBm: Perfect (nearby).

  • -120 dBm: Warning zone (failing).

  • -148 dBm: Technical limit.

  • SNR (Signal-to-Noise Ratio):

  • Positive (+10dB): Signal > Noise.

  • Negative (-20dB): Signal < Noise (LoRa works here!).

RSSI Signal Strength Meter UI

Range Comparison: The Wireless Spectrum

Why not just use WiFi Extenders? Physics.

  • 2.4GHz WiFi: High speed, low penetration, short range.
  • 433MHz LoRa: Low speed, high penetration, extreme range.
ProtocolRangeSpeedPower
WiFi100m100 MbpsHigh (80mA)
Bluetooth10m2 MbpsLow (10mA)
LoRa5km+0.3 KbpsVery Low (10mA trans)

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:

  • Penetration: Drilled a hole for external antenna.
  • Diffraction: 433MHz bends around hills better than high frequencies.

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): Fastest data; shortest range.
  • SF12 (Max): Slowest data; 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: Peer-to-Peer.
  • Pros: simple, free, no gateway.
  • Cons: no built-in internet; misses messages if receiver sleeps.

LoRaWAN (The Network Protocol)

  • Topology: Sensors \rightarrow Gateway \rightarrow Cloud.
  • Pros: Scalable, encrypted, internet-ready.
  • Cons: Complex; requires expensive gateway hardware.

Guideline:

  • Mailbox Sensor? Use P2P.
  • City-wide Network? 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.

  • Preamble: Wake-up chirps.
  • Header: Payload info.
  • Payload: Your data.
  • CRC: Error checking.

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

  • “CRC Error” / No Packets:
    • CRC Error: Check frequency match and SF settings.
    • No Packets: Check antenna and power supply (spikes).
  • “Short Range”:
    • Check Antenna connection.
    • Check Power Supply (LoRa spikes current on Transmit). Add a capacitor.
  • “It worked on desk but not outside”:
    • Environment: Trees and houses absorb signals; raise antennas high.
    • Fresnel Zone: Ensure the path between antennas is clear.

Engineer’s Glossary (LoRa)

  • Chirp: Signal that changes frequency over time.
  • Spreading Factor (SF): Sweep duration vs range compromise.
  • Gateway: Internet-connected bridge.
  • Transceiver: Device that both talks and listens.
  • RSSI: Signal strength in dBm.
  • SNR: Signal-to-Noise Ratio.
  • ISM Band: License-free radio frequencies (433/868/915).
  • ADR: Adaptive data rate control.

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