WHITEPAPERS
The Case for Agile IoT With Elixir and Nerves
Our approach to bringing web tools, technology, and processes to the hardware world.
IoT products and ecosystems have achieved mainstream consumer adoption. Consumers have shown they are willing to pay for Internet-connected devices, which has left the market flooded with mildly successful but poorly executed products. Why is this the case?
- Hardware engineers are expensive, and are not experts at building web software.
- Web engineers are expensive, and are not experts at building hardware.
- Embedded software technologies lag behind web-based software technologies.
Though the IoT landscape is improving, these issues have produced an ecosystem that is rampant with fragile and difficult to use devices, security flaws, and several disparate communication protocols that prevent seamless device integrations.
Bringing Web Development Practices to IoT
Rather than trying to squeeze embedded C into the web world, Very’s approach is to bring web tools and technology to the hardware world through Elixir and Nerves. This makes it possible to iterate quickly and bring software innovations like machine learning and the blockchain to IoT hardware.
The web is a world of massive user bases and ever-changing user needs, which requires web software to be robust, performant, and adaptable. Due to the scale of many web platforms, it’s feasible that a single line of code in a web ecosystem may execute more times in one day than its embedded counterpart will be executed over the entire lifetime of its hardware host.
In addition, this single line of code will need to evolve to meet the needs of its user base without incurring huge engineering costs behind the changes. Luckily, the ecosystem of web languages and technologies has evolved in order to meet the needs of the web world. This has yielded languages that are easy to write/refactor and frameworks that enforce best practices. Among these best practices are security-minded patterns, test-driven development, and continuous delivery.
Achieving IoT Agility With Elixir/Nerves
Elixir is a language designed for building distributed, fault-tolerant applications. Elixir is executed within the Erlang runtime system, which was designed for use in low-level hardware applications and is most notable for being:
- Distributed
- Fault-tolerant
- Soft real-time
- Highly available and non-stop
- Hot swappable
In recent years, the Phoenix framework has made it possible for Elixir to be successfully adopted by web developers looking to create web-based applications that leverage the core characteristics of the language. As a result, an ecosystem of Elixir tools that supports the web’s best practices has emerged.
Though Elixir has been adopted by the web community, its strengths for low-level hardware applications still remain. The Nerves project successfully leverages the ideologies of web development (frameworks, powerful tooling, etc.) and combines them with the strengths of embedded Elixir. This makes the Elixir/Nerves stack ideal for rapid, robust development of IoT devices, and as such, it is the IoT firmware stack that we deploy most often at Very.
Very utilizes both Agile and Lean development concepts for IoT devices. Particular capabilities of the Elixir/Nerves stack which support this approach include:
- Seamless test-driven development including hardware emulation. This eliminates slow hardware-in-the-loop testing on every iteration and often yields software that works the first time it touches the embedded target.
- Continuous delivery of tested firmware builds via common continuous delivery tools designed for the web.
- Many compatible open source tools for secure communication with web servers via HTTP and websockets.
- Fault-tolerant and automated OTA firmware updates.
- Applications that are tolerant to hardware failures/abnormalities like accidental shorts, etc.
These capabilities are critical when it comes to delivering reliable software quickly, (as is the custom among strong web development teams), but they are exceedingly difficult or impossible to achieve with embedded C.
What This Means for Your Hardware
Nerves is an established project, and the list of possible embedded targets is growing. If you are interested in working with us to develop the firmware for your IoT device, point your hardware engineers toward these platforms. If you are not able to build hardware that is supported by Nerves, we will be glad to help with the mobile or web server components of your IoT project.
Embedded C Isn’t All Bad
Embedded C definitely has its place in IoT technology, but we believe it should be clearly separated from the web and heavy business logic portions of your device firmware.
If, for example, your device has hard real-time requirements, Nerves alone will not handle those. However, Nerves can be designed in a manner that easily integrates with existing hardware that requires embedded C. This approach empowers your hardware team to maximize its development strengths while the Very team leverages ours.