Your SlideShare is downloading. ×
Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Using Eclipse and Lua for the Internet of Things - EclipseDay Googleplex 2012


Published on

The Internet of Things (IoT) or Machine to Machine (M2M), is a technological field that will radically change the global network by enabling the communication of virtually every single object with …

The Internet of Things (IoT) or Machine to Machine (M2M), is a technological field that will radically change the global network by enabling the communication of virtually every single object with each other. Studies state that more than 50 billions objects may be connected to the Internet by 2020. In a near future, everything from a light bulb to a power plant, from a pacemaker to an hospital, from a car to a road network will be part of the Internet.

While this revolution is already happening (your house or your car may be "connected" already!), there are still lots of barriers to its growth, especially since existing solutions are almost always proprietary, and cannot interoperate easily. There are several very active M2M initiatives at Eclipse aiming at lowering these barriers, all under the umbrella of the M2M Industry Working Group. Last year, projects Paho (communication protocols for M2M) and Koneki (tools for M2M developers, in particular a complete IDE for Lua development) were created, and in July 2012 project Mihini was proposed to establish Lua as a reference platform for building M2M and IoT solutions.

The purpose of this talk is to give you a clear understanding of the afore mentioned Eclipse projects, as well as to show you that real M2M solutions can already be developed thanks to them. We will briefly introduce the Lua programming language, explain why it is a good fit for embedded M2M development, and then demonstrate the development of an actual working solution making use of the Mihini framework, a Paho MQTT client, and the Koneki tooling. The use case will also leverages Open Hardware plaforms such as Arduino and Raspberry Pi.

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. UsingEclipse &Lua for theInternetof Things EclipseDay Googleplex Dec. 12th, 2012 Benjamin Cabé
  • 2. Who I am•  Benjamin Cabé•  Open Source M2M Evangelist at Sierra Wireless•  Long-time Eclipse lover
  • 3. M2M? IoT?Technology that supportswired or wirelesscommunicationbetween devices
  • 4. Smart Pill Box Near field Patient Heartbeat Sensor Medical Services Gateway Clinical TrialWeight InternetScale of Things Doctor Blood Pressure Blood Sugar
  • 5. 3 projectsFrameworkProtocolsTools
  • 6. M2M embedded programming•  low-level C •  read sensor values•  memory •  control actuators management •  consolidate data•  multithreaded programming •  communicate
  • 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; sms.send(
 /********* Init of serial port ************/ wc_fd = init_wc(wc_fd); +33612345678’,
 sleep(3); //writing to serial port My SMS’
 ) 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)
  • 8. Simplify M2M programming
  • 9. What is Lua?•  High-level programming language•  Scripting•  Simple•  Extensible•  Portable
  • 10. 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
  • 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. Lua vs. other high-level languages•  Restricted set of libraries –  Stay simple, the developer brings his own•  Outstanding Lua/C integration –  Performance –  Legacy
  • 13. 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
  • 14. You need an IDE!•  Project structure•  Syntax coloring•  Content assist•  Code navigation•  Code formatting June 2012: first release (0.8) Dec. 2012: 0.9 release•  Documentation June 2013: graduate w/ Kepler•  Code templates 30,000+ installations already!•  Debugger•  Remote development
  • 15. Using Koneki LDT forremote Lua developmentDEMO
  • 16. 101••  Download standalone IDE•  Or install in existing Eclipse –  from Juno repository –  from nightly/milestones repositories•  Execution environments on Koneki wiki –•  Contact the team –
  • 17.
  • 18. •  Messaging protocol•  Low-bandwidth / Low-power•  Payload agnostic•  Adjustable QoS•  Large ecosystem
  • 19. (optional) bridge broker broker topic/# topic/subtopic keepalivepublish last will & testament subscribe username/password
  • 20. 101••  Eclipse Paho delivers clients for MQTT in C and Java –•  Lua client available soon –•  MQTT view in Eclipse –•  Free broker hosted at Eclipse:•  Contact the team –  paho-dev mailing-list
  • 21. Lua VM + MQTT client to go?
  • 22. 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, –  Cryptography, –  Modbus, –  Local storage –  etc.
  • 23. Smart agent for M2M•  M2M data queues•  Network bearers•  Device management•  Application container•  Application configuration
  • 24. Overall architecture
  • 25. 101• technology.mihini••  Code will be available (very) soon –  Initial contribution planned for Q1
  • 26. Let meshow you!
  • 27. 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)
  • 28. MQTT broker Raspberry Pi Mobile phoneModbus RTU humidity temperature illuminance light ON/OFF
  • 29. Two Lua applications Embedded Mobile Corona SDK–  Uses Modbus library to –  Subscribes to MQTT communicate w/ Arduino messages–  Collects sensor data/ –  Displays sensor data controls actuators with a fancy UI–  Publishes MQTT messages –  Publish command to–  Subscribe to commands switch on/off the light
  • 30. M2M Developer Kit•  Actual hardware early in the dev. process is key Affordable* Simple* Industrial*••  Arduino code & schematics will be available soon
  • 31. Telco* M2M server Billing* etc…* Rugged wireless Mobile phones gatewaysModbus Web applications IT applicationscontrol sensors &actuators …
  • 32. Wrapping up•  Developing an M2M app with Mihini is simple –  Demo app written in a couple of hours•  Mihini apps are portable•  Mihini itself is easily portable –  make install !•  Koneki provides support for editing, debugging and deploying M2M apps
  • 33. Join the party!
  • 34. Thank you!