LUCA CIPRIANI, GIANLUCA VARISCO
Codemotion Rome 2019 - 22/03/2019
Control your Embedded
Linux remotely by using
WebSockets
Slide 2
Slide 2 text
2
WHO ARE WE?
Luca Cipriani
Chief Information
Officer
Gianluca Varisco
Chief Information Security Officer
Slide 3
Slide 3 text
3
LEGENDA
IoT
Gateway
EDGE
Linux
Device
Slide 4
Slide 4 text
4
Run Arduino code
on Linux Devices!
MANAGE EDGE LINUX DEVICES
Slide 5
Slide 5 text
5
CONTROL LINUX FROM THE WEB
● OLD problems, 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 ports are often closed
Slide 6
Slide 6 text
6
Give users a quick and easy-to-use web interface to
● Check the status of the system
● Configure networking
● Install packages
● Deploy apps / containers
USE CASE
Slide 7
Slide 7 text
7
USE CASE
MQTT server
GW
Connector
Websocket +
MQTT
Browser
Slide 8
Slide 8 text
8
DO NOT OVERKILL
We do not want to store users’ data unless
needed or it brings big advantages for both
users and us. We do not want to deal with
state synchronization. Scaling is really
expensive!
Slide 9
Slide 9 text
Arduino
Connector
Slide 10
Slide 10 text
Features
● One single binary, ~20MB
(no external deps)
● Works on every Debian-like Linux
distro
● Secure-only connections
● MQTT (Stable TCP socket with
remote server)
● Works on slow connections
● No need to know the IP in
advance
Slide 11
Slide 11 text
Features
● Go Language runs on:
○ ARM v5, v6, v7
○ ARM64 v8
○ x86
○ x86_64
Public repository:
https://github.com/arduino/arduino-
connector
Slide 12
Slide 12 text
About MQTT
● Well known
● Widely used
● Feature complete
● Simple enough
● Bi-directional
Slide 13
Slide 13 text
13
SERVER SIDE, WHAT DO YOU NEED?
● MQTT Server
● SSL support
● MQTT Client
● OAuth 2 server (optional)
● MQTT over WebSocket
Slide 14
Slide 14 text
14
EXAMPLE API
Slide 15
Slide 15 text
15
Use /proc , Luke!
And remember, everything is a file in Linux
We released arduino/go-system-stats, a library that gathers OS metrics
about resource usage (memory, disk, network, etc.)
STATS API
Slide 16
Slide 16 text
16
APT integration is dummy, APT lib APIs are in C++ only and
nearly impossible to integrate with Go, thus we decided to
use the CLI as an API and released arduino/go-apt-client
A combination of dpkg + apt commands wrapped in an
API
Supports the management of apt repos
APT INTEGRATION
Slide 17
Slide 17 text
17
APT INTEGRATION
Slide 18
Slide 18 text
18
NETWORK MANAGER INTEGRATION
NetworkManager has a stable API (0.98 is really stable)
We released arduino/gonetworkmanager, Go D-Bus
bindings for NetworkManager
You select ETH or Wi-Fi networks
Slide 19
Slide 19 text
19
NETWORK MANAGER INTEGRATION
Slide 20
Slide 20 text
20
● 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 (tested on Intel Data Center w/ 64+
core CPU) and small devices (e.g BeagleBone Black or
Raspberry Pi)
DOCKER INTEGRATION
Slide 21
Slide 21 text
21
DOCKER INTEGRATION
Slide 22
Slide 22 text
22
RUNS ON LINUX
Support for all
Debian-based devices
Porting to other OSes /
distros’ flavors is simple
Slide 23
Slide 23 text
23
Arduino uses the same underlying tech
described in this talk for its own IoT
Cloud:
MQTT + TLS + WebSocket
Slide 24
Slide 24 text
24
WHAT ARDUINO PROVIDES
Sensors Data +
Device Interaction
Automatic
Code Generation
Arduino Hardware
Secure
Cloud Connection
Device Management
OTA Updates
Firmware Changes
Business Logic
Firmware Upload
Certificate or Password
Provisioning
Dashboards Third Parties IoT SaaS
Arduino IoT Cloud