← Build · guide

The gateway

a Pi you supply + a ~$25 radio · pairs with your leaf

A leaf on its own is just a sensor. A gateway is what turns it into a network. The gateway is a Pi you supply plus the same LoRa radio the leaf uses. It listens for encrypted readings over LoRa and forwards them to your destination over WiFi, behind a host allowlist and a per-sensor rate limit. It also announces itself so leaves can find it. This guide builds one and pairs it with the bench leaf, all on your bench.

Parts

Raspberry Pi 4 (2 GB+), or a spare Pi you already have~$45the gateway's computer, operator-supplied
32 GB high-endurance microSD + USB-C 5 V/3 A supply~$22Pi OS Lite 64-bit
LILYGO TTGO LoRa32 v2.1 + 915 MHz antenna$25the radio, same as the leaf, never power it without the antenna
SMA male → SMA female bulkhead cable (RG316, ~20 cm)$8panel-mounts the antenna
Plastic project boxon handit all goes in here
Total~$100…or ~$33 + a spare Pi

The gateway runs on commodity Pi hardware you source yourself. A Pi 4 is what I test on, and a Pi Zero 2 W works too. It has no sensor. It's just a Pi, a radio, and WiFi.

Wiring

This is simpler than the leaf, since a Pi 4 has full-size USB and WiFi built in.

WiFi / Ethernet ──► the internet  (your destination)

Pi 4 [USB-A] ── TTGO LoRa32 → /dev/rnode ── 915 MHz antenna (bulkhead)

⚠ Never power the radio without its antenna attached. Transmitting into nothing can kill the TTGO.

Build + pair

  1. Set up the Pi

    Flash Pi OS Lite 64-bit, clone the repo, and run gateway/setup.sh. It installs the Python venv (RNS + requests), a udev rule that pins the TTGO as /dev/rnode, the app at /opt/mycelium-network-gateway/, and the policy config at /etc/mycelium-network-gateway/config.toml, then enables (but doesn't start) the rnsd and egress-gateway services. It's idempotent, so it's safe to re-run if anything drifts.

  2. Flash + plug the radio

    Flash a TTGO with RNode firmware (laptop-side), plug it into the Pi, and check that it shows up by running ls -la /dev/rnode. Antenna on first, always.

  3. Point it at your destination

    Edit /etc/mycelium-network-gateway/config.toml. Set the allowed_hosts the gateway may forward to (for example script.google.com for a Google Sheet via Apps Script), the per-identity max_requests_per_window rate limit, and announce_interval. The file is re-read live, so there's no restart and no dropped requests.

  4. Start it

    Run sudo systemctl start rnsd egress-gateway, then journalctl -u egress-gateway -f. The gateway announces itself on the network and waits. It also prints its identity hash, which is how a leaf finds and trusts it. Keep that hash handy for pairing.

Next, pair it with a leaf

The gateway is up and announcing, with its identity hash in the journal. Hand that hash to a leaf and the whole network starts working. A reading travels the entire path to your spreadsheet, and you can run the outage drill. Pair your nodes →

Troubleshooting

What this proves, and what it doesn't

It proves the gateway's forwarding policy (host allowlist, per-identity rate limit, size cap) and that it's up and announcing on the network. The full end-to-end delivery and the outage drill come when you pair a leaf to it.

It doesn't prove multi-hop relay across several nodes, real-world radio range, or power. Those come with more nodes and the field build, once they have survived real weather.