Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a Home Security System with Elixir and...

Arto Bendiken
February 01, 2019

Building a Home Security System with Elixir and Nerves

Nerves is a framework for crafting bulletproof embedded software written in Elixir and deployed onto the rock-solid, nine-nines Erlang/OTP platform running directly on top of the Linux kernel.

I will show how to get started with Nerves with the motivating example of a home security system running on a Raspberry Pi. To disarm the security system, you need to step in front of the camera and give a big smile.

In addition to Nerves and Elixir, we will use deep learning with TensorFlow for face recognition.

Arto Bendiken

February 01, 2019
Tweet

More Decks by Arto Bendiken

Other Decks in Technology

Transcript

  1. Nerves (nerves-project.org) is the true killer app of Elixir. It’s

    not yet widely known outside of the Elixir community, but that is changing quickly (even in this very room, right now). Nerves is doing to embedded development and Elixir what Rails did for web development and Ruby. The current statistics from the Elixir community on Slack as of February 2019: #phoenix 21,100+ members, #nerves 1,800+ members The Killer App for Elixir?
  2. What is Nerves? Nerves (nerves-project.org) enables you to “craft and

    deploy bulletproof embedded software in Elixir”. Nerves is an umbrella project consisting of tooling and libraries enabling the development of robust, reliable firmware for smart hardware devices written in a high-level functional language (Elixir) and running on a carrier-grade runtime (Erlang/OTP).
  3. What is Nerves? • Produces firmware images as small as

    12 MB, which includes the Linux kernel, the Erlang/OTP runtime, and your Nerves application • Firmware images are burned to an SD card for deployment to target hardware • The firmware boots in a few seconds: your application code can be running in as little 3-4 seconds after power on • An incredibly stable runtime platform with low and predictable steady-state RAM consumption: on the order of 8 MB, and your application probably will fit in 32 MB Linux kernel and rootfs (Buildroot) Erlang/OTP runtime (BEAM) Your Nerves application (Elixir) Firmware image
  4. Hobbyist Hardware for Nerves Raspberry Pi 3 Model A/B/B+ (RPi3)

    BeagleBone Black/Green/Blue (BBB/BBG/BBGW)
  5. • This is what the Erlang platform (OTP, BEAM) was

    designed for (telecomms switches)—good soft-realtime support • Pattern matching (with bitstring support) is great for implementing wire protocols robustly • The real world and real hardware is inherently concurrent, asynchronous, and unpredictable—message passing with the actor model is a good way to model that • Fault tolerance and error recovery actually matter (just let it crash—so long as the user doesn’t notice) Why Elixir for Embedded Development?
  6. Hobbyist Hardware for Nerves Raspberry Pi 3 Model B+ (RPi3)

    • $35 MSRP • 1.4 GHz Cortex-A53 (4× cores) • 1 GB LPDDR2 RAM • 4× USB ports, 1× Ethernet port, 1× HDMI port, etc • 40× GPIO pins • 802.11ac Wi-Fi (dual band) • Bluetooth 4.1 and LE BeagleBone Green (BBG) • $44 MSRP • 1.0 GHz Cortex-A8 • 512 MB DDR3 RAM • 1× USB port, 1× Ethernet port, micro-HDMI as add-on, etc • 92× GPIO pins and 2× Grove connectors • Open-source hardware, customizable for production designs
  7. Technologies • Elixir • Erlang/OTP • C++ • OpenCV •

    FaceNet • Dlib • Nerves • Linux kernel • gRPC • Protocol Buffers • Python • Go? • Ruby? • etc