RC RANDOM CHAOS

Building a cloudless, globally-reachable smart fan on an ESP32 with iroh

· via Hacker News

Original source

An iroh powered smart fan

Hacker News →

A walkthrough shows how to turn a cheap ESP32 microcontroller into an internet-controllable smart fan without any cloud backend. Using iroh, a Rust peer-to-peer networking stack, the device reads a temperature sensor and drives a fan while remaining reachable from anywhere in the world through a browser that supports WebAssembly. The demo builds on existing ESP32 echo examples and targets a WROVER devkit with 4 MiB of PSRAM, which provides enough memory for iroh’s full networking capabilities, including relay connections; boards without PSRAM can still work by disabling the relay and tuning QUIC buffers.

The key design decisions center on stable, self-contained operation. The ESP32 generates a secret key on first boot and stores it in non-volatile memory, so the device keeps the same endpoint ID across reboots and reflashes rather than generating a random identity each time. At startup it connects to WiFi, binds an iroh endpoint, and uses QAD probes against iroh relays to find its closest home relay. It advertises both a long ticket (containing the local IP, for LAN-only access) and a short ticket (just the endpoint ID, for global reachability once the home relay is published). Because the endpoint is a standalone embedded process, it keeps running on any USB power source independent of the flashing host.

The practical takeaway is that iroh brings direct, relay-assisted P2P connectivity to constrained hardware, letting hobbyists build IoT devices that are remotely controllable without renting cloud infrastructure or exposing devices through vendor platforms. The release binary lands at roughly 96% of the 4 MB flash budget, but the author notes that additional pure-Rust dependencies add little size, so the tight fit is not as fragile as it looks.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.