REMOTE CONTROL OF IoT LINUX DEVICES ARDUINO CONNECTOR | LINUXLAB 2018 04|12|2018
2Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT ABOUT ME LUCA CIPRIANI CIO, ARDUINO @MASTROLINUX
3Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT 3 INTRO | GOALS
4Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT ARDUINO - KNOWN FOR MICROCONTROLLERS MKR FOX 1200 MKR WAN 1300 MKR GSM 1400 MKR NB 1500 MKR WIFI 1010 MKR ETH SHIELD MKR1000
5Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT RUNS ON LINUX TOO
6Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT USE CASE Give users a quick and easy web interface to • Check the status of the system • Configure networking • Install packages • Deploy apps/containers, Arduino Sketches
7Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT CONTROL LINUX FROM THE WEB • Old problem, Old solutions • HTTPS is hard to achieve • Bi-directional communication • Work on most network topologies • Create a web server, contact it via http • Cannot have HTTPS unless domain name is registered and IP address is static/known • UDP port are often closed
8Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT KNOWN SOLUTIONS DID NOT FIT USE CASE Here is a random list • Ubuntu Landscape • Zentyal • Ajenti • Webmin • Others
9Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT LANDSCAPE - DO NOT BE OVERKILL We do not want to store users’ data unless needed or with big advantages for both users and us. We do not want to deal with state synchronization. Scaling is really expensive!
10Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT SECTION TITLE
11Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT ZENTIAL - OUR TARGET ARE NOT SMB You have to control a Raspberry, not a small office, do you really need a whole OS?
12Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT
13Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT AJENTI - GOOD PRODUCT BUT STILL WEB SERVER They have a nice, well designed product but has the same issues we mentioned already. HTTP server based system!
14Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT
15Remote Control of IoT Linux Devices | LinuxLab 2018 - Firenze, IT ARDUINO CONNECTOR FEATURES One single binary ~20MB (no external deps)01 Works on every Debian-like Linux distros02 Works on slow connections05 No need to know the IP in advance06 Secure only connections03 MQTT (Stable TCP socket with the remote server)04
16Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT MQTT is: • Well known • Widely used • Feature complete • Simple enough • Bi-directional I like AMQP more ;)
17Remote Control of IoT Linux Devices | LinuxLab 2018 - Firenze, IT SERVER SIDE WHAT YOU NEED MQTT Server01 SSL Support02 MQTT over Websocket (optional)05 MQTT Client03 Oauth2 server (optional)04
18Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT SHOW ME THE CODE Go Language runs on: arm v5, v6, v7 arm64 v8 x86 x86_64 Public repo: https://github.com/arduino /arduino-connector
19Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT {} --> $aws/things/{{id}}/stats/post INFO: { "memory":{ "FreeMem":1317964, "TotalMem":15859984, "AvailableMem":8184204, "Buffers":757412, "Cached":6569888, "FreeSwapMem":0, "TotalSwapMem":0 }, <-- $aws/things/{{id}}/stats EXAMPLE API {} --> $aws/things/{{id}}/apt/list/post INFO: {"packages":[ {"Name":"firefox","Status":"upgradable"," Architecture":"amd64","Version":"57.0.3+b uild1-0ubuntu0.17.10.1"}, ...], "page":0,"pages":1} <-- $aws/things/{{id}}/apt/list
20Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT Use /proc Luke! And remember, everything is a file in Linux We released https://github.com/arduino/go-system-stats STATS API
21Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT APT integration is dummy, APT lib api are in C++ only and nearly impossible to integrate with Go, so we used the CLI as an API We released https://github.com/arduino/go-apt-client/ A combination of dpkg + apt commands wrapped in an API Supports managing repos APT INTEGRATION
22Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
23Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT NetworkManager has stable API (0.98 is really stable) We released https://github.com/arduino/gonetworkmanager You can add ETH or WiFi networks NETWORK MANAGER INTEGRATION
24Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
25Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT We install docker if not previously installed and if target supports it. Docker Go APIs are really easy to manage (imagine why) Works with private registry Runs on huge servers (we tried with Intel Data Center with 64 core CPU) And Small devices (like Beaglebone Black and Raspberry Pi) DOCKER INTEGRATION
26Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
27Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT We can run Arduino compiled code directly as a Linux binary Integrations with all Hardware sensors and GPIO is provided by the MRAA library https://github.com/intel-iot-devkit/mraa ARDUINO INTEGRATION
28Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT Support for all Debian Based devices. Porting to other OS is simple.
29Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT Communicate with the hardware directly from Arduino to Linux API and vice-versa
30Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT Run Shell commands in Arduino and manage hardware directly https://create.arduino.cc/projecthub/Arduino_Genuino/arduino-linux-on- up2-board-with-intel-mraa-a30f87
31Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT ARDUINO INTEGRATION
32Remote Control of IoT Linux Devices | LinuxLab2018 - Firenze, IT Let’s give it a try! https://create.arduino.cc
THANK YOU! ARDUINO.CC Luca Cipriani - CIO l.cipriani@arduino.cc - @mastrolinux

Luca Cipriani - Control your Embedded Linux remotely by using MQTT and a web interface

  • 1.
    REMOTE CONTROL OFIoT LINUX DEVICES ARDUINO CONNECTOR | LINUXLAB 2018 04|12|2018
  • 2.
    2Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT ABOUT ME LUCA CIPRIANI CIO, ARDUINO @MASTROLINUX
  • 3.
    3Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT 3 INTRO | GOALS
  • 4.
    4Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT ARDUINO - KNOWN FOR MICROCONTROLLERS MKR FOX 1200 MKR WAN 1300 MKR GSM 1400 MKR NB 1500 MKR WIFI 1010 MKR ETH SHIELD MKR1000
  • 5.
    5Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT RUNS ON LINUX TOO
  • 6.
    6Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT USE CASE Give users a quick and easy web interface to • Check the status of the system • Configure networking • Install packages • Deploy apps/containers, Arduino Sketches
  • 7.
    7Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT CONTROL LINUX FROM THE WEB • Old problem, Old solutions • HTTPS is hard to achieve • Bi-directional communication • Work on most network topologies • Create a web server, contact it via http • Cannot have HTTPS unless domain name is registered and IP address is static/known • UDP port are often closed
  • 8.
    8Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT KNOWN SOLUTIONS DID NOT FIT USE CASE Here is a random list • Ubuntu Landscape • Zentyal • Ajenti • Webmin • Others
  • 9.
    9Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT LANDSCAPE - DO NOT BE OVERKILL We do not want to store users’ data unless needed or with big advantages for both users and us. We do not want to deal with state synchronization. Scaling is really expensive!
  • 10.
    10Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT SECTION TITLE
  • 11.
    11Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT ZENTIAL - OUR TARGET ARE NOT SMB You have to control a Raspberry, not a small office, do you really need a whole OS?
  • 12.
    12Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT
  • 13.
    13Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT AJENTI - GOOD PRODUCT BUT STILL WEB SERVER They have a nice, well designed product but has the same issues we mentioned already. HTTP server based system!
  • 14.
    14Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT
  • 15.
    15Remote Control ofIoT Linux Devices | LinuxLab 2018 - Firenze, IT ARDUINO CONNECTOR FEATURES One single binary ~20MB (no external deps)01 Works on every Debian-like Linux distros02 Works on slow connections05 No need to know the IP in advance06 Secure only connections03 MQTT (Stable TCP socket with the remote server)04
  • 16.
    16Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT MQTT is: • Well known • Widely used • Feature complete • Simple enough • Bi-directional I like AMQP more ;)
  • 17.
    17Remote Control ofIoT Linux Devices | LinuxLab 2018 - Firenze, IT SERVER SIDE WHAT YOU NEED MQTT Server01 SSL Support02 MQTT over Websocket (optional)05 MQTT Client03 Oauth2 server (optional)04
  • 18.
    18Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT SHOW ME THE CODE Go Language runs on: arm v5, v6, v7 arm64 v8 x86 x86_64 Public repo: https://github.com/arduino /arduino-connector
  • 19.
    19Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT {} --> $aws/things/{{id}}/stats/post INFO: { "memory":{ "FreeMem":1317964, "TotalMem":15859984, "AvailableMem":8184204, "Buffers":757412, "Cached":6569888, "FreeSwapMem":0, "TotalSwapMem":0 }, <-- $aws/things/{{id}}/stats EXAMPLE API {} --> $aws/things/{{id}}/apt/list/post INFO: {"packages":[ {"Name":"firefox","Status":"upgradable"," Architecture":"amd64","Version":"57.0.3+b uild1-0ubuntu0.17.10.1"}, ...], "page":0,"pages":1} <-- $aws/things/{{id}}/apt/list
  • 20.
    20Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT Use /proc Luke! And remember, everything is a file in Linux We released https://github.com/arduino/go-system-stats STATS API
  • 21.
    21Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT APT integration is dummy, APT lib api are in C++ only and nearly impossible to integrate with Go, so we used the CLI as an API We released https://github.com/arduino/go-apt-client/ A combination of dpkg + apt commands wrapped in an API Supports managing repos APT INTEGRATION
  • 22.
    22Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
  • 23.
    23Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT NetworkManager has stable API (0.98 is really stable) We released https://github.com/arduino/gonetworkmanager You can add ETH or WiFi networks NETWORK MANAGER INTEGRATION
  • 24.
    24Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
  • 25.
    25Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT We install docker if not previously installed and if target supports it. Docker Go APIs are really easy to manage (imagine why) Works with private registry Runs on huge servers (we tried with Intel Data Center with 64 core CPU) And Small devices (like Beaglebone Black and Raspberry Pi) DOCKER INTEGRATION
  • 26.
    26Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT DOCKER INTEGRATION
  • 27.
    27Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT We can run Arduino compiled code directly as a Linux binary Integrations with all Hardware sensors and GPIO is provided by the MRAA library https://github.com/intel-iot-devkit/mraa ARDUINO INTEGRATION
  • 28.
    28Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT Support for all Debian Based devices. Porting to other OS is simple.
  • 29.
    29Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT Communicate with the hardware directly from Arduino to Linux API and vice-versa
  • 30.
    30Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT Run Shell commands in Arduino and manage hardware directly https://create.arduino.cc/projecthub/Arduino_Genuino/arduino-linux-on- up2-board-with-intel-mraa-a30f87
  • 31.
    31Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT ARDUINO INTEGRATION
  • 32.
    32Remote Control ofIoT Linux Devices | LinuxLab2018 - Firenze, IT Let’s give it a try! https://create.arduino.cc
  • 33.
    THANK YOU! ARDUINO.CC Luca Cipriani- CIO l.cipriani@arduino.cc - @mastrolinux