Build a Weather Station with Elixir and Nerves (PragProg)

This project based book gets you up to speed on building and deploying Elixir IoT applications using Nerves, as you develop a real-world IoT weather station.

Alexander Koutmos
Bruce A. Tate @redrapids
Frank Hunleth @fhunleth

edited by Jacquelyn Carter @jkcarter

The Elixir programming language has become a go-to tool for creating reliable, fault-tolerant, and robust server-side applications. Thanks to Nerves, those same exact benefits can be realized in embedded applications. This book will teach you how to structure, build, and deploy production grade Nerves applications to network-enabled devices. The weather station sensor hub project that you will be embarking upon will show you how to create a full stack IoT solution in record time. You will build everything from the embedded Nerves device, to the Phoenix backend and even the Grafana time-series data visualizations.

Elixir as a programming language has found its way into many different software domains, largely in part to the rock solid foundation of the Erlang virtual machine. Thanks to the Nerves framework, Elixir has also found success in the world of embedded systems and IoT. Having access to all of the Elixir and OTP constructs such as concurrency, supervision, and immutability makes for a powerful IoT recipe. Find out how to create fault-tolerant, reliable, and robust embedded applications using the Nerves framework.

Build and deploy a production grade weather station sensor hub using Elixir and Nerves, all while leveraging the best practices established by the Nerves community for structuring and organizing Nerves applications. Capture all of your weather station sensor data using Phoenix and Ecto in a lightweight server-side application. Efficiently store and retrieve the time-series weather data collected by your device using TimescaleDB (the Postgres extension for time-series data). Finally, complete the full stack IoT solution by using Grafana to visualize all of your time-series weather station data. Discover how to create software solutions where the underlying technologies and techniques are applicable to all layers of the project.

Take your project from idea to production-ready in record time with Elixir and Nerves.


Alexander Koutmos has been writing software professionally for almost a decade and has been working primarily with Elixir since 2016. He currently maintains a few Elixir libraries on Hex and also runs a software consultancy (www.stagira.com).

Bruce Tate is a kayaker, programmer, and father of two from Chattanooga, Tennessee. The author of more than 10 books has been around Elixir from the beginning. He is the founder of Groxio, a company that trains Elixir developers.

Frank Hunleth is an embedded systems programmer, OSS maintainer, and Nerves core team member. When not in front of a computer, he loves running and spending time with his family.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:


Posted via Devtalk (see this thread for details).

23 Likes

Is this going to be available for purchase as a beta before final publication? It seems not to be currently.

1 Like

it is now, just bought it.
Great to have a nerves book.

@PragmaticBookshelf the discount code is not working

4 Likes

Great - at last a use for my spare pi! Haven’t touched Nerves yet but it looks like it could be great fun.

3 Likes

It is. Embedded development is fun. Very different to web or desktop. And nerves makes the hard parts of embedded development easy. And you can do it in Elixir.

3 Likes

I’d be interested in your impressions of the book - does this first beta release look pretty usable?

3 Likes

5 Likes

@Sebb Thanks for reading and for letting us know about the coupon code. I’ve logged a ticket with support@pragprog.com.

3 Likes

Thanks for bringing attention for this book.
I’ve been wanting to take a shot in IoT and this book is a perfect fit to go for it.

3 Likes

Just had a two minute look at the book. It’s missing two of five chapters now, but I think it is not trying to provide a deep understanding of Nerves, Linux or embedded but is really just what the title says

Build a Weather Station with Elixir and Nerves

I’m sure it does a good job with that. The choice of the weatherstation is a very good one, I think. You build something you can really use. Play with I2C sensors and will visualize the data in Grafana. And nerves makes this ridiculously easy. Do this with C and you won’t have the basics set up when you’re already done with nerves.

4 Likes

I may be biased as I am one of the authors haha.

Some of the book reviewers who covered the technical aspects of the books, did actually assemble the Nerves weather station and test the project out end-to-end without coming across any issues. Obviously things can change between now and when the book comes out of beta, but I don’t see the code changing much :slight_smile:.

Hope that helps!

4 Likes

Yes, that’s pretty appealing (& motivating)

Yes I did a tiny bit of microcontroller stuff many years ago & always wanted to get back to something in the ballpark.

That’s permissible! Anyway thanks, sounds like it will provide a worthy use for my sadly underworked raspberry pi.

2 Likes

Sweet! Looking forward to read this and learn some new tricks from the Nerves pros :slightly_smiling_face:

BTW, Nerves is one of the technologies I had more fun with in the last years (on top of some good profit). I am so thankful to the maintainers!

2 Likes

just had a second look. some thoughts:

  • why is there a SGP30 in addition to the BME680? I do not see the use case for CO2 sensing in a weatherstation…?
  • did you think about building a case that could be 3D-printed? So we could really mount the thing outsides? Also we could give the light sensor some proper lens which would improve the measurement. Its not easy to build a case thats waterproof, but with enough hot glue everything goes.
  • also a custom sensor board would be nice

The last points only make sense if enough people really build the station and are interested. But making this into a really usable project it would be a great opportunity for nerves/elixir to gain traction in the maker scene.

3 Likes

I don’t think you’ll learn anything new about nerves from this book. It is a great first project, but does not seem to dig too deep. But its not finished yet and I did not look too close, so please correct me if I’m wrong.

3 Likes

I can see CO2 reading being useful if the device is in a farming/gardening environment for example.
That’s what I have in mind with this project. I’ve looked the hardware up and I’ll probably pull the trigger.

I’m not sure if something like that is what they had in mind with that sensor though.

3 Likes

Got the book using the discount and started reading it. You’re right in that it’s a beginner resource. That’s good in general because it fills a niche: I am sure there are many people that would love to get started with Nerves with a cool project, and this is a good book for that purpose.

As for me, I am crossing fingers that the authors will consider writing an advanced Nerves book, to really tap into their expertise :slightly_smiling_face: Still enjoying browsing through the book though.

4 Likes

@lucaong We do have another Nerves book in the works – stay tuned. I am not sure when it will be ready for beta as only a few chapters are written so far.

6 Likes

The coupon code devtalk.com is working now for the Nerves Weather Station book!

2 Likes

Amazing! :star_struck:

2 Likes