LoRa, AtomVM, and Meshtastic experiments

This page collects notes and resources around my experiments with LoRa, AtomVM, and Meshtastic.

Starting with LoRa and AtomVM

A good entry point is this SX126x LoRa driver:

This is a fairly tested Erlang driver for Semtech SX126x LoRa chipsets that works with AtomVM. It provides LoRa communication from Erlang code running directly on microcontrollers such as the ESP32.

The driver is useful if you want to experiment with LoRa at a low level, without immediately depending on LoRaWAN or a higher-level mesh protocol.

Related reading:

Meshtastic experiments

I also implemented part of the Meshtastic protocol from scratch in Erlang.

Meshtastic is an open source, off-grid mesh communication system that uses inexpensive LoRa radios to exchange messages without relying on internet or cellular infrastructure.

My Erlang implementation runs on AtomVM and is used in the pocketOS project.

Source code

  • meshtastic.erl Packet parsing, serialization, channel hash calculation, and AES-CTR encryption/decryption helpers.

  • meshtastic_server.erl A small server process that handles incoming Meshtastic packets, duplicate detection, rebroadcasting, node identity, and outgoing messages.

  • meshtastic_proto.erl Minimal protobuf encoding/decoding support for selected Meshtastic payloads such as text messages, position, node info, and telemetry.

Useful upstream Meshtastic references:

pocketOS

These experiments are part of pocketOS, an Elixir firmware/application for ESP32-based handheld devices running on AtomVM.

pocketOS turns small handheld boards into hackable cyberdecks with a BEAM-based software stack. Among other things, it includes:

  • a native Elixir UI,
  • an interactive Lisp environment,
  • GPS and mapping experiments,
  • LoRa communication,
  • and a Meshtastic-compatible messaging layer.

The Meshtastic implementation above is used by pocketOS to send messages over LoRa without depending on existing infrastructure.

Hardware

The experiments target ESP32-based handheld devices with LoRa radios, especially:

  • LILYGO T-Deck A compact ESP32-S3 handheld with screen, keyboard, trackball, and LoRa variants.

  • LILYGO T-Lora Pager A pager-style ESP32-S3 handheld with keyboard, display, foldable antenna, and LoRa variants.

Meshtastic also has device-specific pages for these boards:

Main project:

LoRa and Meshtastic-related files: