Introduction

I’ve been itching to work on some hardware projects lately and kept seeing ESP32-related things pop up on Reddit. In particular, I was coming across a lot of LoRa projects, and then started down a rabbit hole.

LoRa

LoRa (from long range) is a proprietary radio technology that is owned by Semtech. It is designed for long-range (e.g., 10km), low-bandwidth (i.e., measured in Kbps), low-power communication, primarily for internet of things (IoT) networks.

LoRa defines the physical layer that controls how the radio signals are modulated. Specifically, LoRa uses chirp spread spectrum (CSS) to encode information. You can view more about LoRa and CSS in this video.

LoRa operates in a license-free, sub-gigahertz frequency band (i.e., under 1GHz or 1000MHz), but each frequency varies from region to region due to regulatory requirements. If you’re buying a LoRa device, make sure you pick one tuned to the correct frequency band for your region.

  • China - 470-510MHz and 779-787MHz
  • Europe - 863–870MHz (typically 868MHz)
  • India - 865–867 MHz (typically 865MHz)
  • Japan - 920-923MHz
  • USA - 902–928 MHz (typically 915MHz)
  • South America - 915–928 MHz (typically 915 or 923MHz)

Why LoRa?

LoRa tries to bridge the gap between current communication technologies, like WiFi, Bluetooth, and cellular (4G/5G).

lora vs other communication types

Image from The Things Network

LoRa is useful for long-range, low-bandwidth, low-power communication, which is perfect for IoT devices. Some examples include:

  • a water sensor in a well in a remote location
  • a factory with hundreds of smoke alarms that all need to communicate
  • a large nature preserve trying to track animal migration
  • a natural gas provider needing to monitor each customer’s meter for usage
  • a weather station that only occasionally needs to transmit information

LoRa and LoRaWAN

LoRaWAN builds on top of LoRa to define the communication protocol and system architecture.

It’s important to note that you can use LoRa without using LoRaWAN. Other LoRa-based networks (that are not LoRaWAN) include Helium, The Things Network, Disaster.radio, and Meshtastic.

Meshtastic

Meshtastic builds on LoRa (not LoraWAN) to produce a decentralized mesh network. Features include:

  • Text-based, encrypted communication
  • No phone required (e.g., you can use a computer with the right hardware), but there are iOS and Android applications
  • Decentralization
  • Great battery life
  • Optional GPS location sharing
  • Open-source software

Unlike the traditional cellular network, each end-user device (e.g., phone, laptop, etc…) connects to a LoRa radio running Meshtastic, and all LoRa radios running Meshtastic can mesh together. Messages are relayed through LoRa radios until they reach their destination.

meshtastic network

Devices

Meshtastic firmware is available for a handful of devices, but I was looking for:

  • 915MHz support (because I’m in the US)
  • WiFi and Bluetooth (this meant the microcontroller needed to be an ESP32 instead of the nRF52840, which lacks WiFi)
  • USB-C
  • display
  • GPS (optional)

I was also looking for the newer SX1262 chip instead of the older SX1276 (source here).

semtech chip comparison

This left me with the following options:

In the end, I purchased two of each of the following:

lora t3s3

Device flashing

First, I made sure the device was showing up. This showed that my device was using /dev/ttyACM0.

mkdir -p ~/Downloads/lora
cd ~/Downloads/lora
python3 -m venv venv
source venv/bin/activate
pip install esptool
esptool.py chip_id

I could not get the web-based installer to work, so I decided to flash with the command-line. 🤷‍♂️

I downloaded the latest beta firmware. At the time of this writing, this was v2.1.11.5ec624d.

wget https://github.com/meshtastic/firmware/releases/download/v2.1.11.5ec624d/firmware-2.1.11.5ec624d.zip
unzip firmware-2.1.11.5ec624d.zip

This is the command I used to flash. Don’t blindly copy/paste this, because the firmware is specific for the LILYGO® TTGO Lora T3S3-V1.0.

./device-install.sh -p /dev/ttyACM0 -f firmware-tlora-t3s3-v1-2.1.11.5ec624d.bin

After manually restarting the device, I was greeted by the Meshtastic logo. I repeated the flashing process for the other device.

meshtastic boot logo

Software setup

Meshtastic offers a variety of apps, including Apple and Android apps, as well as a Python app, and even a web client (either served directly from the device’s local web server, or from your browser via the Web Serial protocol).

I paired one device to the Android app and another to my browser via the Web Serial protocol.

meshtastic topology

Once paired and connected, I made sure to set the region to US, since I wanted to be on the 915MHz frequency. I didn’t change the pre-shared key, so both devices were able to see one another right away and communicate.

Here, you can see the messages on the web app.

web app

Here, you can see the messages on the Android app.

android app

To be clear, these devices are NOT communicating via text (SMS), but instead over LoRa, completely off-grid! 🤯

meshtastic devices

Conclusion

I’m still waiting on the 3D printed cases to arrive, but I’m going to try to head outside and do some range tests with these devices. Very cool!

-Logan