Nectar
Building Nectar, A Robust IoT System based on Elixir & OTP
Welcome to our in-depth exploration of Elixir and OTP. These technologies, with their concurrency, real-time processing, fault tolerance, and lightweight processes, make them an optimal choice for crafting reliable and efficient IoT systems. Join us as we delve into the intricacies of harnessing these features for our project.
Building Blocks for Scalable Systems
Elixir, thriving on the Erlang VM (BEAM), is renowned for crafting scalable and fault-tolerant systems, inheriting Erlang’s superior concurrency model and fault tolerance. OTP, with its rich set of libraries and design principles, acts as a catalyst in developing structured and resilient Elixir applications.
Unveiling Nectar
In this series, we focus on 'Nectar,' an IoT system with three main components: a Smart Actuator (lamp), a PIR Sensor, and a Camera Module. We'll start by exploring the interactions between the sensor, the Nectar module, and the lamp. The reason for this approach is simple: the patterns for the camera might be similar to those of the lamp and sensor, and we want to avoid redundancy. After covering the basics with the lamp and sensor, we'll integrate the camera module into our server and main panel, introducing image processing as an additional learning aspect.
Under the Hood
Hardware components are directly interfaced with Elixir/Erlang/BEAM modules, enabling straightforward intra-BEAM communication and eliminating the reliance on intermediary protocols like REST or gRPC.
Objective and Scope
We'll process signals from Nectar's hardware components, while also sending commands to these devices. For now, these components are treated as black boxes. The only detail we're aware of is their use of Erlang/Elixir for communication.
Our primary task is to explore the system's core and its dashboard panel, both designed to run on-premises on specific hardware. Later discussions may delve into the creation and migration to a cloud-hosted version of the system.
What’s in Store?
By the end of this series, expect to gain a solid understanding of Behaviours, Processes, Agents, and GenServer, as well as concurrent processing, state management, and fault tolerance. These are among the core Elixir & OTP concepts vital for building resilient and scalable systems.
Up Next: Delving into Processes and Agents
In our next installment, we'll dive into Processes and Agents. While Processes are rooted in the concurrency model of Erlang and the OTP framework, Elixir offers its own elegant abstractions, such as Agents, to harness this power. Our journey will commence with the setup of an Elixir mix project. Next, we'll try out simulating interactions with Processes and Agents in Elixir, key parts of handling tasks at the same time and managing data.
The goal is to offer a guide that is both concise and straightforward. While prior Elixir experience might give you a head-start, it's by no means a prerequisite. We'll include timely references to foundational aspects, ensuring a comprehensive learning experience without going over well-known topics.
Get ready to explore the primary concurrency constructs in our upcoming installment.