Messaging off the grid with Meshtastic

Mesh Marvel

© Photo by Ricardo Gomez Angel on Unsplash

© Photo by Ricardo Gomez Angel on Unsplash

Article from Issue 299/2025
Author(s):

Want to communicate without relying on mobile networks? Meshtastic lets you create your own off-the-grid wireless mesh network with an inexpensive LoRa device and an Android phone.

In your daily life, you probably enjoy uninterrupted access to mobile networks, allowing you to place calls, send messages, and browse the web from your phone. We all tend to take this luxury for granted, but you will face times when this connectivity is unavailable. Perhaps you're embarking on a camping expedition in a remote area lacking mobile network coverage. Or you might be with your friends at a crowded festival where the mobile network becomes unreliable. In worst-case scenarios, you might find yourself in a disaster where the mobile network is completely down.

What if you could set up your own mobile network in such scenarios? It turns out you can. Meshtastic [1] lets you to establish your own local wireless mesh network using affordable, low-power devices. The mesh network allows you to stay connected with friends or family and send text messages to each other in areas without an existing or reliable communications infrastructure.

Meshtastic is not a complete replacement for a mobile network. You can't place phone calls or download massive amounts of data, and the range depends on your environment and the location of other devices in the mesh network. However, Meshtastic offers connectivity where other options fail. In most situations, the direct range is up to a few kilometers, but Meshtastic devices have the capability to relay messages from others, thereby extending the range. To better understand these bandwidth and range limitations, it is important to start with a look at the underlying technology.

Unlicensed Spectrum

A large portion of the radio spectrum is licensed by national regulators to specific users. The licensing system is why mobile operators or TV broadcasters have to pay hefty fees for the exclusive right to broadcast signals on certain frequencies. Likewise, this is why you need a ham radio license to transmit on specific frequencies.

In contrast, you can operate without a license on some frequency bands. However, because the devices on these free bands don't have exclusive rights, interference is much more likely. Therefore, these devices must comply with some regulations, including limits on the permitted transmit power and the duty cycle (the maximal ratio of transmission time to total time). Meshtastic relies on LoRa [2], a radio protocol developed by Semtech, operating in this unlicensed radio spectrum. Anyone can buy a LoRa chip and start using it (see the box entitled "Open Source on Proprietary Hardware").

Open Source on Proprietary Hardware

LoRa is a proprietary and patented technology, and Semtech is the only company in the world able to manufacture LoRa chips. However, all technology that the Meshtastic project has built on top of LoRa is open source. Moreover, the LoRa protocol has been reverse-engineered and implemented in a GNU Radio [3] module, gr-lora_sdr [4], which allows you to send and receive Meshtastic packets using software-defined radio (SDR) hardware. However, the SDR solution will always be inferior to Semtech's real radio hardware chips.

The frequency spectrum and associated restrictions for LoRa depend on your geographical region, following radio regulations from the International Telecommunication Union [5]. Within Europe, the most popular LoRa frequency band for Meshtastic is 868MHz, offering a maximum power of +27dBm with a 10 percent duty cycle. Alternatively, the 433MHz band is also used in Europe, allowing up to +12dBm with the same duty cycle. In North America, the 915MHz frequency band permits up to +30dBm without duty cycle restrictions. It's important to buy LoRa hardware compatible with your region's frequency band and configure the Meshtastic software correspondingly.

Range and Data Rate

LoRa, which stands for "Long Range," enables long-range transmissions with low power consumption at slow data rates. Depending on the settings, the data rate can range from a few hundred bits per second to tens of kilobits per second. Although this bandwidth might appear minimal, it is sufficient for sending text messages, location information, or sensor data to nearby users, which is precisely what Meshtastic does.

Several parameters directly influence the range and data rate of your LoRa transmissions. Range and data rate are inversely proportional. Increasing the data rate will reduce range. Conversely, if you change the settings to improve range, the data rate decreases.

Meshtastic uses three LoRa settings to change this range and data rate: the spreading factor, bandwidth, and coding rate. The spreading factor, a number ranging from 7 to 12, determines how much data is spread over time during transmission. Each step up in spreading factor doubles the air time to transmit. The higher the spreading factor, the longer the range, but the slower the data rate. Bandwidth represents how big of a slice of the radio spectrum is used. Each doubling of the bandwidth doubles the data rate but cuts the range by half. And coding rate determines how much redundancy is built into the transmissions to resist radio noise. Increasing the coding rate increases reliability but decreases the net data rate because of the overhead.

Which settings should you use? To prevent analysis paralysis, Meshtastic has defined eight LoRa radio presets, which have been proven to work well. You can find these presets in Table 1. The default preset is Long Range/Fast, or in short, Long Fast. This setting uses a bandwidth of 250kHz, a coding rate of 4/5 (1 bit overhead for every 4 bits), and a spreading factor of 11, leading to a data rate of 1.07kbps. This overall data rate includes protocol overhead, which means the effective net data transfer rate is even lower.

Table 1

LoRa Radio Presets in Meshtastic

Radio Preset

Short Name

Data Rate

Spreading Factor

Coding Rate

Bandwidth

Link Budget

Short Range/Turbo

Short Turbo

21.88kbps

7

4/5

500 kHz

140dB

Short Range/Fast

Short Fast

10.94kbps

7

4/5

250kHz

143dB

Short Range/Slow

Short Slow

6.25kbps

8

4/5

250kHz

145.5dB

Medium Range/Fast

Medium Fast

3.52kbps

9

4/5

250kHz

148dB

Medium Range/Slow

Medium Slow

1.95kbps

10

4/5

250kHz

150.5dB

Long Range/Fast

Long Fast

1.07kbps

11

4/5

250kHz

153dB

Long Range/Moderate

Long Moderate

0.34kbps

11

4/8

125kHz

156dB

Long Range/Slow

Long Slow

0.18 kbps

12

4/8

125kHz

158.5dB

Mesh Network

Meshtastic implements a mesh network architecture layered upon these direct point-to-point LoRa connections. Devices can send messages either directly or through intermediary devices that rebroadcast messages to further extend the network's reach. By default, Meshtastic devices send their messages with a maximum hop count of three. With each retransmission, this hop count is decreased by one. When a device receives a message with a hop count of zero, it will not rebroadcast it further.

However, if every device would rebroadcast all messages it receives, this would result in a broadcast storm, wasting bandwidth and energy, and ultimately diminishing the overall efficiency of the mesh network. For this reason, the Meshtastic protocol was carefully designed with various device roles you can choose depending on the use and location.

The default device role is Client, which works well in various circumstances. Upon receiving a message, a Client listens briefly to check if another device has already rebroadcast the message. If so, the device refrains from rebroadcasting it again. If not, it does rebroadcast it. This approach is called "managed flooding" and attempts to reduce the network load. There's also a Client Mute role. Client Mute devices don't rebroadcast messages from other devices. This role is useful if you have a couple of devices always in each other's vicinity. It doesn't make sense to have them all listen and rebroadcast; one of them suffices.

Another important role is Router: this device always rebroadcasts messages once. You might think that it makes sense to configure every device as a Router to improve coverage. However, it's not that simple. The presence of a Router in a suboptimal location could leave a Client in a more advantageous location ignoring messages due to previous rebroadcasts. So, adding a Router in that location could inadvertently reduce range. This phenomenon is called "eating a hop."

Most of us will never deploy a Meshtastic router, as they're only useful in exposed positions, such as on a mountain top, a radio tower, or a tall building that stretches at least 20 stories tall. In such strategic positions, they work extremely well, with the potential to expand your mesh network's range with tens or even hundreds of kilometers. However, a device on a typical house rooftop should remain configured as a Client: This will allow it to rebroadcast messages, but only if a better-placed Router has not yet done so.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • ChirpStack LoRaWAN

    ChirpStack's LoRaWAN implementation lets you set up long-range wireless traffic for sensors even if you are far from a WiFi access point.

  • Instrumented Garden

    Place long-range wireless sensors in a garden and keep track of ambient conditions with gauges and time-based graphs.

  • LoRa Long Range Radio

    WiFi is convenient for devices that are in the same house. If you want to extend the distance, give LoRa a call.

  • Mesh Networking

    Mesh networking comes to with the IEEE802.11s draft standard. We'll show you how to mix a mesh.

  • FreeRTOS

    Exploit the full power of your microcontroller with the FreeRTOS multitasking operating system.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News