DEV Community

Tulio Calil
Tulio Calil

Posted on

Elixir for IoT: Why It Feels Like the Future

Most IoT projects today lean heavily on Python, C, or Node.js, and that’s fine. But during my recent academic paper selection process, I came across “The Benefits of Tierless Elixir/Potato for Engineering IoT Systems”, and it completely shifted how I think about building IoT architectures.

The paper raised a question that stuck with me:
why do we keep separating the logic, runtime and UI layers in IoT systems if functional, tierless architectures can unify everything?

That curiosity, combined with the influence of a professor(Adolfo Neto) who strongly advocates for functional programming and the BEAM, pushed me to test this idea in practice.

So I built a complete IoT prototype using Elixir, Circuits, Raspberry Pi, and Phoenix LiveView. And honestly? It felt like IoT the way it should be: supervised, fault-tolerant, reactive, and consistent from the edge to the dashboard.

Dark-themed Phoenix LiveView dashboard showing real-time sensor readings for temperature (29.2°C), light level (62.9%), and button status.

The Prototype: What I Actually Built

My goal was simple:

Build an IoT system end-to-end using only Elixir, from the hardware to the backend.

That resulted in a two-part monorepo:

  • A Raspberry Pi running Elixir (no Nerves this time, just Elixir Circuits)
  • A Phoenix LiveView dashboard receiving sensor data in real time

The device communicates via Phoenix Channels/WebSockets, sending temperature, light level, and button events, while receiving commands to control a buzzer.

Architecture Overview

Architecture diagram illustrating data flow: hardware sensors on Raspberry Pi pass data to GenServers, then via WebSockets to the Phoenix Server, PubSub, and finally the LiveView dashboard process.

If a sensor process fails: only that process restarts.
If the network blips: the BEAM keeps the system stable.
If the dashboard disconnects: LiveView reconnects automatically.

This is where the “future feeling” starts to show.

Circuit Setup (Everything on the Pi4)

Wiring diagram showing the Raspberry Pi 4 GPIO connected to a breadboard containing a DS18B20 temperature sensor, LDR photoresistor, push button, and active buzzer circuit.

Hardware used:

  • DS18B20 (1-Wire temperature sensor)
  • LDR + Capacitor (for RC timing)
  • Button (pull-up GPIO)
  • Active buzzer + transistor

The LDR timing loop runs in a separate process so it doesn’t block WebSocket communication, a natural fit for the actor model.

Why Elixir Feels Like the Future of IoT

After building this, a few conclusions became obvious:

  • The BEAM VM solves problems IoT devs fight daily
  • Concurrency is natural, not bolted-on
  • Fault tolerance is built-in
  • Real-time dashboards require zero JS
  • A single language from hardware to UI reduces mental load
  • Tierless architectures aren’t just academic, they’re practical

This cohesiveness made the whole experience feel weirdly futuristic.

Not flashy.
Not hyped.
Just… right.

What’s Next?

  • Implementing a Nerves firmware version
  • Adding more sensors
  • Testing distributed BEAM cluster of Pis
  • Applying Potato tierless concepts end-to-end
  • Publishing a deeper academic report

Elixir isn't mainstream in IoT, but maybe it should be.

This small prototype convinced me that a unified, functional, message-driven approach has the potential to dramatically simplify embedded systems.

If you're curious about IoT, the BEAM, or tierless architectures, give Elixir a try.
It might surprise you the same way it surprised me.

Try It Yourself

GitHub logo tuliocll / elixir-iot-sample

A complete IoT example using Elixir, Phoenix LiveView, and Raspberry Pi.

Elixir IoT Example 🚀

Elixir Raspberry Pi LiveView

Elixir IoT Example is a monorepo demonstrating how to connect a Raspberry Pi to a real-time Phoenix LiveView dashboard using Phoenix Channels, WebSockets, and Elixir Circuits.

It includes:

  • 🌡️ Real-time temperature readings (DS18B20)
  • 💡 Light level measurement using RC timing (LDR)
  • 🔘 Physical button input
  • 🔔 Remote buzzer control through WS commands
  • 📊 Web dashboard with auto-updating LiveView

This project serves as a practical, didactic example of building IoT systems entirely in Elixir.

Requirements

  • Elixir 1.17+
  • Erlang/OTP 26+
  • Node.js 16+ (for assets)
  • Raspberry Pi 4 / 3 (tested with Pi4)
  • Erlang + Elixir installed in the Rasp
  • Enable 1-Wire in Rasp (See doc/1-wire.md)

🏗️ Architecture and Circuit

Architecture

Circuit

Running server

cd server
mix deps.get
mix phx.server
Enter fullscreen mode Exit fullscreen mode

Open:

http://localhost:4000/dashboard

📡 Raspberry Pi (Elixir Circuits)

Running

# Clone the repo on the rasp and:
cd rasp
mix deps.get
iex -S mix
Enter fullscreen mode Exit fullscreen mode

The device will:

Top comments (0)