Using Eclipse and Lua for the Internet of Things - JAX2013

1,840
-1

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,840
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
80
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Using Eclipse and Lua for the Internet of Things - JAX2013

  1. 1. Using Eclipse & Lua for theInternet of ThingsBenjamin Cabébcabe@sierrawireless.com
  2. 2. Who I am•  Benjamin Cabé•  Open Source M2MEvangelist at Sierra Wireless•  Long-time Eclipse lover
  3. 3. ❝M2M? IoT?Technology that supportswired or wirelesscommunicationbetween devices
  4. 4. SmartPillBoxHeartbeatSensorWeightScaleBloodPressureMedicalServicesGatewayNear fieldBloodSugarInternetof ThingsPatientClinical TrialDoctor
  5. 5. FrameworkTools3 projectsProtocols
  6. 6. M2M embeddedprogramming•  low-level C•  memorymanagement•  multithreadedprogramming•  read sensor values•  control actuators•  consolidate data•  communicate
  7. 7. Example: Sending an SMSint main() { unsigned char char1[10]; unsigned char char_buf[8]="AT+CSQn"; // 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 port struct termios options; ttys5_fd = open("/dev/ttyS5", O_RDWR ); if (ttys5_fd < 0) sms.send(
+33612345678’,
My SMS’
)
  8. 8. Simplify M2M programming
  9. 9. What is Lua?•  High-level programming language•  Scripting•  Simple•  Extensible•  Portable
  10. 10. Extensible by design•  Small– Trivial syntax and reduced keyword set•  Simple but not stupid– Simple enough for new users, powerful enoughfor 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
  11. 11. 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
  12. 12. Lua vs. other high-level languages•  Restricted set of libraries– Stay simple, the developer brings his own •  Designed for C integration– Performance– Legacy
  13. 13. Lua for embedded and M2M?•  High-level languages usually tradehardware resources for development &maintenance resourcesLua allows to reconcile high-levellanguages accomplishmentswith embedded constraints
  14. 14. You need an IDE!•  Project structure•  Syntax coloring•  Content assist•  Code navigation•  Code formatting•  Documentation•  Code templates•  Debugger•  Remote development•  Embedded interpreterJune 2012: first release (0.8)Dec. 2012: 0.9 releaseJune 2013: graduate w/ Kepler60,000+ installations already! (Apr. 2013)
  15. 15. DEMOUsing Koneki LDT forremote Lua development
  16. 16. 101•  http://www.eclipse.org/koneki/ldt•  Download standalone IDE•  Or install in existing Eclipse–  from Juno repository (0.8.2)–  from nightly/milestones repositories (1.0M1)•  Execution environments on Koneki wiki–  http://goo.gl/f6T80 •  Contact the team–  http://eclipse.org/forums/eclipse.koneki
  17. 17. http://www.sxc.hu/photo/1036004
  18. 18. •  Messaging protocol•  Low-bandwidth / Low-power•  Payload agnostic•  Adjustable QoS•  Large ecosystem
  19. 19. broker broker(optional) bridgepublishsubscribekeepalivelast will & testamentusername/passwordtopic/subtopictopic/#
  20. 20. M3DA OverviewCompact … because in the wireless world, data overhead costs money–  Efficient in the transport of binary M2M dataInteroperable … 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 acknowledgementOpen … because vendor lock-in hinders M2M adoption–  Open specification–  Open-source, royalty-free, implementations
  21. 21. 101•  http://eclipse.org/paho/•  Free brokers hosted at Eclipse:m2m.eclipse.org•  Contact the team– paho-dev mailing-list
  22. 22. Lua VM + a Paho client to go?
  23. 23. Application framework for M2M•  Set of libraries providing building blocksto develop M2M applications:– Serial and I/O management, – Networking (FTP, HTTP, e-mail, …),– GPS, – Cryptography, – Modbus, – Local storage– etc. http://www.eclipse.org/mihini
  24. 24. Smart agent for M2M•  M2M data queues•  Network bearers•  Device management•  Application container•  Application configurationhttp://www.eclipse.org/mihini
  25. 25. Overall architecture
  26. 26. Asset management•  User applications use an API tocommunicate with Mihini– Send data or events– Register listeners to handle data writing orcommands•  The Mihini agent takes care of networkconnection, buffering and reliablestorage of unsent data, etc.
  27. 27. Asset managementlocal gh_asset = asset_mgt.newAsset("greenhouse")gh_asset:start()gh_asset:pushdata("sensors.temperature", 22, "now")gh_asset:pushdata("sensors.humidity", 89, "hourly")
  28. 28. Device management•  A Tree Manager presents devices dataas– variables,– organized in a hierarchical tree,– that can be read, written, and monitored forchanges by user applications.
  29. 29. Device managementlocal devicetree = require devicetreelocal APN = system.cellular.apn.apnlocal RSSI = system.cellular.link.rssilocal apn = devicetree.get (APN)log(LOG_NAME, "INFO", "Configure APN: %s", apn)local function print_callback (values)for name, value in pairs(values) dolog (LOG_NAME, "INFO"," - Variable %s changed: %s",name, value)endenddevicetree.register(RSSI, print_callback)devicetree.set(APN, foo)
  30. 30. Application Management•  Language-agnostic applicationcontainer– install/uninstall– start/stop, auto-start on boot– restart on failure•  Agent handles over-the-air softwaredownload and update mechanism•  Remote script execution
  31. 31. 101•  http://www.eclipse.org/proposals/technology.mihini•  http://eclipse.org/mihini•  Code will be available (very) soon– Initial contribution is pending IP review at Eclipse
  32. 32. Let meshow you!
  33. 33. Roadmap•  Protocols– CoAP, LWM2M •  REST API– Ease the communication of 3rd party apps with theAgent– Provide better tooling•  Polyglot framework– C and Java on their way
  34. 34. Wrapping up•  Developing an M2M app in Lua withMihini is simple– Demo app written in a couple of hours•  Mihini apps are portable•  Mihini itself is easily portable– make install J•  Koneki provides support for editing,debugging and deploying M2M apps
  35. 35. Join the party!
  36. 36. Thank you!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×