IoT-javascript-2019-fosdem

Phil www.rzr.online.fr
Phil www.rzr.online.frSr Software Enginner at Undisclosed
Bring JavaScript to the Internet of
Things - From Embedded Device to Smart
Gateway
Ziran Sun ( ziran.sun@samsung.com)
Philippe Coval (p.coval@samsung.com)
Samsung Research, UK
Feb, 2019
FOSDEM, Brussels
1. Why JavaScript in IoT?
2. JavaScript on Embedded Device
a. Ultra-Light JS Engine - JerryScript
b. IoT Platforms on JerryScript
3. JavaScript on Smart Gateway
4. Put It Together - A Simple Demo
5. WebThings API
6. There Are MORE You Can Do...
Contents
1. Why JavaScript in IoT?
JavaScript is a good fit for IoT:
● Popularity
● Maturity
● Productivity
“Any application that can be written in JavaScript will eventually be written in
JavaScript.” - Jeff Atwood
2. JavaScript on Embedded
Device
IoT HardWare [1]
(Table credit to Tilmann Scheller)
2a. Ultra-light JS Engine
-JerryScript by Samsung
JerryScript
● An ultra lightweight JavaScript engine (<64KB RAM, <200 KB ROM,
160KB binary size compiled for ARM Thumb-2)
● Originally developed from scratch by Samsung
● Transferred to JS Foundation in 2016 (https://js.foundation/)
● Self-contained and extremely portable
● Mature C API, easy to embed in applications
JerryScript
● Optimization and performance have been top priorities
● Adding new features:
– Jerry-debugger
– ES6 related features
– More hardware and OS supports
● Fast growing community
ESP8266 ARM MBED STM32F4 discovery
Board with Nuttx, RIOT
OpenWrt
Particle firmware on
Photon board
TizenRT on
ARTIK 05x
Hardware and OS Supports (JerryScript Github)
Zephyr OS on
Arduino 101
Raspberry Pi 2
JerryScript in Smartwatch [2]
2b. IoT platforms based on
JerryScript
IoT JavaScript Platforms based on JerryScript
● IoT.js by Samsung
a. Lightweight version of node.js for constrained devices
b. Hardware and OS supports are well inline with JerryScript.
● Zephyr.js by Intel
a. JavaScript* Runtime for Zephyr OS
b. Node.js* like APIs
3. JavaScript on Smart
Gateway
Things Gateway By Mozilla [4]
Project Things
(Diagram credit to Ben Francis)
Things Gateway - Security
● HTTPS via mozilla-iot.org tunnelling service
a. Allow setting up a secure subdomains with
LetsEncrypt TLS certificates
b. TCP tunnel uses PageKite from Mozilla cloud
server to Gateway
● OAuth to authorise third party apps & services
● JSON Web Tokens (JWT) used for authentication
4. Put it Together - A
Simple Demo
Turn on your light by clapping hands
https://vimeo.com/user90242752/review/293325534/5d519c4bc7
Demo video
Software on Device
5. WebThings API
WebThings API
● Thing: standalone HTTP server (+Websockets)
○ REST Endpoints (for gateway’s interaction):
■ Things / Properties / Values
■ Plus Actions & Events
○ Models are described using schemas (JSON)
● Several Technologies:
○ JavaScript: using Node.js or IoT.js
○ Native (C++), Python (& uPy), RUST…
WebThings-IoT.js
● Fork of webthing-node for IoT.js runtime
○ Port to older ECMAScript 5.1
○ Backward compatible for Node.JS
● Support: ADC, GPIO (+ some NPMs)
● Some features not yet implemented:
○ Websockets for real time (events & actions)
○ mDNS for discovery
● https://www.npmjs.com/package/webthing-iotjs
Implementing a Webthing server:
var webthing = require('webthing-iotjs');
var thing = new webthing.Thing(‘SomeSensor’);
var server = new webthing.WebThingServer
(new webthing.SingleThing(thing), 8888);
server.start();
$ curl http://localhost:8888
{ "name":"SomeSensor", "href":"/",
"@context":"https://iot.mozilla.org/schemas",
"@type":[null],
"properties":{},
"links":[{"rel":"properties","href":"/properties"}]}
Color as webthing property:
function ColorProperty(thing) {
webthing.Property.call(this, thing, 'Color',
new webthing.Value(‘#000000’),
{ '@type': 'ColorProperty', type: 'string',
readOnly: true });
}
//…
var thing = new webthing.Thing(‘ColorSensor’,
[‘ColorControl’]);
thing.addProperty(new ColorProperty(thing));
//…
server.start();
$ curl http://localhost:8888
{ ...
"properties":{"Color": ...
"links":[
{"rel":"property",
"href":"/properties/Color"
…
Sensor updating webthing
var ColorSensor = require('color-sensor-js/example’); // H.A.L.
function ColorProperty(thing) {
var self = this;
Webthing.Property.call(..., 'Color', new webthing.Value...
this.sensor = new ColorSensor();
this.sensor.onreading = function() {
self.value.notifyOfExternalUpdate(self.sensor.color);
};
this.sensor.start();
}
// More hints: https://github.com/rzr/webthing-iotjs/wiki/Sensor
$ curl http://localhost:8888/properties/Color
{"Color":”#af0695”}
6. There are more you can do...
Live demo !
https://youtu.be/OT0Ahuy3Cv4#webthing-iotjs-opendata-20190202rzr
Extra demos
● Tutorial & Demo recipes:
○ https://github.com/rzr/webthing-iotjs/wiki
● Alternative browser using TAU framework
○ For Tizen or as Progressive Web App:
■ supported by SamsungInternet (Android)
● From IoT to Social Web:
○ using mastodon-lite, IoT.js/Node.js module
● MCU: TizenRT and hints (STM, ESP, Arduino)
WebThing-IoT.js on TizenRT
https://youtu.be/ZT1T-B6I3IM#webthing-iotjs-20181027rzr
WebThing-IoT.js on TizenRT
https://youtu.be/vzoUJ-v5h38#webthing-esp8266-webapp-20180602rzr
Bridge Web to any framework ?
https://youtu.be/k4C9FmsXV30#webthing-iotivity-cdl2018-20181118rzr
Websockets for real time feedback to WebApp
https://youtu.be/xI6eweCZLe8/#web-iot-automotive-20180315rzr
Thank You!
References:
1. “Introduction to IoT.js’,Tillman Scheller, OpenIoT & ELC 2016, San
Diego, CA, Apr 2016..
2. “Fitbit loves JerryScript: JavaScript Breaks into the Internet of
Things”, Michelle Gienow,
https://thenewstack.io/fitbit-%E2%9D%A4%EF%B8%8Fs-jerryscri
pt-javascript-breaks-internet-things/
3. “IoT.js and JerryScript: a JS platform for the embedded world”, Zoltan
Herczeg, Hosung Ki, Node Summit 2017
4. “Building the Web of Things”, Ben Francis,
https://hacks.mozilla.org/2017/06/building-the-web-of-things/
1 of 35

Recommended

mozilla-things-fosdem-2019 by
mozilla-things-fosdem-2019mozilla-things-fosdem-2019
mozilla-things-fosdem-2019Phil www.rzr.online.fr
2.3K views28 slides
Mirantis OpenStack-DC-Meetup 17 Sept 2014 by
Mirantis OpenStack-DC-Meetup 17 Sept 2014Mirantis OpenStack-DC-Meetup 17 Sept 2014
Mirantis OpenStack-DC-Meetup 17 Sept 2014Mirantis
6.8K views69 slides
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN by
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDNOpenStack Korea Community
10.8K views27 slides
Mirantis OpenStack 5.0 Overview by
Mirantis OpenStack 5.0 OverviewMirantis OpenStack 5.0 Overview
Mirantis OpenStack 5.0 OverviewMirantis
2.5K views18 slides
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Era by
NATS: Simple, Secure and Scalable Messaging For the Cloud Native EraNATS: Simple, Secure and Scalable Messaging For the Cloud Native Era
NATS: Simple, Secure and Scalable Messaging For the Cloud Native Erawallyqs
2.5K views48 slides
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan by
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan
Secure Credential Management with CredHub - DaShaun Carter & Sharath Sahadevan VMware Tanzu
963 views27 slides

More Related Content

What's hot

OpenStack Introduction by
OpenStack IntroductionOpenStack Introduction
OpenStack Introductionopenstackindia
49.5K views32 slides
Cloud networking deep dive by
Cloud networking deep diveCloud networking deep dive
Cloud networking deep diveamylynn11
1K views30 slides
Deploying vn fs with kubernetes pods and vms by
Deploying vn fs with kubernetes pods and vmsDeploying vn fs with kubernetes pods and vms
Deploying vn fs with kubernetes pods and vmsLibbySchulze1
64 views24 slides
Introduction to Openstack Network by
Introduction to Openstack NetworkIntroduction to Openstack Network
Introduction to Openstack Networksalv_orlando
2.1K views15 slides
Inside Architecture of Neutron by
Inside Architecture of NeutronInside Architecture of Neutron
Inside Architecture of Neutronmarkmcclain
27K views40 slides
Kubernetes Security Updates from Kubecon 2018 Seattle by
Kubernetes Security Updates from Kubecon 2018 SeattleKubernetes Security Updates from Kubecon 2018 Seattle
Kubernetes Security Updates from Kubecon 2018 SeattleSuraj Deshmukh
484 views20 slides

What's hot(20)

OpenStack Introduction by openstackindia
OpenStack IntroductionOpenStack Introduction
OpenStack Introduction
openstackindia49.5K views
Cloud networking deep dive by amylynn11
Cloud networking deep diveCloud networking deep dive
Cloud networking deep dive
amylynn111K views
Deploying vn fs with kubernetes pods and vms by LibbySchulze1
Deploying vn fs with kubernetes pods and vmsDeploying vn fs with kubernetes pods and vms
Deploying vn fs with kubernetes pods and vms
LibbySchulze164 views
Introduction to Openstack Network by salv_orlando
Introduction to Openstack NetworkIntroduction to Openstack Network
Introduction to Openstack Network
salv_orlando2.1K views
Inside Architecture of Neutron by markmcclain
Inside Architecture of NeutronInside Architecture of Neutron
Inside Architecture of Neutron
markmcclain27K views
Kubernetes Security Updates from Kubecon 2018 Seattle by Suraj Deshmukh
Kubernetes Security Updates from Kubecon 2018 SeattleKubernetes Security Updates from Kubecon 2018 Seattle
Kubernetes Security Updates from Kubecon 2018 Seattle
Suraj Deshmukh484 views
Networking For Nested Containers: Magnum, Kuryr, Neutron Integration by Fawad Khaliq
Networking For Nested Containers: Magnum, Kuryr, Neutron IntegrationNetworking For Nested Containers: Magnum, Kuryr, Neutron Integration
Networking For Nested Containers: Magnum, Kuryr, Neutron Integration
Fawad Khaliq941 views
Istio (service mesh) why and how by Milan Das
Istio (service mesh) why and howIstio (service mesh) why and how
Istio (service mesh) why and how
Milan Das254 views
OpenStack Neutron Havana Overview - Oct 2013 by Edgar Magana
OpenStack Neutron Havana Overview - Oct 2013OpenStack Neutron Havana Overview - Oct 2013
OpenStack Neutron Havana Overview - Oct 2013
Edgar Magana15.7K views
Introducing OpenStack for Beginners by openstackindia
Introducing OpenStack for Beginners Introducing OpenStack for Beginners
Introducing OpenStack for Beginners
openstackindia9.1K views
Intro to creating kubernetes operators by Juraj Hantak
Intro to creating kubernetes operators Intro to creating kubernetes operators
Intro to creating kubernetes operators
Juraj Hantak364 views
CoreOS Battle Stories by Kontena, Inc.
CoreOS Battle StoriesCoreOS Battle Stories
CoreOS Battle Stories
Kontena, Inc.1.2K views
MQTT - REST Bridge using the Smart Object API by Michael Koster
MQTT - REST Bridge using the Smart Object APIMQTT - REST Bridge using the Smart Object API
MQTT - REST Bridge using the Smart Object API
Michael Koster13.3K views
Cncf storage-final-filip by Juraj Hantak
Cncf storage-final-filipCncf storage-final-filip
Cncf storage-final-filip
Juraj Hantak121 views
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu... by Cloud Native Day Tel Aviv
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
OpenStack Israel Meetup - Project Kuryr: Bringing Container Networking to Neu...
How to deal second interface service discovery and load balancer in kubernetes by Meng-Ze Lee
How to deal second interface  service discovery and load balancer  in kubernetesHow to deal second interface  service discovery and load balancer  in kubernetes
How to deal second interface service discovery and load balancer in kubernetes
Meng-Ze Lee1.5K views
Slow things down to make them go faster [FOSDEM 2022] by Jimmy Angelakos
Slow things down to make them go faster [FOSDEM 2022]Slow things down to make them go faster [FOSDEM 2022]
Slow things down to make them go faster [FOSDEM 2022]
Jimmy Angelakos333 views

Similar to IoT-javascript-2019-fosdem

Node azure by
Node azureNode azure
Node azureEmanuele DelBono
1.6K views66 slides
An Introduction to Node.js Development with Windows Azure by
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureTroy Miles
1.2K views26 slides
Netflix oss season 1 episode 3 by
Netflix oss season 1 episode 3 Netflix oss season 1 episode 3
Netflix oss season 1 episode 3 Ruslan Meshenberg
154.2K views54 slides
Deep dive into serverless on Google Cloud by
Deep dive into serverless on Google CloudDeep dive into serverless on Google Cloud
Deep dive into serverless on Google CloudBret McGowen - NYC Google Developer Advocate
153 views101 slides
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking by
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingIstanbul Tech Talks
343 views39 slides
Node js by
Node jsNode js
Node jsChirag Parmar
2.9K views28 slides

Similar to IoT-javascript-2019-fosdem(20)

An Introduction to Node.js Development with Windows Azure by Troy Miles
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
Troy Miles1.2K views
Netflix oss season 1 episode 3 by Ruslan Meshenberg
Netflix oss season 1 episode 3 Netflix oss season 1 episode 3
Netflix oss season 1 episode 3
Ruslan Meshenberg154.2K views
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking by Istanbul Tech Talks
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better NetworkingITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
ITT 2014 - Erik Hellmann - Android Programming - Smarter and Better Networking
Event-driven IO server-side JavaScript environment based on V8 Engine by Ricardo Silva
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva4.1K views
DIY: Computer Vision with GWT. by JooinK
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
JooinK1.1K views
DIY- computer vision with GWT by Francesca Tosi
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
Francesca Tosi406 views
IDEALIZE 2023 - NodeJS & Firebase Session by Brion Mario
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
Brion Mario8 views
Nodejs and WebSockets by Gonzalo Ayuso
Nodejs and WebSocketsNodejs and WebSockets
Nodejs and WebSockets
Gonzalo Ayuso13.5K views
Tech io nodejs_20130531_v0.6 by Ganesh Kondal
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
Ganesh Kondal1.4K views
Real-time Chat Backend on AWS IoT 20160422 by akitsukada
Real-time Chat Backend on AWS IoT 20160422Real-time Chat Backend on AWS IoT 20160422
Real-time Chat Backend on AWS IoT 20160422
akitsukada5.8K views
Practical Use of MongoDB for Node.js by async_io
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io19.9K views
Building AR and VR Experiences for Web Apps with JavaScript by FITC
Building AR and VR Experiences for Web Apps with JavaScriptBuilding AR and VR Experiences for Web Apps with JavaScript
Building AR and VR Experiences for Web Apps with JavaScript
FITC1.2K 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
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
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
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
wotxr-20190320rzr by
wotxr-20190320rzrwotxr-20190320rzr
wotxr-20190320rzrPhil www.rzr.online.fr
2K views20 slides

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

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

Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...ShapeBlue
154 views62 slides
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
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 CiscoLiveNetwork Automation Forum
50 views35 slides
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
138 views18 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
197 views13 slides
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...ShapeBlue
132 views15 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built EnvironmentIES VE
69 views20 slides

Recently uploaded(20)

Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue154 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
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue138 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue197 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue132 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE69 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue88 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10126 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue163 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu365 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty62 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue85 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...
ShapeBlue117 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue210 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 - ...
ShapeBlue146 views

IoT-javascript-2019-fosdem

  • 1. Bring JavaScript to the Internet of Things - From Embedded Device to Smart Gateway Ziran Sun ( ziran.sun@samsung.com) Philippe Coval (p.coval@samsung.com) Samsung Research, UK Feb, 2019 FOSDEM, Brussels
  • 2. 1. Why JavaScript in IoT? 2. JavaScript on Embedded Device a. Ultra-Light JS Engine - JerryScript b. IoT Platforms on JerryScript 3. JavaScript on Smart Gateway 4. Put It Together - A Simple Demo 5. WebThings API 6. There Are MORE You Can Do... Contents
  • 4. JavaScript is a good fit for IoT: ● Popularity ● Maturity ● Productivity “Any application that can be written in JavaScript will eventually be written in JavaScript.” - Jeff Atwood
  • 5. 2. JavaScript on Embedded Device
  • 6. IoT HardWare [1] (Table credit to Tilmann Scheller)
  • 7. 2a. Ultra-light JS Engine -JerryScript by Samsung
  • 8. JerryScript ● An ultra lightweight JavaScript engine (<64KB RAM, <200 KB ROM, 160KB binary size compiled for ARM Thumb-2) ● Originally developed from scratch by Samsung ● Transferred to JS Foundation in 2016 (https://js.foundation/) ● Self-contained and extremely portable ● Mature C API, easy to embed in applications
  • 9. JerryScript ● Optimization and performance have been top priorities ● Adding new features: – Jerry-debugger – ES6 related features – More hardware and OS supports ● Fast growing community
  • 10. ESP8266 ARM MBED STM32F4 discovery Board with Nuttx, RIOT OpenWrt Particle firmware on Photon board TizenRT on ARTIK 05x Hardware and OS Supports (JerryScript Github) Zephyr OS on Arduino 101 Raspberry Pi 2
  • 12. 2b. IoT platforms based on JerryScript
  • 13. IoT JavaScript Platforms based on JerryScript ● IoT.js by Samsung a. Lightweight version of node.js for constrained devices b. Hardware and OS supports are well inline with JerryScript. ● Zephyr.js by Intel a. JavaScript* Runtime for Zephyr OS b. Node.js* like APIs
  • 14. 3. JavaScript on Smart Gateway
  • 15. Things Gateway By Mozilla [4] Project Things (Diagram credit to Ben Francis)
  • 16. Things Gateway - Security ● HTTPS via mozilla-iot.org tunnelling service a. Allow setting up a secure subdomains with LetsEncrypt TLS certificates b. TCP tunnel uses PageKite from Mozilla cloud server to Gateway ● OAuth to authorise third party apps & services ● JSON Web Tokens (JWT) used for authentication
  • 17. 4. Put it Together - A Simple Demo
  • 18. Turn on your light by clapping hands
  • 22. WebThings API ● Thing: standalone HTTP server (+Websockets) ○ REST Endpoints (for gateway’s interaction): ■ Things / Properties / Values ■ Plus Actions & Events ○ Models are described using schemas (JSON) ● Several Technologies: ○ JavaScript: using Node.js or IoT.js ○ Native (C++), Python (& uPy), RUST…
  • 23. WebThings-IoT.js ● Fork of webthing-node for IoT.js runtime ○ Port to older ECMAScript 5.1 ○ Backward compatible for Node.JS ● Support: ADC, GPIO (+ some NPMs) ● Some features not yet implemented: ○ Websockets for real time (events & actions) ○ mDNS for discovery ● https://www.npmjs.com/package/webthing-iotjs
  • 24. Implementing a Webthing server: var webthing = require('webthing-iotjs'); var thing = new webthing.Thing(‘SomeSensor’); var server = new webthing.WebThingServer (new webthing.SingleThing(thing), 8888); server.start(); $ curl http://localhost:8888 { "name":"SomeSensor", "href":"/", "@context":"https://iot.mozilla.org/schemas", "@type":[null], "properties":{}, "links":[{"rel":"properties","href":"/properties"}]}
  • 25. Color as webthing property: function ColorProperty(thing) { webthing.Property.call(this, thing, 'Color', new webthing.Value(‘#000000’), { '@type': 'ColorProperty', type: 'string', readOnly: true }); } //… var thing = new webthing.Thing(‘ColorSensor’, [‘ColorControl’]); thing.addProperty(new ColorProperty(thing)); //… server.start(); $ curl http://localhost:8888 { ... "properties":{"Color": ... "links":[ {"rel":"property", "href":"/properties/Color" …
  • 26. Sensor updating webthing var ColorSensor = require('color-sensor-js/example’); // H.A.L. function ColorProperty(thing) { var self = this; Webthing.Property.call(..., 'Color', new webthing.Value... this.sensor = new ColorSensor(); this.sensor.onreading = function() { self.value.notifyOfExternalUpdate(self.sensor.color); }; this.sensor.start(); } // More hints: https://github.com/rzr/webthing-iotjs/wiki/Sensor $ curl http://localhost:8888/properties/Color {"Color":”#af0695”}
  • 27. 6. There are more you can do...
  • 29. Extra demos ● Tutorial & Demo recipes: ○ https://github.com/rzr/webthing-iotjs/wiki ● Alternative browser using TAU framework ○ For Tizen or as Progressive Web App: ■ supported by SamsungInternet (Android) ● From IoT to Social Web: ○ using mastodon-lite, IoT.js/Node.js module ● MCU: TizenRT and hints (STM, ESP, Arduino)
  • 32. Bridge Web to any framework ? https://youtu.be/k4C9FmsXV30#webthing-iotivity-cdl2018-20181118rzr
  • 33. Websockets for real time feedback to WebApp https://youtu.be/xI6eweCZLe8/#web-iot-automotive-20180315rzr
  • 35. References: 1. “Introduction to IoT.js’,Tillman Scheller, OpenIoT & ELC 2016, San Diego, CA, Apr 2016.. 2. “Fitbit loves JerryScript: JavaScript Breaks into the Internet of Things”, Michelle Gienow, https://thenewstack.io/fitbit-%E2%9D%A4%EF%B8%8Fs-jerryscri pt-javascript-breaks-internet-things/ 3. “IoT.js and JerryScript: a JS platform for the embedded world”, Zoltan Herczeg, Hosung Ki, Node Summit 2017 4. “Building the Web of Things”, Ben Francis, https://hacks.mozilla.org/2017/06/building-the-web-of-things/