← Build · guide

The bench leaf

~$176 · an afternoon · no soldering

This guide builds the sensor node itself, the leaf. A Grove thermistor feeds a Mayfly logger, which feeds your Pi. The Pi encrypts each reading with AES-256-GCM and hands it to the LoRa radio to queue for delivery, and a status LED blinks the whole time. It runs on USB wall power, with no solar and no enclosure. A leaf on its own senses, encrypts, and queues readings. It starts actually delivering them to a spreadsheet you own once you add a gateway, so this guide just gets the leaf working and proving itself, with no gateway required.

Parts

Raspberry Pi Zero 2 W + 32 GB high-endurance microSD$32the node's computer
Official 5 V 2.5 A micro-USB supply$8into the PWR IN port
Micro-USB OTG adapter$3into the USB (data) port
2-port USB 2.0 hub$5bus-powered is fine on the 2.5 A supply
LILYGO TTGO LoRa32 v2.1 + 915 MHz antenna$25the radio, never power it without the antenna
SMA male → SMA female bulkhead cable (RG316, ~20 cm)$8panel-mounts the antenna
EnviroDIY Mayfly v1.1$80the sensor brain
USB-A → USB-C cable (short)$4hub → Mayfly: power + serial
Seeed Grove Temperature Sensor v1.2$7NTC thermistor, zero wiring
Grove cable$1usually ships with the sensor
LED + ~330 Ω resistor + breadboard + 2 jumpers$3status LED on GPIO 17
Plastic project boxon handit all goes in here
Total~$176

Wiring

The Pi Zero 2 W has two micro-USB ports and only one carries data:

5V 2.5A supply ──► [PWR IN]   (power pins only, no data)

[USB] ── OTG adapter ── 2-port hub ──┬── TTGO LoRa32  → /dev/rnode
                                     └── Mayfly v1.1  → /dev/mayfly

GPIO 17 ── 330 Ω ── LED ── GND       (breadboard)

Mayfly AA0/AA1 Grove socket ── Grove cable ── Grove temp sensor

⚠ Never power the radio without its antenna attached. Transmitting into nothing can kill the TTGO. If you mount the antenna on a bulkhead through the box wall, "attached" just becomes the box's resting state.

A note on connectors. LoRa boards normally use standard SMA (the board jack has a centre socket), not RP-SMA. RP-SMA looks identical in photos but won't mate. I checked in June 2026 that these boards are standard SMA, so order plain SMA.

Build steps

  1. Flash the Mayfly

    In the Arduino IDE, add the board package EnviroDIY ATmega BoardsEnviroDIY Mayfly 1284P and the Adafruit ADS1X15 library. Open the Grove-temp sketch, read its PORT CONFIG header, and upload. With the Grove sensor in the AA0/AA1 aux-analog socket (Grove power jumper at 3.3 V), the Serial Monitor at 115200 should show a $MYC,… line every 10 s and the green LED blinking once per line. The temp_c value should be close to whatever your thermostat says.

  2. Set up the Pi

    Flash Pi OS Lite 64-bit, clone the repo, run leaf/setup.sh, and do the key and config.toml steps it prints. One of those is setting sensor = "mayfly" in /etc/mycelium-network-leaf/config.toml. Leave gateway_identity_hash blank for now. You'll set it when you build and pair a gateway. Then reboot.

  3. Plug the chain together

    Wire it per the topology above, then check that both serial devices show up by running ls -la /dev/rnode /dev/mayfly. (udev pins each device by chip, so hub port order never matters.)

  4. Start and watch

    Run sudo systemctl start rnsd leaf-node, then journalctl -u leaf-node -f. With no gateway yet, you should see the leaf sampling real readings and queuing them, with lines like sampled: temp_c=21.340 (queue depth 1) and the queue depth climbing. The LED slow-blinks discovering while it listens for a gateway to announce itself. That is the leaf working on its own.

Prove it's real

Pinch the thermistor between two fingers for a minute. In the journal, the sampled temp_c should climb a few degrees. That is the whole sense-and-encrypt path measuring an actual thing. Those queued readings start landing in a spreadsheet you own once you add a gateway.

Troubleshooting

What this proves, and what it doesn't

It proves the full encrypted pipeline end to end, the sensor-protocol contract across two independent implementations, named multi-parameter readings, and the whole reliability stack running under a real sensor.

It doesn't prove the power architecture, weatherproofing, SDI-12, or a submersible water-temp probe. Those come with the field build and the sonde, once they have survived real weather.