Go Long With LoRa Radio!

Computers & Mobile Maker News Technology
Go Long With LoRa Radio!
This article appears in Make: Vol. 76. Subscribe today for more great projects and tutorials.

LoRa is a long-range IoT protocol commonly used for industrial applications — and it’s the most common for makers too. It’s a free-to-use system that allows for small messages to be wirelessly transmitted over miles of distance under optimal conditions. LoRa is very good with sensor networks if these sensors do not transmit a lot of data. For example, it’s perfect for sending humidity data for plants, because the soil humidity usually does not change in seconds. Or for tracking animals’ positions on large farms and game reserves, because animals don’t move too fast. Or for monitoring parking lot occupancy where you don’t expect too many changes per day.

How LoRa works

LoRa is a low-power, wide-area network standard, also called LPWAN. This term consists of three parts and they’re all important.

1. Network

The difference between a typical small device and an Internet-of-Things (IoT) device is its ability to connect to the internet. And because we expect millions of them, we need a network to connect all of them. This network must be based on standards because different companies will build the network and the IoT devices. Best is always an international standard accepted by “everybody.”

2. Wide area

Our ESP8266 or ESP32 devices can connect to a Wi-Fi network, which is part of a LAN, or local area network. We all know that its reach is limited to a few meters around the access points. Wide area networks can bridge much bigger distances. This is necessary for IoT devices because we want to use them everywhere.
Old-timers can remember receiving AM radio in the middle of nowhere, far away from the station. This was really “wide area.” But the transmitters were usually huge and able to emit kilowatts of energy. It’s relatively easy to bridge long distances using high power. This brings us to the third term.

3. Low power

If we want devices to work on batteries, we don’t have a lot of power for transmission. And now we see the dilemma: We want miles of reach but we have no power to spend.

Fortunately, physics gives us a third parameter to ease this dilemma a bit: Bandwidth. Physical laws say that if we want to create a wireless connection across a certain distance, we can either increase transmission power or decrease the channel’s bandwidth.

But why should we bother with bandwidth? Because bandwidth and the maximum capacity of a channel are directly related: The smaller the bandwidth, the lower your channel’s capacity. I still remember the old days of Morse communication, where a good operator could transmit two characters per second, which is a little less than 20 bits/second. Today, our wireless LANs are capable of transferring millions of characters per second. And they are still always too slow.

Comparing wireless protocols

We can use the chart to visualize the relationship between capacity and range. On the x-axis, we have the range, and on the y-axis, the capacity. Let’s look at some of the well-known technologies and where they fit.

Wi-Fi has a high capacity but only a low reach. And we know from our ESP8266, it is quite power-hungry. Not in the kilowatts as the old radio stations, but it quickly needs a quarter of a watt during transmission.

Next is the mobile internet on our smartphones. The reach here is hundreds of feet up to a mile or so in rural areas. Capacity is relatively high. But also here, you don’t get fast 4G or 5G coverage if you’re in the middle of nowhere, because the next antenna tower is probably over a mile away. And we all know that our smartphones’ battery life is not great — this technology needs quite a bit of power.

Bluetooth, next, has less capacity than Wi-Fi. As we know from many gadgets, it runs well on small batteries. But, unfortunately, its reach is only a few meters. So, none of these technologies fulfill our IoT devices’ needs for low power and wide area.

Then we have LoRa. It has its own space: Long range, but, because of power limitations, also low bandwidth. And this bandwidth is limited not only by the law of physics, but also by human laws, as we will later see.
So, we now know where LoRa fits. It is not comparable with Wi-Fi and not at all a replacement for this technology. It is much closer to mobile internet standards, where low-power variants are also in development.

Competing technologies

Other new commercial networks provide long-range communication options for IoT. Sigfox offers broad geographical coverage and can be used for maker projects. LTE-based cellular networks like Cat-1, Cat-M, or NB-LTE are emerging, but the modules are expensive and not easy to use because of a lack of information. We hope to find more projects in the future to learn from.

These types of commercial networks, of course, require paid service contracts.

Link budgets

To better understand the “range” of a wireless connection, we have to deal with a relatively complex topic: The link budget. What is this, and why is it so important?

Like every other budget, the link budget is something you have initially and which you spend over time. If your budget is used up, you cannot spend more.

The link budget has to do with the link between the transmitter and the receiver. It is filled by the transmitter’s transmission power and the receiver’s sensitivity and is calculated in decibels or dB. The link budget is deducted by all sorts of obstacles between the transmitter and the receiver like cables, distance, walls, trees, etc. If the link budget is used up, the receiver will not produce any usable signal.

So, what is the link budget for LoRa compared with other technologies like LTE or 4G? LoRa has a link budget of 154dB, which is much higher than mobile internet’s 130dB, or Wi-Fi at around 100dB.

Let’s look at what this means by doing some calculations: First, assume we have a line-of-sight connection between the transmitter and the receiver. Our LTE budget of 130dB would be good to bridge around 80km. LoRa’s link budget of 154dB on the same frequency is good for 1,300km! You see, it matters a lot.

This is also theoretical. If we insert 5 meters of thin cable between our transmitter or receiver and antennas, we lose about 8dB. This reduces LoRa’s maximum distance to 500km. So, 10 meters of cable is equivalent to 800km in free air.

Next, we have to spend parts of our budget on obstacles like walls or trees between the transmitter and receiver. The thicker and the more conductive the obstacle, the more budget it eats. And sometimes we don’t have a line of sight, so we have to work with reflected signals, which reduce the link budget immensely.

LoRa achieves a link budget higher than LTE not because of technological breakthroughs, but simply because of its very narrow bandwidth and a low data rate. Its rated capacity ranges from 250 bit/s to 250 kb/s. That’s very low compared with the megabits of LTE.

Distance testing and results

While under optimal everyday conditions you might expect a LoRa range reaching 1 mile or more, I undertook an experiment to establish my longest successful transmission. By utilizing a high-altitude gateway in Weissenstein, Switzerland, and a comparable location in Germany, I was able to transmit a signal just over 200km (about 125 miles). You can see this in my video below.

YouTube player

Connecting to LoRaWAN

Now let’s talk about the network that’s needed between LoRa devices and our IoT applications. This is where LoRaWAN comes into play. It consists of distributed gateways connected to the internet and an infrastructure capable of relaying the IoT messages to our applications.

The chart above shows an overview of the whole infrastructure, with many devices or nodes connected to one gateway. Many gateways are connected to a broker network server infrastructure, and many applications are also connected to the same brokers.

Two network approaches exist — commercial and community-based. In many places, telecom companies have started to deploy private LoRa networks. As with cellular phones, you can buy a contract and use this infrastructure. You just have to connect your LoRaWAN-enabled nodes to the network. Such networks exist in the Netherlands and Switzerland, for example.

The community approach is led by The Things Network (TTN). This Dutch group built an infrastructure to transfer the messages between the gateways and the applications. As a startup, they needed gateways all over the world but they had no money to invest, so they asked people like you and me to build such a gateway and deploy it. They provide a map of all available gateways, where you can check if one is close to you (see page 108). If so, you only have to switch your node on, and it is connected to the TTN network. Like a commercial service, but free of charge.

Frequency matters

LoRa networks work on particular ISM frequencies reserved for industrial, scientific, and medical usage. Please consult the specifications and laws for your country before you purchase an IoT device. LoRa usually runs on 868MHz in Europe, on 915MHz in the U.S., and 433MHz for certain Asian countries. You can learn more at lora-alliance.org/lorawan-for-developers.

All these frequencies have something in common: They are free bands, and you don’t need to apply for a license or pay a fee to use them. Very attractive! But this comes with a handicap: The allowed power is only 25mW in Europe and 1 watt in the U.S. Not a lot, if you consider that amateur radio operators are allowed to emit up to 1,500 watts, for example. But it’s perfect for battery operations.

Building your own devices

If there is no gateway where you are, or you don’t want to depend on somebody else’s, you can build your own. An easy version consists of a concentrator PCB and a Raspberry Pi. Because the concentrator has 8 channels, it can support up to 8 IoT devices in parallel. Not a lot if we think about the numbers of projected IoT devices. So, what to do?

If we agree that each device will only use its channel, let’s say, for 50% of the time, then one gateway could already support 16 devices. And if each device will only use the channel 1% of the time, a gateway could support 800 devices.

8 parallel channels = 8 devices
At 50% duty cycle = 16 devices
At 1% duty cycle = 800 devices

That is precisely the concept of LoRaWAN. And this concept is also in line with the law. European governments typically allow one node or gateway device to transmit only 1% of the time. This is known as a duty cycle of 1%.

Because of that, we have to divide the 250 bps transmission speed by 100. This results in the worst case of 2.5 bps — slower than Morse.

250 bits per second / 100 = 2.5 bps
Morse = 20 bps

Unfortunately, we’re not yet finished with reducing capacity: If two nodes transmit simultaneously on the same frequency, there is a collision, and the messages are lost. So if we deploy too many devices in one area — generally, over 1,000 nodes — the gateway capacity is reduced because of such collisions. (LoRa networks, mainly built for sensors, favor the direction from the sensor to the gateway. The traffic in the other direction is limited.)

A sensor node consists of at least three components: a sensor, a microprocessor, and a communication module.To build one, you can use your microprocessor of choice and connect it with a LoRa module.

I suggest using either a ready-made sensor node or a module from the company TTGO for your first experiments. Such a board has everything you need: an MCU, a LoRa module, an antenna, and a display. You only have to connect your sensor of choice and write a program, usually using the Arduino IDE.

You can even start without a sensor, by only transmitting a “Hello World” message to the TTN network. If your node can reach a gateway with its link budget!

LoRa standards

LoRa Alliance, which is supported by many big companies, develops the LoRa standards. This is very important for its future, as nodes manufactured by one supplier should always work with gateways made by another manufacturer.

Moving forward

LoRa fits nicely in the gap between Bluetooth for short distances and mobile internet for ubiquity. Because it uses ISM bands, it is license-free. Its unique properties are even used by satellites to offer truly global coverage (e.g., Lacuna), and by small cube satellites deployed by universities.

As LoRa’s link reliability is not as high as with other technologies, it is mainly used for sensor networks where the lack of one data point is not critical. If used with sensors where transmissions occur periodically every few minutes or even hours, the power consumption can be very low, and it can run on a set of batteries for a very long time (but not for years, as its marketing has tried to suggest). To make it work, you must acknowledge the different influences on its link budget. If done correctly, you can create sizable low-cost sensor networks.

To learn more about LoRa, please visit my Youtube channel, where I delve deeper into technologies and builds for this network. Good luck!

TTNmapper.org shows LoRa gateways worldwide. Contribute to the map with an easy LoRa GPS tracker build like this one.

LoRa-capable boards

LoRa microcontrollers have built-in radio chipsets to let you connect your DIY sensor build to a gateway without any additional hardware. Many of these providers also offer independent LoRa-capable shields, wings, and expansion boards to add to your existing microcontroller. Be sure to get the right frequency for your region!

  • Adafruit Feather LoRa Radio: M0 or 32u4, 900MHz or 433MHz
  • Arduino: MKR WAN 1300 and 1310
  • Grasshopper LoRa/LoRaWAN Development Board
  • Penguino Feather 4260
  • Pycom FiPy and LoPy4
  • SparkFun LoRa Gateway
  • SparkFun Pro RF LoRa
  • TTGO T-Beam

Premade sensor nodes

There are many commercial LoRa sensor nodes available. If you want to assemble a system without building your own components, you’ll likely find what you need already exists.

  • Temperature
  • Rainfall
  • Flood/water
  • Energy
  • Pressure
  • Air quality
  • Open/close
  • Humidity
  • Gas/energy metering
  • Street parking
  • Mouse/rat trap
  • Outdoor ultrasonic height measurement
  • GPS tracking

You can find a comprehensive list at thethingsnetwork.org/marketplace/products/devices

Discuss this article with the rest of the community on our Discord server!
Andreas Spiess

Andreas Spiess runs a large YouTube channel focused on the “Advanced Maker.” He has loved wireless technologies ever since he became a HAM radio operator in 1977 (HB9BLA).

View more articles by Andreas Spiess


Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).