Arduino LoRa Link: Build a 8 km Radio
In this article
This guide shows you how to build a long-range Arduino LoRa link that can send data over about 8 km in open areas. You'll set up two Arduino boards with LoRa modules, write a simple transmitter and receiver sketch, and test the link. No advanced RF knowledge is needed, but you should be comfortable with the Arduino IDE and basic wiring.
What You'll Need
- 2x Arduino boards (Uno, Nano, or similar)
- 2x LoRa modules (e.g., Ra-02, RFM95, or compatible 433/868/915 MHz module)
- 2x LoRa antenna (quarter-wave or half-wave for your frequency, with SMA/u.FL connector)
- Breadboards and jumper wires
- 2x USB cables and a computer
- Arduino IDE installed
- Optional: 3.3V regulator if your module needs more current than the Arduino's 3.3V pin provides
Step-by-Step
- Choose your frequency and check local regulations. LoRa modules come in 433 MHz, 868 MHz (Europe), and 915 MHz (Americas). Use the one that matches your region to avoid illegal transmissions. For 8 km, lower frequencies like 433 MHz generally travel farther, but 868/915 MHz work well too.
- Install the RadioHead library. In the Arduino IDE, go to Sketch → Include Library → Manage Libraries, search for “RadioHead” by Mike McCauley, and install it. This library handles LoRa packet formatting and is easier than raw register access.
- Wire the LoRa module to the Arduino. Most LoRa modules use SPI. Connect: NSS (CS) to digital pin 10 (or any pin you define), SCK to 13, MOSI to 11, MISO to 12, RST to 9, and DIO0 to 2. Power the module with 3.3V (not 5V) and ground. If your module has a 5V-tolerant pin, check the datasheet.
- Attach the antenna. Screw or solder the antenna to the module’s connector. The antenna must be tuned to your frequency. A quarter-wave antenna for 868 MHz is about 8.6 cm long; for 433 MHz it's about 16.4 cm. A proper antenna is critical for range.
- Upload the transmitter sketch. Open the RadioHead example “nrf24_man_in_the_middle” or better, use the “LoRa_Duplex” example. For a simple one-way link, use the “rf95_client” example (it works with LoRa modules). Modify the frequency in the sketch:
rf95.setFrequency(868.0)for 868 MHz. Change the message to something like “Hello from transmitter”. Upload to the first Arduino. - Upload the receiver sketch. Use the corresponding “rf95_server” example. Set the same frequency. The receiver will print received messages to the Serial Monitor. Upload to the second Arduino.
- Test the link close range. Power both boards, open the Serial Monitor on the receiver (115200 baud), and send a test message from the transmitter. You should see the message appear within a second. If not, check wiring and frequency.
- Increase power and optimize settings. In the sketches, set the transmit power to maximum:
rf95.setTxPower(23, false)for 23 dBm (if your module supports it). Also set the bandwidth to 125 kHz, spreading factor to 12, and coding rate to 4/8 for maximum range. These are set viarf95.setModemConfig(RH_RF95::Bw125Cr48Sf12). - Place the antennas high and in line of sight. For 8 km, you need a clear line of sight. Mount the antennas on poles or a rooftop. Avoid placing them near metal objects or the ground. The higher the better—a few meters elevation can make a huge difference.
- Test at increasing distances. Start at 1 km, then 2 km, and so on. Use a phone to communicate between the two ends. If the link fails, try adjusting antenna orientation and height.
Common Mistakes
- Using 5V on the LoRa module. Many modules are not 5V tolerant and will be damaged. Always use 3.3V.
- Wrong frequency setting. If the transmitter and receiver are on different frequencies, they won't communicate. Double-check the
setFrequencycall. - Missing or poorly attached antenna. Running a LoRa module without an antenna can damage it and drastically reduces range.
- Using default settings. The default modem config is not optimized for range. Use the slowest data rate (Bw125Cr48Sf12) for maximum sensitivity.
- Power supply issues. LoRa modules can draw up to 120 mA during transmission. If the Arduino’s 3.3V regulator can’t supply that, use a separate 3.3V regulator or a LiPo battery.
Tips
- Use a directional antenna at one end. A Yagi or patch antenna can boost range significantly, but you must point it at the other station.
- Keep the data rate low. A lower data rate (spreading factor 12) increases sensitivity and range, but reduces throughput. For sensor data, that's usually fine.
- Add error correction. The RadioHead library includes CRC by default. You can also implement retransmission for reliability.
- Use a battery pack. For field tests, a 3.7V LiPo battery with a boost converter to 5V (for Arduino) or direct 3.3V (if your Arduino runs at 3.3V) is convenient.
- Monitor RSSI. The receiver can print the signal strength (RSSI) for each packet. This helps you adjust antenna position.
Troubleshooting
- No communication at all. Check wiring, especially NSS and DIO0. Ensure both boards have the same frequency and modem config. Try a different SPI pin if needed.
- Intermittent connection. Move antennas away from metal objects. Check for loose connections. Ensure the power supply is stable.
- Range is short (less than 1 km). You are likely using default settings. Change to Bw125Cr48Sf12. Also, make sure the antennas are properly tuned and placed high.
- Serial Monitor shows garbage. Check baud rate (should be 115200) and that you are using the correct serial port. Also, ensure the receiver sketch is actually printing the message, not just raw bytes.
- Module gets hot. This usually indicates a wiring error, especially power/ground reversed. Disconnect immediately and re-check.
Frequently Asked Questions
What is the actual maximum range?
In ideal line-of-sight conditions, LoRa can go 15 km or more. 8 km is achievable with good antennas and settings. In urban or forested areas, range drops significantly.
Do I need a license to operate LoRa?
In most countries, LoRa operates in the ISM band (433, 868, 915 MHz) which is license-free for low-power devices. However, you must comply with local power and duty cycle regulations. Check your national spectrum authority.
Can I use two different Arduino boards?
Yes, any Arduino that works at 3.3V or has 5V-tolerant SPI pins will work. The RadioHead library supports many boards.
How fast can I send data?
At the maximum range settings (SF12, 125 kHz), the data rate is about 0.3 kbps. That's enough for sensor readings, but not for audio or images. For higher throughput, you can reduce the spreading factor, but range will decrease.
What is the power consumption?
During transmission, the module draws around 120 mA at 3.3V. In sleep mode, it can be as low as 1 µA. For battery operation, use the sleep functions in the library.
Can I use a Raspberry Pi instead of an Arduino?
Yes, you can connect a LoRa module to a Pi via SPI, but the software is more complex. The Arduino is simpler for a dedicated link.