Getting Started with LoRa

Hardware components:
R8326274 01
Raspberry Pi 2 Model B
× 1
× 1


Getting Started with LoRa


What is LoRa?

LoRa is a Long-Range radio technology developed by Semtech. Here is a definition from Semtech's LoRa FAQ:

“LoRa (Long Range) is a modulation technique that provides significantly longer range than competing technologies. The modulation is based on spread-spectrum techniques and a variation of chirp spread spectrum (CSS) with integrated forward error correction (FEC). LoRa significantly improves the receiver sensitivity and as with other spread‐spectrum modulation techniques, uses the entire channel bandwidth to broadcast a signal, making it robust to channel noise and insensitive to frequency offsets caused from the use of low cost crystals. LoRa can demodulate signals 19.5dB below the noise floor while most frequency shift keying systems (FSK) need a signal power of 8-10dB above the noise floor to demodulate properly. The LoRa modulation is the physical layer (PHY), which can be utilized with different protocols and in different network architecture – Mesh, Star, point to point, etcetera.”

What are the main parameters of LoRa radios?

Throughput and range depend on 3 main LoRa parameters: BW, CR and SF. BW is the physical bandwidth for RF modulation (e.g. 125kHz). Larger signal bandwidth allows for higher effective data rate, thus reducing transmission time at the expense of reduced sensitivity. CR, the coding rate for forward error detection and correction. Such coding incurs a transmission overhead and the lower the coding rate, the higher the coding rate overhead ratio, e.g. with coding_rate=4/(4+CR) the overhead ratio is 1.25 for CR=1 which is the minimum value. Finally SF, the spreading factor, which can be set from 6 to 12. The lower the SF, the higher the data rate transmission but the lower the immunity to interference thus the smaller is the range.

What is the typical range of LoRa radio technology?

Most of tests performed by Semtech and other companies show radio range of about 15-20kms in line-of-sight condition with BW=125kHz and SF=12. The range can be greatly increased if the antennas can be set up higher. Some High Altitude Ballooning experiences have reported range of several hundredths of kms. Under non line-of-sight condition such as in a dense urban area or indoor scenarios, the maximum range is about 2kms.

What is the usual LoRa topology?

With the longer range the usual LoRa topology is a star: end-devices (IoT device) will send data to a gateway which is usually assumed to have Internet connection to be able to push received data to Internet servers. Note that several gateways can be deployed to cover a larger area and it may happen that a message from an end device is received by several gateways. Filtering for duplicated messages can be realized at the Internet server level, or more generally at a layer above the gateway.

Schematics of Lora:

Schematics of Lora

What is LoRa/GPS HAT?

The Dragino Lora/GPS HAT is a expansion module for LoRaWan and GPS for use with the Raspberry Pi. This product is intended for those interested in developing LoRaWAN solutions.

The Lora/GPS HAT is based on the SX1276/SX1278 transceiver. The add on L80 GPS (Base on MTK MT3339) is designed for applications that use a GPS connected via the serial ports to the Raspberry Pi such as timing applications or general applications that require GPS information.

The transceivers of the Lora/GPS HAT feature the LoRa™ long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption. The Lora/GPD HAT can achieve a sensitivity of over -148dBm using a low cost crystal and bill of materials. The high sensitivity combined with the integrated +20 dBm power amplifier yields industry leading link budget making it optimal for any application requiring range or robustness. LoRa™ also provides significant advantages in both blocking and selectivity over conventional modulation techniques, solving the traditional design compromise between range, interference immunity and energy consumption.

This board can calculate and predict orbits automatically using the ephemeris data (up to 3 days) stored in internal flash memory, so the HAT can fix position quickly even at indoor signal levels with low power consumption. With AlwaysLocate™ technology, the Lora/GPS HAT can adaptively adjust the on/off time to achieve balance between positioning accuracy and power consumption according to the environmental and motion conditions. The GPS also supports automatic antenna switching function. It can achieve the switching between internal patch antenna and external active antenna. Moreover, it keeps positioning during the switching process.

What is the purpose of this project?

In this project we will learn, how sensors in different locations, data will be sent to the server/gateway via LoRa technology. In this example, a node (Sensor data collector) and a server/gateway used for save sensor data. The Node sends temperature to server/gateway. We have used both sides (Node and Server) of the Raspberry Pi.


  • Connect the Lora/GPS HAT to Raspberry Pi according to the table 2;
  • Use raspi-config to ensure that SPI can be used on RPi;
  • Use sudo apt-get install wiringpi to install the GPIO access library written in C for the BCM2835 used in the Raspberry Pi;
  • This example tested with Raspberry Pi 1 B, B+, 2 and 3.
  • Used operating system : Raspbian Jessie.

Note: This setting is same for the server/gateway and node.

The tutorial consisted of two parts :

1. Preparation Node

2. Preparation Server or Gateway

Part 1 : Preparation Node

1-Wire Digital Temperature Sensor

To measure the temperature, the DS18B20 used. In 1-Wire sensors, all data is sent down one wire, which makes it great for micro controllers such as the Raspberry Pi, as it only requires one GPIO pin for sensing. In addition to this, most 1-Wire sensors will come with a unique serial code (more on this later) which means you can connect multiple units up to one micro controller without them interfering with each other. The DS18B20+ has a similar layout to transistors called the TO-92 package, with three pins: GND, Data (DQ), and 3.3V power line (VDD). You’ll also need some jumper wires, a breadboard and a 4.7kΩ (or 10kΩ) resistor.

Read More: Getting Started with LoRa

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top