webthing-iotjs-tizenrt-cdl2018-20181117rzr

Phil www.rzr.online.fr
Phil www.rzr.online.frSr Software Enginner at Undisclosed
1
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Webthings
Using IoT.js
for RT
on boards
#CDL2018, Capitole du libre
ENSEEIHT, Toulouse, France <2018-11-18>
Philippe Coval <p.coval@samsung.com>
Samsung Open Source Group / SRUK
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
2
Hello world, $who am I ?
●
Philippe Coval
– Belongs to Samsung Research UK
●
in OpenSource group
– French
●
from Toulouse then Rennes
●
Interests:
– Libre Soft/Hard/ware communities
– Embedded, IoT, Web, DIY…
Need help? Ping me online:
http://social.samsunginter.net/@rzr
3
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Agenda
●
Context:
– IoT status, Privacy matters !
– Motivations for Web of Thing
●
Mozilla Webthings framework
●
Connecting constrained IoT devices
– Easily with JavaScript!
4
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
IoT status
●
The Internet of Things is a system of physical objects
– that can be discovered, monitored, controlled,
– or interacted with by electronic devices
– that communicate over various networking interfaces
●
and eventually can be connected to the wider Internet.
●
Addresses many domains:
– Health, Agriculture, Transport, Cities, Industry
●
Critical in many cases: Need to Secure & Privacy Proof
5
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Privacy is about Trust and Control
●
Ownership of personal data
– Shared, Transferred, Revoked, Logged, Retrieved and DELETED
●
depend on time and context
●
Services operators should comply regulations:
– EU: General Data Protection Regulation (GDPR 2018)
●
Threat to privacy in the IoT is HIGH!!!
●
“Privacy by design” opportunities
– Prevent data collection in first place→Keep data local if possible
●
Limit usage of cloud, apps or “captive models”
– New security challenges (Decentralize, reduce surface of attacks)
6
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Motivations for Open Web Of Things
●
Open web platform promises:
– Security (isolation in browser)
– Enhanced privacy (DNT)
●
Security is not same as Privacy !
●
Think decentralized !
– may be harder to secure
●
but more resilient
– Edge: Computation on nodes
●
Web of Things (WoT)
– An application layer for IoT
– with interoperability
– Specification work by
– And FLOSS implementations
●
Thing
●
Node-Wot
●
...
7
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Project
Things
by
8
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Mozilla’s IoT Project Things Overview
●
Framework of software/services
– for connecting "things" to the web
●
Things Model: Semantic to describe things’ properties
●
WebThings: provide Http(s) REST API
●
Gateway to connect WebThings
– Rule engine and nice Web UI (PWA)
●
Cloud: Remote access facilities (opt.)
9
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
W3C WebThing model & Thing Description
●
Models complies to W3C schemas served on HTTP
– using Javascript, C/C++, Rust, Python, uPython etc…
●
Actuator example: RGB Lamp (webthing-ardiuno/example)
curl http://esp8266.local
[{"name":"Dimmable Color Light", "type":"dimmableColorLight",
"href":"/things/dimmable-color-light",
"properties":{"on":{"type":"boolean", "href":
"/things/dimmable-color-light/properties/on"},
"level":{"type":"number", "href":
"/things/dimmable-color-light/properties/level"},
"color":{"type":"string", "href":
"/things/dimmable-color-light/properties/color"}}
}]
Names
= endpoints
10
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Mozilla IoT gateway
●
Connects all webthings locally:
– IP (WiFi, Eth), BT, Zigbee, Z-Wave...
●
Provides progressive web app:
– To monitor and control things
●
Users management:
– Access control using JsonWebToken
●
Optional remote control using proxy:
– LetsEncrypt certs + PageKite tunnel
●
Extensible using add-ons
– Adapters for other protocols/ecosystems
11
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Setup Mozilla IoT gateway
●
Reference image for RPi
– Dump Raspbian image to SD
●
Or rebuild on any GNU/Linux
– 0.6.x version uses Node-8 (LTS 2017)
– container (node/debian)
●
ARTIK710 dev board:
– WiFi, Eth, BT, Zigbee, Thread
– GPIO, ADC, UART, PWM...
– User Buttons and LED
●
710 (+530) can be also supported
– With Node-10 (LTS 2018)
– Using nvm or
https://github.com/rzr/webthing-iotjs/wiki/Gateway
12
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Sharing flow between owner and user
●
Owner setup gateway (connect lamp):
– create and allow user(s) to control thing
●
User login to GW using OAuth (JWT issued)
gateway="https://sosg.mozilla-iot.org" or "gateway.local"
thing="things/http---esp8266.local-things-dimmable-color-lamp"
property="properties/color"
curl "$gateway/$thing/$property" 
-H "$auth" 
-H 'Accept: application/json' {"color":"#ffff6f"}
← Or use alternative app: webthings-webapp:
Tizen or Android/SamsungInternet (PWA)
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
13
“Simplicity
is prerequisite for reliability.”
~Edsger W. Dijkstra
14
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
IoT Problems and Solutions
●
Constrained IoT devices:
– Cloud connected
●
Privacy issues
– Easy to prototype: (Arduino...)
– Harder to deploy at scale
●
Limited on resources
●
Native development
– on many RTOS
●
Few experts developers
●
Technical strategies:
– Edge computing
●
Data stay on nodes or in LAN
– Abstraction with high level API
●
Port runtimes not apps code
– Portability and standards
●
Script languages for MCU
– JavaScript, Python, LUA…
●
Target existing developers base
15
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
JavaScript: Language of the Web for IoT ?
●
JavaScript is everywhere!
●
Many web developers:
– So many application developers
●
Few embedded developers
– To focus more on runtime or app engines:
●
For high end & low end (MCU)
●
Standardized (ECMA)
●
Established communities:
–
"Any application
that can be written in JavaScript,
will eventually be written in JavaScript"
~Jeff Atwood
Over
837K
Modules!
(2019-11-15)
…
But
relative
quality !
16
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
IoT.js runtime use JerryScript engine
●
Lightweight JavaScript engine
– Supports constrained devices
●
<64 KB RAM & <200 KB ROM
– On-device compilation, exec
●
Complies ECMAScript 5.1 std
●
FLOSS: Apache-2.0, (C) JSF
●
https://JerryScript.net
●
IoT.js is JavaScript framework
– for Internet of Things
●
Features: GPIO, I2C, app protocols...
– built on 'JerryScript'
– event driven using libtuv
●
non-blocking I/O model
●
Inspired by Node.js’s runtime
– Node is built on V8 interpreter
– IoT.js is smaller and faster for MCUs
Supporting: GNU/Linux, Tizen, TizenRT, NuttX and more…
(Prototype on desktop, deploy to contrained devices)
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
17
A modular architecture for JS IoT apps
Hardware
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
18
“The secret of getting ahead
is getting started.”
~ Mark Twain
19
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Installing IoT.js runtime for webthings
●
Install from or GNU/Linux
– Rebuild from sources
●
https://github.com/Samsung/iotjs
– Or download snapshot .deb:
●
For for (RPi 0+) or
●
Write hello world & evaluate it:
Hello IoT.js
{
"env": { //...
"IOTJS_ENV": "",
"IOTJS_EXTRA_MODULE_PATH":""
},
"builtin_modules": { //...
"platform": "linux", (...) }
"iotjs": {
"board": ""
},
"argv": [
"iotjs",
"demo.js"
],
// (...)
}
● cat demo.js
console.log(“Hello IoT.js”)
console.log(process)
● iotjs demo.js
https://github.com/rzr/webthing-iotjs/wiki/IotJs
20
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
WebThing-IoT.js to power WebThings on IoT.js
●
Fork of webthing-node
– for IoT.js runtime (On JerryScript)
– Transpilation from modern JS
●
to ES5.1 (using Babel.js)
– Some parts removed:
●
mDNS, Websockets
●
actions, events…
– Continuously rebasing
– Supports:
●
GNU/Linux, Tizen, TizenRT
●
Aligning IoT.js to :
– For API, IO drivers, NPM modules:
●
GPIO, ADC
– Compatible examples:
●
SingleBoard Computers’s IO (PHats)
●
Sensors (I2C) & Actuators
21
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Try Webthing-iotjs’s simplest sensor:
● var thing = new Thing('SensorExample',
['MultiLevelSensor']);
● this.level = new Value(0);
● thing.addProperty(
new Property(thing, 'level',
this.level,
{label:'Level', type:'number'}
);
● var server = new WebThingServer
(new SingleThing(thing));
● server.start();
● (...)
● this.level.notifyOfExternalUpdate(42);
●
Show thing’s description:
– properties listed as JSON (REST):
curl 
-H 'Content-Type: application/json' 
http://localhost:8888
{"name":"SensorExample",...
"properties":{"level":{"type":"number", ... }
●
Get Property on property’s endpoint:
curl 
-H 'Content-Type: application/json' 
http://localhost:8888/properties/level
{"level":42}
Name
(=
endpoint)
22
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Try Webthing-iotjs’s simplest actuator:
● var thing = new Thing
('ActuatorExample',['OnOffSwitch'];
● thing.addProperty(
new Property(thing, 'on',
new Value(true, function(data){
console.log(Boolean(data));
}),
{label:'On/Off', type:'boolean'}
);
● var server = new WebThingServer
(new SingleThing(thing));
● server.start();
●
Run application from sources:
iotjs example/simplest-thing.js [port]
●
Set Property value (using HTTP):
curl -X PUT 
-H 'Content-Type: application/json'
--data '{"on":false}' 
http://localhost:8888/properties/on
{"on":false}Callback
Capabilties
23
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Real world use cases and more...
●
GenericSensorsLite module to build webthings
– Based on specification (for browsers)
– Abstract I2C Drivers
●
using NPM community modules
– Cross engine compatible: IoT.js, Node.js (NPM)
– High level concepts: AmbientLight, Temperature…
– Also supported on gateway as addon adaper
– More: https://github.com/rzr/webthing-iotjs/wiki/Sensor
●
Link any physical or logical component:
– Actuator to be triggered on sensor data using mozilla rule engine
– Social Web Example: MastodonActuator https://github.com/rzr/webthing-iotjs/wiki/Social
24
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
IoT.js modules
●
A repository for IoT.js packages (JS):
– git clone --recursive https://github.com/samsung/iotjs-modules iotjs_modules
– Or clone them individually using git submodules or scripts (GNUmake)
●
Add IoT.js support to existing Node.js packages
– Transpile to ES5.1 if using modern JS standards (use BabelJs.io)
– https://www.npmjs.com/search?q=keywords:iotjs-supported
●
Try to align IoT.js ↔Node.js APIs to ensure compatibility:
– Prototype on GNU/Linux and then deploy to MCU supporting IoT.js
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
25
“I'm not crazy. My reality
is just different from yours.”
~ Lewis Carroll
26
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
TizenRT extends Tizen ecosystem
●
Tizen
– Is based on Linux Kernel
– Shipped into
●
High end consumer electronics
– Mobile, TV, Wearables etc
– Open to developers
●
Native, C/C++ (EFL)
●
HTML5
●
DotNet
●
TizenRT
– Is based on NuttX Kernel
●
for constrained devices:
– Ie: Cortex M3 (RAM=30KB Flash=512KB)
– For low end IoT devices:
●
Open APIs (C, JavaScript)
●
Connectivity
●
Reliability
●
Security
– Support:
●
Qemu, ARTIK05x...
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
27
TizenRT supports 05X
●
System on module : 053, 053S (5V DC) or 055S (3.3V DC)
●
Dev kits: ARTIK 055S SoM on interposer board:
– 32-bit ARM® Cortex® R4 @ 320MHz
– R for Real Time and safety critical
– S for Secure: SE+TEE, Secure Sub System
●
Crypto (Certs, Key, ECDSA, RNG, PUF), Signed boot loader
– 1280KB RAM, 8MB Flash, WiFi
– IO: GPIO*29, ADC*4, PWM*5, UART*4 (2-pin), SPI*2, I2C*2, I2S
– RTC, JTAG (lock), Arduino header, Extra sensor boards
28
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Integrate WebThing-iotjs app to TizenRT
●
Use my helper scripts (GNU/Linux)
– make demo: build, deploy, monitor
●
Or manually:
– Setup TizenRT’s environment
– Upgrade IoT.js-2018 in TizenRT-2+
– Enable IoT.js launcher task
●
Using menuconfig (Kconfig)
●
Setup main script, PATH,
●
WiFi credentials
– Populate ROM fs with
●
Scripts, iotjs_modules
– Build and deploy static image
●
Connect board from gateway webapp:
https://github.com/rzr/webthing-iotjs/wiki/TizenRT
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
29
“Any sufficiently
advanced technology
is indistinguishable
from magic.”
~ Arthur C. Clarke
30
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Social Web of Things demo (#MozFest)
https://youtu.be/ZT1T-B6I3IM#webthing-iotjs-20181027rzr
31
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Summary: Open Web matters for IoT !
●
Open Web of Things: to link WWW to physical world
●
Mozilla Things framework to connect devices in LAN
●
Privacy Is about user's data control of flows
●
Javascript aims to reduce integration complexity
●
Try webthing-iotjs on GNU/Linux or TizenRT !
●
Support & comply to W3C standards, contribute to FLOSS
32
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Resources
●
Entry point:
– https://github.com/rzr/webthing-iotjs/wiki
●
More:
– https://www.w3.org/WoT/
– https://iot.mozilla.org/
– https://2018.capitoledulibre.org/
●
Keep in touch online:
– https://social.samsunginter.net/@rzr
– https://wiki.tizen.org/User:Pcoval
Resources: flaticons CC
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
33
Questions or Extras ?
https://Social.SamsungInter.net/@rzr
^
(Ask now or later online)
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
34
Generic Sensors addon adapter (I2C)
https://youtu.be/4haKrPetGmg#mozilla-iot-gateway-sensors-20180406rzr
●
mozilla-iot-gateway-sensors-20180406rzr
●
https://youtu.be/4haKrPetGmg
35
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
WebThings Web App (Tizen & PWA)
https://youtu.be/vzoUJ-v5h38#webthing-esp8266-webapp-20180602rzr
https://youtu.be/vzoUJ-v5h38#webthing-esp8266-webapp-20180602rzr
36
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Web of Things Smart Agriculture Demo
https://youtu.be/qrFTn0eA8iQ
37
https://social.samsunginter.net/@rzrSamsung Open Source Group 2018
Thanks !
Resources:
Flaticons CC,
PixBay.com
1 of 37

Recommended

webthing-iotjs-20181027rzr by
webthing-iotjs-20181027rzrwebthing-iotjs-20181027rzr
webthing-iotjs-20181027rzrPhil www.rzr.online.fr
5.9K views38 slides
digital-twins-webthings-iotjs-20190512rzr by
digital-twins-webthings-iotjs-20190512rzrdigital-twins-webthings-iotjs-20190512rzr
digital-twins-webthings-iotjs-20190512rzrPhil www.rzr.online.fr
1.6K views25 slides
aframe-webthing-20190710 by
aframe-webthing-20190710aframe-webthing-20190710
aframe-webthing-20190710Phil www.rzr.online.fr
475 views40 slides
web-of-twins-20190604rzr by
web-of-twins-20190604rzrweb-of-twins-20190604rzr
web-of-twins-20190604rzrPhil www.rzr.online.fr
1.8K views19 slides
Framework for IoT Interoperability by
Framework for IoT InteroperabilityFramework for IoT Interoperability
Framework for IoT InteroperabilitySamsung Open Source Group
8.7K views33 slides
The complex IoT equation, and FLOSS solutions, OW2con'18, June 7-8, 2018, Paris by
The complex IoT equation, and FLOSS solutions, OW2con'18, June 7-8, 2018, ParisThe complex IoT equation, and FLOSS solutions, OW2con'18, June 7-8, 2018, Paris
The complex IoT equation, and FLOSS solutions, OW2con'18, June 7-8, 2018, ParisOW2
93 views23 slides

More Related Content

Similar to webthing-iotjs-tizenrt-cdl2018-20181117rzr

Easy IoT with JavaScript by
Easy IoT with JavaScriptEasy IoT with JavaScript
Easy IoT with JavaScriptSamsung Open Source Group
11.2K views20 slides
wotxr-20190320rzr by
wotxr-20190320rzrwotxr-20190320rzr
wotxr-20190320rzrPhil www.rzr.online.fr
2K views20 slides
IoTivity: From Devices to the Cloud by
IoTivity: From Devices to the CloudIoTivity: From Devices to the Cloud
IoTivity: From Devices to the CloudSamsung Open Source Group
18.3K views28 slides
Connected TIZEN by
Connected TIZENConnected TIZEN
Connected TIZENPôle Systematic Paris-Region
545 views20 slides
Tizen Connected with IoTivity by
Tizen Connected with IoTivityTizen Connected with IoTivity
Tizen Connected with IoTivitySamsung Open Source Group
18.2K views20 slides
IoTivity for Automotive: meta-ocf-automotive tutorial by
IoTivity for Automotive: meta-ocf-automotive tutorialIoTivity for Automotive: meta-ocf-automotive tutorial
IoTivity for Automotive: meta-ocf-automotive tutorialSamsung Open Source Group
12.6K views47 slides

Similar to webthing-iotjs-tizenrt-cdl2018-20181117rzr(20)

IoT: From Arduino Microcontrollers to Tizen Products using IoTivity by Samsung Open Source Group
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp... by WithTheBest
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
WithTheBest360 views
Android Development Workshop by Peter Robinett
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
Peter Robinett14.9K views
Engineering and Industrial Mobile Application (APP) Development by Living Online
Engineering and Industrial Mobile Application (APP) DevelopmentEngineering and Industrial Mobile Application (APP) Development
Engineering and Industrial Mobile Application (APP) Development
Living Online499 views
EclipseCon France 2018 report by Akira Tanaka
EclipseCon France 2018 reportEclipseCon France 2018 report
EclipseCon France 2018 report
Akira Tanaka773 views

More from Phil www.rzr.online.fr

Iot privacy-soscon-2019 by
Iot privacy-soscon-2019Iot privacy-soscon-2019
Iot privacy-soscon-2019Phil www.rzr.online.fr
540 views25 slides
up-down-stream-flows-20190411rzr by
up-down-stream-flows-20190411rzrup-down-stream-flows-20190411rzr
up-down-stream-flows-20190411rzrPhil www.rzr.online.fr
1.6K views19 slides
osvehicle-connected-20160429 by
osvehicle-connected-20160429osvehicle-connected-20160429
osvehicle-connected-20160429Phil www.rzr.online.fr
4.5K views8 slides
tdc2015-strategy-devel-20150916 by
tdc2015-strategy-devel-20150916tdc2015-strategy-devel-20150916
tdc2015-strategy-devel-20150916Phil www.rzr.online.fr
2.4K views21 slides
tizen-maintain-20150413rzr by
tizen-maintain-20150413rzrtizen-maintain-20150413rzr
tizen-maintain-20150413rzrPhil www.rzr.online.fr
621 views27 slides
Iotivity atmel-20150328rzr by
Iotivity atmel-20150328rzrIotivity atmel-20150328rzr
Iotivity atmel-20150328rzrPhil www.rzr.online.fr
5.6K views9 slides

More from Phil www.rzr.online.fr(16)

FOSDEM2015: Porting Tizen:Common to open source hardware devices by Phil www.rzr.online.fr
FOSDEM2015: Porting Tizen:Common to open source hardware devicesFOSDEM2015: Porting Tizen:Common to open source hardware devices
FOSDEM2015: Porting Tizen:Common to open source hardware devices

Recently uploaded

HTTP headers that make your website go faster - devs.gent November 2023 by
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023Thijs Feryn
28 views151 slides
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITShapeBlue
91 views8 slides
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineShapeBlue
102 views19 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
58 views21 slides
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院IttrainingIttraining
80 views8 slides
Business Analyst Series 2023 - Week 3 Session 5 by
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
369 views20 slides

Recently uploaded(20)

HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn28 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue91 views
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online by ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue102 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10369 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue77 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson133 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue88 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi141 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue50 views
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue83 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue57 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu141 views

webthing-iotjs-tizenrt-cdl2018-20181117rzr

  • 1. 1 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Webthings Using IoT.js for RT on boards #CDL2018, Capitole du libre ENSEEIHT, Toulouse, France <2018-11-18> Philippe Coval <p.coval@samsung.com> Samsung Open Source Group / SRUK
  • 2. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 2 Hello world, $who am I ? ● Philippe Coval – Belongs to Samsung Research UK ● in OpenSource group – French ● from Toulouse then Rennes ● Interests: – Libre Soft/Hard/ware communities – Embedded, IoT, Web, DIY… Need help? Ping me online: http://social.samsunginter.net/@rzr
  • 3. 3 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Agenda ● Context: – IoT status, Privacy matters ! – Motivations for Web of Thing ● Mozilla Webthings framework ● Connecting constrained IoT devices – Easily with JavaScript!
  • 4. 4 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 IoT status ● The Internet of Things is a system of physical objects – that can be discovered, monitored, controlled, – or interacted with by electronic devices – that communicate over various networking interfaces ● and eventually can be connected to the wider Internet. ● Addresses many domains: – Health, Agriculture, Transport, Cities, Industry ● Critical in many cases: Need to Secure & Privacy Proof
  • 5. 5 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Privacy is about Trust and Control ● Ownership of personal data – Shared, Transferred, Revoked, Logged, Retrieved and DELETED ● depend on time and context ● Services operators should comply regulations: – EU: General Data Protection Regulation (GDPR 2018) ● Threat to privacy in the IoT is HIGH!!! ● “Privacy by design” opportunities – Prevent data collection in first place→Keep data local if possible ● Limit usage of cloud, apps or “captive models” – New security challenges (Decentralize, reduce surface of attacks)
  • 6. 6 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Motivations for Open Web Of Things ● Open web platform promises: – Security (isolation in browser) – Enhanced privacy (DNT) ● Security is not same as Privacy ! ● Think decentralized ! – may be harder to secure ● but more resilient – Edge: Computation on nodes ● Web of Things (WoT) – An application layer for IoT – with interoperability – Specification work by – And FLOSS implementations ● Thing ● Node-Wot ● ...
  • 8. 8 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Mozilla’s IoT Project Things Overview ● Framework of software/services – for connecting "things" to the web ● Things Model: Semantic to describe things’ properties ● WebThings: provide Http(s) REST API ● Gateway to connect WebThings – Rule engine and nice Web UI (PWA) ● Cloud: Remote access facilities (opt.)
  • 9. 9 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 W3C WebThing model & Thing Description ● Models complies to W3C schemas served on HTTP – using Javascript, C/C++, Rust, Python, uPython etc… ● Actuator example: RGB Lamp (webthing-ardiuno/example) curl http://esp8266.local [{"name":"Dimmable Color Light", "type":"dimmableColorLight", "href":"/things/dimmable-color-light", "properties":{"on":{"type":"boolean", "href": "/things/dimmable-color-light/properties/on"}, "level":{"type":"number", "href": "/things/dimmable-color-light/properties/level"}, "color":{"type":"string", "href": "/things/dimmable-color-light/properties/color"}} }] Names = endpoints
  • 10. 10 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Mozilla IoT gateway ● Connects all webthings locally: – IP (WiFi, Eth), BT, Zigbee, Z-Wave... ● Provides progressive web app: – To monitor and control things ● Users management: – Access control using JsonWebToken ● Optional remote control using proxy: – LetsEncrypt certs + PageKite tunnel ● Extensible using add-ons – Adapters for other protocols/ecosystems
  • 11. 11 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Setup Mozilla IoT gateway ● Reference image for RPi – Dump Raspbian image to SD ● Or rebuild on any GNU/Linux – 0.6.x version uses Node-8 (LTS 2017) – container (node/debian) ● ARTIK710 dev board: – WiFi, Eth, BT, Zigbee, Thread – GPIO, ADC, UART, PWM... – User Buttons and LED ● 710 (+530) can be also supported – With Node-10 (LTS 2018) – Using nvm or https://github.com/rzr/webthing-iotjs/wiki/Gateway
  • 12. 12 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Sharing flow between owner and user ● Owner setup gateway (connect lamp): – create and allow user(s) to control thing ● User login to GW using OAuth (JWT issued) gateway="https://sosg.mozilla-iot.org" or "gateway.local" thing="things/http---esp8266.local-things-dimmable-color-lamp" property="properties/color" curl "$gateway/$thing/$property" -H "$auth" -H 'Accept: application/json' {"color":"#ffff6f"} ← Or use alternative app: webthings-webapp: Tizen or Android/SamsungInternet (PWA)
  • 13. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 13 “Simplicity is prerequisite for reliability.” ~Edsger W. Dijkstra
  • 14. 14 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 IoT Problems and Solutions ● Constrained IoT devices: – Cloud connected ● Privacy issues – Easy to prototype: (Arduino...) – Harder to deploy at scale ● Limited on resources ● Native development – on many RTOS ● Few experts developers ● Technical strategies: – Edge computing ● Data stay on nodes or in LAN – Abstraction with high level API ● Port runtimes not apps code – Portability and standards ● Script languages for MCU – JavaScript, Python, LUA… ● Target existing developers base
  • 15. 15 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 JavaScript: Language of the Web for IoT ? ● JavaScript is everywhere! ● Many web developers: – So many application developers ● Few embedded developers – To focus more on runtime or app engines: ● For high end & low end (MCU) ● Standardized (ECMA) ● Established communities: – "Any application that can be written in JavaScript, will eventually be written in JavaScript" ~Jeff Atwood Over 837K Modules! (2019-11-15) … But relative quality !
  • 16. 16 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 IoT.js runtime use JerryScript engine ● Lightweight JavaScript engine – Supports constrained devices ● <64 KB RAM & <200 KB ROM – On-device compilation, exec ● Complies ECMAScript 5.1 std ● FLOSS: Apache-2.0, (C) JSF ● https://JerryScript.net ● IoT.js is JavaScript framework – for Internet of Things ● Features: GPIO, I2C, app protocols... – built on 'JerryScript' – event driven using libtuv ● non-blocking I/O model ● Inspired by Node.js’s runtime – Node is built on V8 interpreter – IoT.js is smaller and faster for MCUs Supporting: GNU/Linux, Tizen, TizenRT, NuttX and more… (Prototype on desktop, deploy to contrained devices)
  • 17. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 17 A modular architecture for JS IoT apps Hardware
  • 18. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 18 “The secret of getting ahead is getting started.” ~ Mark Twain
  • 19. 19 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Installing IoT.js runtime for webthings ● Install from or GNU/Linux – Rebuild from sources ● https://github.com/Samsung/iotjs – Or download snapshot .deb: ● For for (RPi 0+) or ● Write hello world & evaluate it: Hello IoT.js { "env": { //... "IOTJS_ENV": "", "IOTJS_EXTRA_MODULE_PATH":"" }, "builtin_modules": { //... "platform": "linux", (...) } "iotjs": { "board": "" }, "argv": [ "iotjs", "demo.js" ], // (...) } ● cat demo.js console.log(“Hello IoT.js”) console.log(process) ● iotjs demo.js https://github.com/rzr/webthing-iotjs/wiki/IotJs
  • 20. 20 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 WebThing-IoT.js to power WebThings on IoT.js ● Fork of webthing-node – for IoT.js runtime (On JerryScript) – Transpilation from modern JS ● to ES5.1 (using Babel.js) – Some parts removed: ● mDNS, Websockets ● actions, events… – Continuously rebasing – Supports: ● GNU/Linux, Tizen, TizenRT ● Aligning IoT.js to : – For API, IO drivers, NPM modules: ● GPIO, ADC – Compatible examples: ● SingleBoard Computers’s IO (PHats) ● Sensors (I2C) & Actuators
  • 21. 21 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Try Webthing-iotjs’s simplest sensor: ● var thing = new Thing('SensorExample', ['MultiLevelSensor']); ● this.level = new Value(0); ● thing.addProperty( new Property(thing, 'level', this.level, {label:'Level', type:'number'} ); ● var server = new WebThingServer (new SingleThing(thing)); ● server.start(); ● (...) ● this.level.notifyOfExternalUpdate(42); ● Show thing’s description: – properties listed as JSON (REST): curl -H 'Content-Type: application/json' http://localhost:8888 {"name":"SensorExample",... "properties":{"level":{"type":"number", ... } ● Get Property on property’s endpoint: curl -H 'Content-Type: application/json' http://localhost:8888/properties/level {"level":42} Name (= endpoint)
  • 22. 22 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Try Webthing-iotjs’s simplest actuator: ● var thing = new Thing ('ActuatorExample',['OnOffSwitch']; ● thing.addProperty( new Property(thing, 'on', new Value(true, function(data){ console.log(Boolean(data)); }), {label:'On/Off', type:'boolean'} ); ● var server = new WebThingServer (new SingleThing(thing)); ● server.start(); ● Run application from sources: iotjs example/simplest-thing.js [port] ● Set Property value (using HTTP): curl -X PUT -H 'Content-Type: application/json' --data '{"on":false}' http://localhost:8888/properties/on {"on":false}Callback Capabilties
  • 23. 23 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Real world use cases and more... ● GenericSensorsLite module to build webthings – Based on specification (for browsers) – Abstract I2C Drivers ● using NPM community modules – Cross engine compatible: IoT.js, Node.js (NPM) – High level concepts: AmbientLight, Temperature… – Also supported on gateway as addon adaper – More: https://github.com/rzr/webthing-iotjs/wiki/Sensor ● Link any physical or logical component: – Actuator to be triggered on sensor data using mozilla rule engine – Social Web Example: MastodonActuator https://github.com/rzr/webthing-iotjs/wiki/Social
  • 24. 24 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 IoT.js modules ● A repository for IoT.js packages (JS): – git clone --recursive https://github.com/samsung/iotjs-modules iotjs_modules – Or clone them individually using git submodules or scripts (GNUmake) ● Add IoT.js support to existing Node.js packages – Transpile to ES5.1 if using modern JS standards (use BabelJs.io) – https://www.npmjs.com/search?q=keywords:iotjs-supported ● Try to align IoT.js ↔Node.js APIs to ensure compatibility: – Prototype on GNU/Linux and then deploy to MCU supporting IoT.js
  • 25. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 25 “I'm not crazy. My reality is just different from yours.” ~ Lewis Carroll
  • 26. 26 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 TizenRT extends Tizen ecosystem ● Tizen – Is based on Linux Kernel – Shipped into ● High end consumer electronics – Mobile, TV, Wearables etc – Open to developers ● Native, C/C++ (EFL) ● HTML5 ● DotNet ● TizenRT – Is based on NuttX Kernel ● for constrained devices: – Ie: Cortex M3 (RAM=30KB Flash=512KB) – For low end IoT devices: ● Open APIs (C, JavaScript) ● Connectivity ● Reliability ● Security – Support: ● Qemu, ARTIK05x...
  • 27. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 27 TizenRT supports 05X ● System on module : 053, 053S (5V DC) or 055S (3.3V DC) ● Dev kits: ARTIK 055S SoM on interposer board: – 32-bit ARM® Cortex® R4 @ 320MHz – R for Real Time and safety critical – S for Secure: SE+TEE, Secure Sub System ● Crypto (Certs, Key, ECDSA, RNG, PUF), Signed boot loader – 1280KB RAM, 8MB Flash, WiFi – IO: GPIO*29, ADC*4, PWM*5, UART*4 (2-pin), SPI*2, I2C*2, I2S – RTC, JTAG (lock), Arduino header, Extra sensor boards
  • 28. 28 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Integrate WebThing-iotjs app to TizenRT ● Use my helper scripts (GNU/Linux) – make demo: build, deploy, monitor ● Or manually: – Setup TizenRT’s environment – Upgrade IoT.js-2018 in TizenRT-2+ – Enable IoT.js launcher task ● Using menuconfig (Kconfig) ● Setup main script, PATH, ● WiFi credentials – Populate ROM fs with ● Scripts, iotjs_modules – Build and deploy static image ● Connect board from gateway webapp: https://github.com/rzr/webthing-iotjs/wiki/TizenRT
  • 29. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 29 “Any sufficiently advanced technology is indistinguishable from magic.” ~ Arthur C. Clarke
  • 30. 30 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Social Web of Things demo (#MozFest) https://youtu.be/ZT1T-B6I3IM#webthing-iotjs-20181027rzr
  • 31. 31 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Summary: Open Web matters for IoT ! ● Open Web of Things: to link WWW to physical world ● Mozilla Things framework to connect devices in LAN ● Privacy Is about user's data control of flows ● Javascript aims to reduce integration complexity ● Try webthing-iotjs on GNU/Linux or TizenRT ! ● Support & comply to W3C standards, contribute to FLOSS
  • 32. 32 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Resources ● Entry point: – https://github.com/rzr/webthing-iotjs/wiki ● More: – https://www.w3.org/WoT/ – https://iot.mozilla.org/ – https://2018.capitoledulibre.org/ ● Keep in touch online: – https://social.samsunginter.net/@rzr – https://wiki.tizen.org/User:Pcoval Resources: flaticons CC
  • 33. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 33 Questions or Extras ? https://Social.SamsungInter.net/@rzr ^ (Ask now or later online)
  • 34. https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 34 Generic Sensors addon adapter (I2C) https://youtu.be/4haKrPetGmg#mozilla-iot-gateway-sensors-20180406rzr ● mozilla-iot-gateway-sensors-20180406rzr ● https://youtu.be/4haKrPetGmg
  • 35. 35 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 WebThings Web App (Tizen & PWA) https://youtu.be/vzoUJ-v5h38#webthing-esp8266-webapp-20180602rzr https://youtu.be/vzoUJ-v5h38#webthing-esp8266-webapp-20180602rzr
  • 36. 36 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Web of Things Smart Agriculture Demo https://youtu.be/qrFTn0eA8iQ
  • 37. 37 https://social.samsunginter.net/@rzrSamsung Open Source Group 2018 Thanks ! Resources: Flaticons CC, PixBay.com