Skip to content

LoRa ยท ESP32 guide

Interfacing RFM95W LoRa Radio Module with ESP32

Long-range, low-power LoRa transceiver for IoT sensor networks.

Updated November 16, 2026 Arduino C++RadioHead

What is the RFM95W?

The RFM95W is a small surface-mount radio module from HopeRF that wraps the Semtech SX1276 transceiver, its crystal, matching network and RF switch on a 16 pin castellated board. It speaks LoRa, a chirp spread spectrum modulation that trades data rate for sensitivity, and it also supports plain FSK and OOK. With LoRa you can send a few bytes of sensor data over several kilometres in open country on a few milliamps of average current, which is why it turns up in farm monitors, weather stations, trackers and community mesh networks. It is a bare radio: there is no antenna, no level conversion and no protocol stack on the module, so the wiring and the settings you choose matter a great deal.

Specifications

Radio chip
Semtech SX1276
Modulation
LoRa, FSK, GFSK, MSK, OOK
Frequency
868 MHz or 915 MHz variants; the sister parts RFM96W and RFM98W cover 433 MHz
Supply voltage
1.8 V to 3.7 V, normally powered at 3.3 V
Maximum output power
+20 dBm through the PA_BOOST pin, about +14 dBm through RFO
Receiver sensitivity
down to about -148 dBm in LoRa at low data rates
LoRa data rate
roughly 0.02 kbit/s to 37.5 kbit/s depending on spreading factor and bandwidth
Spreading factors
SF6 to SF12
Bandwidths
7.8 kHz to 500 kHz
Receive current
about 10 to 12 mA
Transmit current
about 120 mA at +20 dBm, less at lower power
Sleep current
well under 1 uA
Host interface
SPI, up to 10 MHz, plus interrupt pins DIO0 to DIO5
Pin pitch
2 mm, so a breadboard needs a breakout board

Typical values from the HopeRF RFM95W and Semtech SX1276 datasheets. Exact numbers differ slightly between the 868 MHz and 915 MHz versions and between datasheet revisions.

What LoRa actually does

Conventional radios detect a signal by looking for power above the noise. LoRa instead sends a chirp, a tone whose frequency sweeps across the channel, and the receiver correlates against the same chirp. That lets it pull a signal out from beneath the noise floor, down to roughly 20 dB below it. The data is carried by shifting where in time the sweep starts.

Two settings decide the trade between range and speed. The spreading factor (SF) sets how many chirp steps encode each symbol. A higher SF means each symbol lasts longer, more sensitivity and range, and much lower throughput: each step up roughly halves the data rate and doubles the time on air. The bandwidth is the width of the sweep. A narrower channel improves sensitivity but also slows the link. Doubling the airtime also doubles the energy spent per message, so a sensor node should use the lowest spreading factor that still reaches the gateway.

The coding rate adds forward error correction at a cost of 25 to 100 percent more bits. Transmitter and receiver must agree on frequency, SF, bandwidth, coding rate and sync word, or they will never hear each other.

Spreading factor and range trade-off

Spreading factorApproximate bit rateTypical use
SF7about 5.5 kbit/sShort range, frequent updates, lowest energy per message
SF9about 1.8 kbit/sA balance for suburban links
SF10about 1 kbit/sLonger links through buildings or trees
SF12about 250 bit/sMaximum range, long airtime, rare messages only

Approximate figures for 125 kHz bandwidth and coding rate 4/5. Values are rounded; real airtime depends on payload length and header settings.

Pinout

PinNameConnect to
1, 8, 10GNDGround
2MISOSPI MISO of the microcontroller
3MOSISPI MOSI of the microcontroller
4SCKSPI clock
5NSSChip select, any GPIO, active low
6RESETAny GPIO; the chip resets when pulled low briefly
14DIO0Interrupt pin: signals TX done and RX done
15, 16, 11, 12, 7DIO1, DIO2, DIO3, DIO4, DIO5Optional; used for timeouts, channel detection and frequency hopping
9ANTAntenna or coaxial feed, tuned to the band
133.3 VRegulated 3.3 V supply

Module pin order as given in the HopeRF datasheet. Most hobby breakout boards rename and reorder these, so follow the silkscreen on your board, not this order.

Danger

Never transmit without an antenna connected. The power amplifier has nowhere to send its energy and can be damaged. Use an antenna cut for your own band, and check that the band matches your region before you transmit.

Warning

The module is a 3.3 V device and its pins are not 5 V tolerant. On a 5 V Arduino, use a level shifter on MOSI, SCK, NSS and RESET, and feed MISO back through a divider or shifter. An ESP32 works directly.

Wiring and power

  • ESP32 wiring used on this site. 3.3 V to 3.3 V, GND to GND, MOSI to GPIO23, MISO to GPIO19, SCK to GPIO18, NSS to GPIO5, RESET to GPIO14 and DIO0 to GPIO26. The first four are the default VSPI pins; NSS, RESET and DIO0 can be moved to other GPIOs if you change them in code.
  • Interrupt pin. DIO0 is what RadioHead uses to learn that a packet was sent or received, so it must be wired to a pin that supports interrupts. Without it, the library either hangs or never reports a packet.
  • Supply quality. A transmit burst draws over 100 mA in a few microseconds. Put a 10 uF capacitor near the module and keep the supply wires short. A weak regulator or a long thin USB lead causes brownouts and resets during transmission, and that is one of the most common causes of mysterious crashes.
  • Antenna. At 868 MHz a quarter-wave wire is about 8.2 cm long and at 915 MHz about 7.8 cm. A straight piece of solid copper wire soldered to the ANT pad is a good start. A proper whip or helical antenna with the correct connector beats a loose wire.
  • Breakout. The 2 mm pitch of the module means most people buy a breakout board with a 2.54 mm header and a wire or SMA footprint. Some of these boards are mislabelled between the 868 and 915 variants, so read the marking on the module can.

Choosing the right frequency and obeying the rules

The radio hardware tunes anywhere in the band for which the module is built, but the law decides what you are allowed to use. The common licence-free bands are 863 to 870 MHz in Europe, 902 to 928 MHz in North America and parts of the Americas, and 865 to 867 MHz in India. Check your own national rules for allowed power, duty cycle and channel plan. European sub-bands, for instance, usually limit a transmitter to about one percent duty cycle, which at SF12 means very few messages per hour.

Two more points matter in the field. First, the module is sold in different variants, so a part marked for 868 MHz is not designed for 915 MHz even though the chip can be programmed to it, because the matching network is optimised for one band. Second, the setFrequency call in your code must match the same band on both ends. When one side is on 433 and the other on 868, nothing is received and no error is raised.

Libraries and a first test

Three libraries are in wide use. RadioHead provides the RH_RF95 driver and a simple addressed messaging layer with acknowledgements. It needs the DIO0 interrupt and is what the example wiring on this site is built for. LoRa by Sandeep Mistry is a minimal sketch-friendly library with begin, beginPacket and parsePacket calls. RadioLib supports many radios including the SX1276 and offers more advanced features such as LoRaWAN-style modes and FSK.

For a first test, load a transmit sketch on one board and a receive sketch on another, both with the same frequency and default modem settings. RadioHead's default configuration is 125 kHz bandwidth, coding rate 4/5 and spreading factor 7. Open the serial monitor on the receiver; the library can also report RSSI and signal-to-noise ratio, which are valuable when you test range.

To reach a LoRaWAN network such as The Things Network you need a different stack, because LoRaWAN adds addressing, encryption and a gateway. The RFM95W hardware supports it, but the plain RadioHead example is point-to-point LoRa, not LoRaWAN.

Troubleshooting

  • init() fails or returns false

    Likely cause
    SPI wiring wrong, no 3.3 V, or NSS or RESET on the wrong pin
    What to try
    Re-check each pin against code, read the version register (0x12 on the SX1276) and expect 0x12
  • Transmitter works but receiver gets nothing

    Likely cause
    Mismatched frequency, SF, bandwidth or sync word
    What to try
    Make the settings identical on both ends; start from library defaults
  • Board resets when sending

    Likely cause
    Supply brownout on the transmit burst
    What to try
    Add a 10 uF capacitor, use a better regulator, lower the transmit power
  • Range is only a few metres

    Likely cause
    No antenna, wrong antenna or wrong band
    What to try
    Attach a quarter-wave wire cut for your band, raise the antenna and keep it clear of metal
  • Packets arrive only sometimes

    Likely cause
    Interference, poor SNR or a missing DIO0 connection
    What to try
    Check RSSI and SNR, try SF9 or higher, confirm DIO0 reaches an interrupt-capable pin
  • Module gets hot or damaged

    Likely cause
    Transmitting without an antenna or at too much power
    What to try
    Always fit the antenna first, lower the power setting to what the link needs
  • Works on the bench, fails outdoors

    Likely cause
    Antenna placement and ground plane
    What to try
    Keep the antenna vertical and in the open, away from the board and any metal enclosure

Most RFM95W problems are power, wiring, band or antenna problems rather than faulty modules.

RFM95W or another radio?

  • RFM96W and RFM98W. The same family at 433 MHz. Use these where 433 MHz is the legal band, and note that the antenna is longer, about 17 cm for a quarter wave.
  • Ra-02 (SX1278). A cheaper module widely sold for 433 MHz, with a comparable pin layout. Good for experiments, with less documentation behind it.
  • nRF24L01+. A 2.4 GHz radio with far higher data rates but a range of tens of metres. It cannot compete on distance.
  • ESP-NOW or Wi-Fi. Faster and with no extra hardware on an ESP32, but the range is hundreds of metres at best.
  • Ready-made LoRa boards. Boards such as TTGO or Heltec combine an ESP32 and an SX127x with an antenna connector, which skips most of the wiring pain.

Project ideas

  • A soil moisture or water tank level node that wakes every few minutes, transmits one packet and sleeps.
  • A farm or garden gateway that collects readings from several remote nodes and publishes them over Wi-Fi.
  • A GPS tracker for a bicycle or a pet that reports its position over a long link.
  • A two-way text messenger between two handsets for hiking trips outside mobile coverage.
  • A range-testing tool that logs RSSI and SNR against distance to map your own coverage.

Ready to build? Pick your board for wiring and a working sketch:

  • RFM95W with ESP32 - 3.3 V wiring on the VSPI pins with DIO0 on GPIO26 and a RadioHead sketch

Frequently asked questions

How far can an RFM95W reach? In open terrain with good antennas and a high spreading factor, links of several kilometres are routine, and tens of kilometres are possible with line of sight. In a town with buildings in the way, hundreds of metres to a couple of kilometres is more realistic.

Can I power it from 5 V? No. The module must be fed 3.3 V and its logic pins are not 5 V tolerant.

Is the RFM95W LoRaWAN compatible? The hardware is. LoRaWAN needs a gateway and a software stack, and the RadioHead sketch is not LoRaWAN.

Do I need a licence? Usually not on the licence-free ISM bands, as long as you stay within the power, duty cycle and channel rules of your country.

Which pin is DIO0 for? It flags packet events to the microcontroller. RadioHead requires it. Without the connection, the driver cannot tell when a message has been sent or received.

Why do two modules not hear each other at 915 and 868 MHz? Because they are on different channels. Match the frequency exactly on both ends.

References

  • Semtech SX1276/77/78/79 datasheet, for registers, modulation settings and electrical limits
  • HopeRF RFM95W datasheet, for the module pin list and RF matching
  • RadioHead library, the RH_RF95 driver and messaging classes
  • Arduino LoRa library by Sandeep Mistry
  • RadioLib, a universal wireless library covering the SX127x

Wiring & code

Setting up RFM95W with ESP32

Library

RadioHead by Mike McCauley

Arduino IDE โ†’ Tools โ†’ Manage Libraries โ†’ search "RadioHead"

Wiring

Component pinESP32 pinNote
3.3V3.3V3.3V only -- this module is not 5V tolerant
GNDGND
MOSIGPIO23 (VSPI MOSI)
MISOGPIO19 (VSPI MISO)
SCKGPIO18 (VSPI SCK)
NSS (CS)GPIO5
RESETGPIO14
DIO0GPIO26Required by RadioHead for TX/RX interrupt signaling
ANTAntenna tuned to your module's bandNever power up without an antenna attached -- it can damage the PA
sketch.ino
#include <SPI.h>
#include <RH_RF95.h>

#define RFM95_CS   5
#define RFM95_RST  14
#define RFM95_INT  26

RH_RF95 rf95(RFM95_CS, RFM95_INT);

void setup() {
  Serial.begin(115200);
  pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);

  if (!rf95.init()) {
    Serial.println("RFM95 init failed");
    while (1);
  }
  rf95.setFrequency(915.0); // match your module/region: 433, 868, or 915 MHz
  rf95.setTxPower(13, false);
}

void loop() {
  const char msg[] = "Hello from ESP32";
  rf95.send((uint8_t *)msg, sizeof(msg));
  rf95.waitPacketSent();
  delay(2000);
}

Set setFrequency() to match your module's specific band (433/868/915MHz) and local radio regulations -- transmitting on the wrong band is both illegal and won't be heard by a receiver expecting a different frequency.

Keep learning

Related guides & projects