An iroh powered smart fan
This technical dive showcases how to build a 'smart fan' using an ESP32, Rust, and the iroh peer-to-peer networking library, eliminating traditional cloud dependencies. It's a masterclass in modern embedded development, leveraging WebAssembly for a browser-based GUI and demonstrating iroh's capability for resilient, globally accessible IoT. Hacker News readers appreciate the deep technical exploration, even while debating the practical necessity of such an elaborate setup for a simple fan.
The Lowdown
In a world where IoT often implies cloud lock-in, this article presents a refreshing alternative: an iroh-powered smart fan. Faced with a heatwave, the author details building a temperature-controlled fan using an ESP32 microcontroller, entirely without a centralized cloud component. The project meticulously walks through the hardware setup, software development using Rust and the iroh library, and culminates in a 3D-printed enclosure for the device.
- Cloudless IoT: The core innovation is the use of
iroh, a peer-to-peer networking library, which allows for remote control of the ESP32-based fan from anywhere in the world using stable endpoint IDs, bypassing traditional cloud services. - Rust on ESP32: The entire project, from device firmware to protocol definition (
irpc), is implemented in Rust, showcasing its capabilities for embedded systems and robust protocol design. - WebAssembly GUI: A browser-based graphical user interface, compiled from Rust to WebAssembly, provides a live temperature display and fan control, highlighting a modern approach to web interfaces for embedded devices.
- Hardware Integration: The guide includes practical steps for wiring a DHT22 temperature/humidity sensor and a PWM-controlled fan to the ESP32, with advice on power and troubleshooting.
- Protocol Evolution: The article touches upon safe protocol evolution using
irpcandpostcardfor backward compatibility, and introduces simple authentication for setting fan thresholds. - Physical Prototype: The project concludes with a custom 3D-printed enclosure, transforming the breadboard prototype into a functional, self-contained gadget.
This detailed guide serves not just as a how-to for a smart fan, but as a compelling demonstration of iroh's potential for creating autonomous, secure, and globally accessible IoT devices that put control back into the hands of the user.
The Gossip
Complexity vs. Commodity
Many commenters questioned the elaborate setup for a 'smart fan,' pointing to readily available, cheaper alternatives like IR hubs for existing fans or simply using a physical switch. This sparked debate about the nature of hacker projects—whether they need to be purely practical or can exist as proofs of concept for deeper technical exploration. Defenders argued that the value lies in demonstrating iroh's capabilities and pushing technical boundaries, not in the fan itself.
Iroh's Ingenious IoT Integration
Beyond the fan, many readers saw the project as an excellent showcase for the iroh networking library itself. Commenters highlighted iroh's potential for resilient, cloud-independent IoT solutions on microcontrollers like the ESP32, enabling peer-to-peer connectivity from anywhere in the world. There was particular interest in its broader adoption and potential integration with existing IoT ecosystems like ESPHome.
WebAssembly's Web Wrangle
A specific technical discussion arose around the choice to compile Rust to WebAssembly for the browser-based UI. Some questioned this, suggesting that a JavaScript API for iroh might have been more straightforward for web development. Others defended the decision, citing reasons like avoiding JavaScript entirely or leveraging Rust's type safety and ecosystem, sparking a mini-debate on the C-vs-assembly analogy for TypeScript vs. JavaScript.