Skip to content

BLOG

How Elixir and Nerves Are Changing the Embedded Development Landscape

Embedded software development is a challenging process. A few issues and complexities that can stall your workflow: changing contexts, slow over-the-air firmware updates, adequate security, debugging, no process for deployments, connectivity issues, and the list goes on.

Perhaps the most significant challenge, however, is the constant rate of change and growth in this space. Staying on top of those changes is critical for your product to compete in today’s market. Getting to market faster is essential if you want to compete with the multitudes of startups that are waiting in the wings.

Enter the Nerves Platform, which makes IoT development as easy as developing for the web, and its cloud service NervesHub, which allows you to manage over-the-air (OTA) firmware updates of devices in the field.

NervesHub and the Embedded Development Landscape

NervesHub has made a massive difference in the embedded development process. Now, you’re able to manage new firmware updates and able to do local over-the-air updates, which makes testing locally so much better.

The Nerves Platform, meanwhile, makes embedded development feel like web development because even though you’re not developing for the web, you’re developing for a device that has to go through a boot process and has to do all of these other things.

After some time away from Nerves, it was such a pleasure to develop in. Not having to switch contexts was a huge bonus – something I’ll elaborate on later – which allowed me to move along more quickly and spend time solving more interesting problems.

My History with Elixir and Nerves

I started with Elixir in my last job, and we used it as our daily driver. We built our entire platform on it. That was two-and-a-half years ago. Our most senior developer at the time had been using Elixir since its inception, and I remember him telling me, “Oh yeah, there’s this hardware thing. There are these other ways to do things, other outlets, other applications,” so that’s what I knew.

Shortly after, I learned about Nerves at Lonestar Elixir, and I went to every Nerves talk I could go to, and it blew my mind. I was still really green with Elixir, and I was still really green as a developer, but it blew my mind what was possible. I could not get enough of those talks.

Then, I was at ElixirConf when the Scenic Library was first announced. So, I was hearing about Elixir UIs and developing embedded applications, and I was also going to talks about embedded Elixir. It helped to solidify what was possible. It was a language that could be applied to many applications, and that’s what I liked about the community.

Out-of-The-Box Thinking – Simplified

For me, Nerves facilitated a lot of out-of-the-box thinking. I’d be thinking about an application that I wouldn’t have typically considered, and then I’d see if I could apply Nerves to it. I’d be wondering if we could run x-y-z on a Raspberry Pi, for example, and, yeah, it turns out we can.

And then I’d wonder if we could write this application and it have it show up on a display, and it turns out we can do that too. I could have it control a bunch of sensors and start automating everything, all based on this language that runs our website – but now, it also runs our firmware and displays.

It helped me explore and expand what was possible with technology in a way that wasn’t overly complicated. There is a lot of complexity in Nerves, but if you’re not doing hyper-complex things, the ease of use is one of its strongest points.

One of the best things about Nerves is that you can get up and running so fast. It really speaks to the Nerves team and what they can accomplish to be able to run a few commands, and, suddenly, you have Elixir running on an embedded device in a comfortable environment.

Embedded Development Made Easy

I have tried to architect embedded workflows in other languages besides Elixir, but it’s a complicated process. The first thing I always ask when I start something new is, “What is my starting point? What is the thing that gets me to the file structure, so I know where to put the files?” Right upfront, this is a basic but critical task. If you put something in the wrong place, things just don’t work.

With other languages, it can be tough even to get to that point. Sure, there are a lot of systems doing what Nerves is doing, but from what I’ve experienced, Nerves gives you such a good launching point that it’s possible to think of solutions nobody else has thought of before.

Nerves also handles the bootstrapping aspect of a project, which is huge, because that process can be quite monotonous. Myself, if I had to spend a lot of time bootstrapping, I’d be wondering why I haven’t got someone else to do it for me, because I’m writing voluminous, repetitive code, solving problems that have already been solved a million times. This isn’t why I became a developer. Nerves gets you right into building the stuff, and that’s really where the magic is.

Good For Every Developer at Any Skill Level

One of the best things about Nerves and Elixir is that it’s so simple. I cannot stress that enough. The ease of use for the whole community and the low cost of entry means that it’s as suitable for beginners as it is for intermediate and advanced development skill levels. It’s a joy to use because it covers the entire spectrum, and it does it so well.

Advancing at the Speed of Business

From a business perspective, I think that Nerves has some compelling benefits. It can actually help companies advance and get to market with products faster. Plus, since it accelerates and simplifies the development process, you have the added benefit of a better quality of life for your teams. Happy employees, more products in the market – it’s a winning combination, any way you look at it.

Plus, because Nerves is so much easier to master, once more developers are on board, there will likely be a better supply of talent that can be had at less cost. Highly specialized C++ skills take longer to recruit and cost more overall, so if companies can shift to a Nerves/Elixir workflow, it should do well to improve productivity and the bottom line.

It’s like hiring an intelligent developer who can learn a new language in a day. It gets you not just web applications, but embedded applications too. Let’s say I have a project in client services. Right now, I’m on a project where I’m building web applications and building an API. Tomorrow, they might ask me to build a full-stack, and I can then use live view and keep moving quickly. Then, they might ask me to make one aspect embedded and with a display, and because I’m using the same tools throughout the process, there is no need to switch contexts. It’s a simple process. Very elegant.

Full-Stack Development Without Switching Contexts

Context shifting is a significant issue for developers. Typically, when you shift contexts, you would have to remember how to do what you need to do in such-and-such language because it performs differently for each iteration. Working in Nerves with Elixir, I only have to remember how it works for this specific application, which simplifies the whole process a lot.

What it boils down to is this: instead of hiring an embedded developer, you can hire a developer, and they can use the same tools across the whole spectrum, not just for one piece of a project, but every aspect of it, from end-to-end.

Of course, I don’t advocate that any one developer should be doing the full web stack and embedded, especially if the project is on a tight deadline, but theoretically, it’s possible.

Ideally, you would want to structure your teams so that you’ve got everybody working on a different task, but all in Nerves. That would make it easier to collaborate on a project because if there were changes to be made, it could be done quickly and without a lot of back-and-forths. You can solve problems from bare metal to the web without switching contexts.

Making the Development Process Easier For Everybody

I’ve always said that I enjoy the quality of life as an Elixir developer because the tooling was so great. There were releases from Elixir a couple of years ago that were aimed strictly at improving developer quality of life. In other words, they “made the thing do the thing,” but they took it a step beyond to help developers do that thing easier and more efficiently. There’s a level of dedication to happiness that is, quite frankly, very attractive.

Documentation

The other great thing I might mention is the Elixir documentation that makes using Elixir and Nerves so easy. Whenever people ask me how to do something with Elixir or Nerves, I always say, “Have you looked at the documentation?”

With some languages, you say that, and they say, “Well, I couldn’t read the legalese,” and that’s a sticking point. But the Elixir community documentation is so good that I almost never look at any of the other resources. I keep up the documentation because the language has a lot of breadth and it is clear enough that you can say, “Oh I know this function takes this thing, and that’s why it isn’t working.”

Again, it’s about ease of use. The bar for entry is so low that you can just look at the documentation, and it will explain things in a very clear way. The reason it’s so clear is that they’ve put a lot of resources behind making it so.

I know this because one year at ElixirConf, at the end of one of the training days, the Elixir team had everyone submit PRS for documentation. That’s all they cared about – looking through the docs, fixing grammatical errors, fixing typos, and adding docs where they’re missing. Their dedication to that, and making it all readable, is super valuable. They even have a tool that you can use to check if your docs are “good” or not. You can write your docs the same way you always do; then, you can check to make sure that your docs are what you think they are and that they are formatted the right way before you ever publish your code somewhere.

One final caveat – I have to admit that, since diving into the Elixir and Nerves communities, I haven’t kept up as much with other languages and what they’re doing.

What I do know, however, is that Elixir and Nerves have kept me not only interested but also intrigued by the question, “What’s the next problem I can solve with this?” and that’s an exciting place to be.

If you’d like to experience the benefits of Nerves on your next IoT development project, check out Very’s Nerves development services today

IoT insights delivered to your inbox