Your Turn

In this chapter, you found out why Elixir and Nerves provide an excellent platform for creating network-enabled IoT devices. By leveraging the provided Nerves networking tools, you were able to connect to your device, remotely push firmware updates, and read live sensor data. All of this was possible thanks to the solid foundation provided to us by Elixir and Nerves. This allowed us to focus on the core of our problem as opposed to worrying about the lower-level details.

What You Built

You created the first poncho project in the application using the Nerves mix nerves.new command. With your newly created project, you were able to burn your firmware to the device and SSH into it using the default wired connection over a USB cable. With an active IEx REPL session, you were able to run a few commands and establish a wireless connection. Thanks to the Nerves VintageNet tooling, your network configuration was automatically saved so that whenever the device reboots, it can connect to the wireless network without any manual intervention from you.

Sensors in Nerves typically use the I2C interface, and have broadly different interfaces to access them. The typical model for working with them is to write to one register to issue a command and read from another register as a response. The Circuits.I2C library has some functions to make that process easier, as you saw with the light sensor.

Why It Matters

This was your first pass at getting things up and running with Nerves and our Raspberry Pi. You were able to accomplish a lot toward your end goal of an environmental sensor hub with only a little configuration and some initial set up. The important takeaway here is that you now have a development workflow established where you can make code changes on your workstation and then, over the wireless network, flash your device with an updated firmware. This is one of the main benefits of Elixir and Nerves, in that you can rapidly build and test your devices without out much ceremony.

What’s Next

This chapter got you ready for the work you’ll do in the next chapter, where you’ll build a core and boundary layer in order to set up your sensor hub to publish metrics to your Phoenix API server. You’ll also set up the remainder of your sensors so that you can get a holistic view of the environment using your Nerves-powered Raspberry Pi.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.205.189