open source tools and frameworks for m2m - sierra wireless developer days
DESCRIPTION
On June 14, 2013 were the first Sierra Wireless Developer Days. This is the presentation I gave about Sierra Wireless Open-Source activities, and the technologies being delivered together with the Eclipse M2M Industry Working Group. Join our developer community at http://developer.sierrawireless.comTRANSCRIPT
Page
Open-source tools and frameworks for M2M
Sierra Wireless Developer Days 2013 Benjamin Cabé
Who I am
• Benjamin Cabé • Open Source M2M Evangelist
• Eclipse M2M IWG chairperson
Topics for this session
• Open-source?
• Eclipse Foundation
• M2M Industry Working Group
• Eclipse M2M projects
• Sierra products built on OSS
50
bil l ion devices by 2020
Smart Pill Box
Heartbeat Sensor
Weight Scale
Blood Pressure
Medical Services Gateway
Near field
Blood Sugar
Internet of Things
Patient
Clinical Trial
Doctor
?
Eclipse is an open source community f o c u s e d o n d e v e l o p i n g a development platform of runtimes, frameworks and exemplary tools that make it easy and cost-effective to build and deploy software solutions.”
“
• 190+ organizations are members of the Eclipse Foundation, working with each other to leverage an open collaboration model, as well as marketing benefits.
• Strategic members:
Eclipse has grown from a place where developers have been working on developing Open Source software, to a place where industry leaders work to focus, promote, and augment Eclipse technologies to meet the needs of specific industries.
“ Eclipse Industry Working Groups
Our open-source strategy
IoT Building Blocks “We provide open-source developments tools and frameworks for M2M/IoT developers”
Our open-source strategy
IoT Building Blocks “We provide open-source developments tools and frameworks for M2M/IoT developers”
Interoperability “We provide reference implementations of open protocols and API to encourage interoperability”.
Our open-source strategy
IoT Building Blocks “We provide open-source developments tools and frameworks for M2M/IoT developers”
Interoperability “We provide reference implementations of open protocols and API to encourage interoperability”.
Open-Source Community “We host samples, testing environments and documentation on the m2m.eclipse.org portal”
http://m2m.eclipse.org
Open ecosystem for M2M
Third Party Ecosystem
Open M2M application framework and runtimes
Open M2M communication protocols
Internet of Things
Open M2M development tools
…
Framework
Tools
3 projects
Protocols
M2M embedded programming
• low-level C
• memory management
• multithreaded programming
• read sensor values
• control actuators
• consolidate data
• communicate
Example: Sending an SMS int main(){ unsigned char char1[10]; unsigned char char_buf[8]="AT+CSQ\n"; // unsigned char sms_buf[20] = "AT+CMGS="xxxxxxxxx"; int wc_fd; /********* Init of serial port ************/ wc_fd = init_wc(wc_fd); sleep(3); //writing to serial port write(wc_fd,char_buf,sizeof(char_buf)); usleep(40000); //reading from serial port read(wc_fd,char1,sizeof(char1)); sleep(2); close(wc_fd); return 0;} // end of main// initialization of serial portstruct termios options;ttys5_fd = open("/dev/ttyS5", O_RDWR );if (ttys5_fd < 0){ printf("\nFail to open serial port 2\n"); return 0;}init_tty( ttys5_fd ,BAUD_RATE);return ttys5_fd;-----------------------------------//initializing baud rateint init_tty( int fd ,long wBaud){ long baud; switch (wBaud) {
sms.send( '+33612345678’, 'My SMS’ )
Simplify M2M programming
What is Lua?
• High-level programming language
• Scripting
• Simple
• Extensible
• Portable
Extensible by design
• Small – Trivial syntax and reduced keyword set
• Simple but not stupid – Simple enough for new users, powerful enough
for advanced users (first-class functions, garbage collection, closures, tail calls, coercion, coroutines, metatables)
• Lua core is tiny – Compiled size is ~150kB – Lua uses libraries for its extensions
Lua vs. other high-level languages
• Same core features as Python, Ruby, Javascript
• Better concurrency management – Built-in – doesn’t rely on the OS
• Cutting-edge execution technology & performances
Lua vs. other high-level languages
• Restricted set of libraries – Stay simple, the developer brings his own
• Designed for C integration – Performance
– Legacy
Lua for embedded and M2M?
• High-level languages usually trade hardware resources for development & maintenance resources
Lua allows to reconcile high-level languages accomplishments with embedded constraints
You need an IDE! • Project structure
• Syntax coloring
• Content assist
• Code navigation
• Code formatting
• Documentation
• Code templates
• Debugger
• Remote development
• Embedded interpreter
June 2012: first release (0.8) Dec. 2012: 0.9 release June 2013: 1.0 w/ Kepler 60,000 installations already!
Koneki demo
How do we communicate?
http://www.sxc.hu/photo/1036004
M3DA*
Compact … because in the wireless world, data overhead costs money – Efficient in the transport of binary M2M data
Interoperable … because the M2M communication chain is heterogeneous – Language-independent – Tolerant to data schema changes – Agnostic to transport layer (TCP, HTTP, SMS, …)
Secure … because security is #1 concern for M2M adopters
– Ensure integrity and confidentiality of customer data – Message ticket-id to enable acknowledgement
Open … because vendor lock-in hinders M2M adoption
*Micro M2M Data Access
M3DA Layered Architecture
Transport Layer M3DA EnvelopeEnables authentication, encryption, …
Application Layer M3DA MessageSpecify access to the tree-oriented data model
Serialization Layer BysantProvides an efficient binary serialization based on contextual information
HTTP
M3DA Transport
M3DA Payload M3DA
Message Command/Event/Time stamped data
Message Command/Event/Time stamped data
…
Headers - Device /Server Identification - Security auth, cipher, hmac, nonce… - Compression algo, dict selection, …
TCP UDP SMS*
Transport
Bysant Serializer
M3DA = M2M data optimization • Object-oriented
• Provides basic classes – Numbers (Integers, Floating point numbers, Boolean) – Strings (Binary string) – Container objects (List, Map)
• User-defined objects – Allows to structure protocol objects (Message, Responses, DeltaVector,
…)
• Serialization is optimized for M2M data – Small numbers take less bytes – 5 ! 1 byte, 2040 ! 2 bytes – String size header are adaptative – 1 byte for a 28-byte long string, but 3 bytes for 66k-byte long string.
• Messaging protocol
• Low-bandwidth / Low-power
• Payload agnostic
• Adjustable QoS
• Large ecosystem
broker broker
(optional) bridge
publishsubscribe
keepalivelast will & testamentusername/password
topic/subtopic
topic/#
Lua VM + M3DA to go?
Application framework for M2M
• Set of libraries providing building blocks to develop M2M applications: – Serial and I/O management,
– Networking (FTP, HTTP, e-mail, …),
– GPS,
– Modbus,
– Local storage,
– etc.
http://www.eclipse.org/mihini
Smart agent for M2M
• M2M data queues
• Network bearers
• Device management
• Application container
• Application configuration
http://www.eclipse.org/mihini
Overall architecture
Asset management
• User applications use an API to communicate with Mihini – Send data or events
– Register listeners to handle data writing or commands
• The Mihini agent takes care of network connection, buffering and reliable storage of unsent data, etc.
Asset management
local gh_asset = asset_mgt.newAsset("greenhouse") gh_asset:start() gh_asset:pushdata("sensors.temperature", 22, "now") gh_asset:pushdata("sensors.humidity", 89, "hourly")
Device management
• A Tree Manager presents device's data as – variables,
– organized in a hierarchical tree,
– that can be read, written, and monitored for changes by user applications.
Device management local devicetree = require 'devicetree' local APN = 'system.cellular.apn.apn' local RSSI = 'system.cellular.link.rssi' local apn = devicetree.get (APN) log(LOG_NAME, "INFO", "Configure APN: %s", apn) local function print_callback (values) for name, value in pairs(values) do log (LOG_NAME, "INFO", " - Variable %s changed: %s",name, value) end end devicetree.register(RSSI, print_callback) devicetree.set(APN, 'foo')
Application Management
• Language-agnostic application container – install/uninstall – start/stop, auto-start on boot – restart on failure
• Agent handles over-the-air software download and update mechanism
• Remote script execution
Let me show you!
A very common use case
• Greenhouse business – Connect gardening equipment
– Remote monitoring of sensors
– Remote control
• M2M Gateway not selected yet, neither is the rest of the equipment (PLCs)
DO YOU KNOW US?
Raspberry Pi Web browser
humidity temperature illuminance
light ON/OFF
Modbus RTU
M3DA REST API
Web
HTML5 / JS
– OAuth
– AirVantage REST API
– Displays sensor data with a fancy UI
– Publish command to switch on/off the light
Two applications Embedded
– Uses Modbus library to communicate w/ Arduino
– Collects sensor data/controls actuators
– Publishes M3DA messages
– Subscribe to commands
Rugged wireless gateways
control sensors & actuators
Mobile phones
Web applications
IT applications
Modbus
…
M2M server
Telco&
Billing& etc…&
Hardware differentiation
ruggedness | radio certification extensibility | services | support
Developer Zone
Software differentiation
industrial protocols
power optimization
development tools
vertical applications
real-time
professional services
…
24/7
3rd party services
security
billing
carrier integration
professional services
…
embedded server
In a nutshell
• Prototyping made as simple as can be
• Smooth experience for Linux-based devices
• New languages are coming
• A clear path towards Sierra Wireless offer
Thank you! Questions?
http://m2m.eclipse.org | http://eclipse.org/koneki | http://eclipse.org/mihini