using eclipse lua for the internet of things · using eclipse & lua for the internet of things...
TRANSCRIPT
![Page 1: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/1.jpg)
Using Eclipse & Lua for the Internet of Things
Benjamin Cabé – [email protected] Gaétan Morice – [email protected]
![Page 2: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/2.jpg)
� IoT? M2M?
Technology that supports wired or wireless communication between devices
![Page 3: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/3.jpg)
50
bill ion devices by 2020
![Page 4: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/4.jpg)
50
bill ion devices by 2020
![Page 5: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/5.jpg)
![Page 6: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/6.jpg)
![Page 7: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/7.jpg)
![Page 8: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/8.jpg)
![Page 9: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/9.jpg)
![Page 10: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/10.jpg)
Communication Infrastructure
Smart Pill Box
Heartbeat Sensor
Weight Scale
Blood Pressure
Medical Services Gateway
Near field
Blood Sugar
Internet of Things
Patient
Clinical Trial
Doctor
![Page 11: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/11.jpg)
Ready then?
![Page 12: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/12.jpg)
…Not quite!!
![Page 13: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/13.jpg)
M2M market = fragmented
![Page 14: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/14.jpg)
M2M development = complex
![Page 15: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/15.jpg)
M2M vendors = lock-in
![Page 16: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/16.jpg)
?
![Page 17: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/17.jpg)
![Page 18: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/18.jpg)
Framework
Tools
3 projects
Protocols
![Page 19: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/19.jpg)
M2M embedded programming
• low-level C
• memory management
• multithreaded programming
• read sensor values
• control actuators
• consolidate data
• communicate
![Page 20: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/20.jpg)
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’, )
![Page 21: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/21.jpg)
Simplify M2M programming
![Page 22: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/22.jpg)
What is Lua?
• High-level programming language
• Scripting
• Extensible
• Simple
• E!cient
• Portable
![Page 23: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/23.jpg)
You need an IDE! • Project structure
• Syntax coloring
• Content assist
• Code navigation
• Code formatting
• Documentation
• Code templates
• Debugger
• Remote development
June 2012: first release (0.8)
Dec. 2012: 0.9 release
June 2013: graduate w/ Kepler
20,000+ installations already!
![Page 24: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/24.jpg)
DEMO
Using Koneki LDT for remote Lua development
![Page 25: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/25.jpg)
101
• http://www.eclipse.org/koneki/ldt • Download standalone IDE • Or install in existing Eclipse
– from Juno repository – from nightly/milestones repositories
• Execution environments: – http://sierrawireless.github.com/lua-execution-
environments/
• Contact the team – http://eclipse.org/forums/eclipse.koneki
![Page 26: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/26.jpg)
http://www.sxc.hu/photo/1036004
![Page 27: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/27.jpg)
• Low-bandwidth
• Low-power
• Payload agnostic
• Adjustable QoS
• Large ecosystem
![Page 28: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/28.jpg)
broker broker
(optional) bridge
publishsubscribe
keepalivelast will & testamentusername/password
topic/subtopic
topic/#
![Page 29: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/29.jpg)
101 • http://eclipse.org/paho/ • Eclipse Paho delivers clients for MQTT in C and
Java – http://eclipse.org/paho/download.php
• Lua client available soon – https://github.com/geekscape/mqtt_lua
• MQTT view in Eclipse – http://git.eclipse.org/c/paho/org.eclipse.paho.esf.git/
• Free broker hosted at Eclipse: m2m.eclipse.org
• Contact the team – paho-dev mailing-list
![Page 30: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/30.jpg)
Lua VM + MQTT client to go?
![Page 31: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/31.jpg)
Application framework for M2M
• Set of libraries providing building blocks to develop user M2M applications: – Serial and I/O management, – Networking (FTP, HTTP, E-mail clients), – GPS, – Cryptography, – Modbus, – Local storage – etc. http://www.eclipse.org/mihini
![Page 32: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/32.jpg)
Smart agent for M2M
• M2M data queues
• Network bearers
• Device management
• Application container
• Application configuration
http://www.eclipse.org/mihini
![Page 33: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/33.jpg)
101
• http://www.eclipse.org/proposals/technology.mihini
• http://eclipse.org/mihini
• Code will be available on Github soon
• Initial contribution planned for Q1
![Page 34: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/34.jpg)
Let me show you!
![Page 35: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/35.jpg)
Step 1 – Early prototyping
• Greenhouse business – Connect gardening equipments to each
other – Remote monitoring of sensors – Remote control
• M2M Gateway not selected yet, neither is the rest of the equipment (PLCs)
![Page 36: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/36.jpg)
m2m.eclipse.org MQTT broker
Raspberry Pi Mobile phone
humidity temperature illuminance
light ON/OFF
Modbus RTU
![Page 37: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/37.jpg)
Two Lua applications
Embedded
– Uses Modbus library to talk to Arduino PLC
– Collects sensor data/controls actuators
– Publishes MQTT messages
– Subscribe to commands
Mobile
Corona SDK
– Subscribes to MQTT messages
– Displays sensor data with a fancy UI
– Publish command to switch on/o" the light
![Page 38: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/38.jpg)
M2M Developer Kit
• Actual hardware early in the dev. process is key
Affordable! Simple! Industrial!
• http://wiki.eclipse.org/Mihini/Developer_Kit • Arduino code & schematics available after the conference
![Page 39: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/39.jpg)
Step 2 – Use an industrial gateway
• Need for rugged, industrial-grade M2M gateway
• Take the Mihini codebase and compile it against the gateway’s toolchain
• Mihini porting layer – straightforward for Linux-based devices
with AT modem – porting layer for other solutions
![Page 40: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/40.jpg)
m2m.eclipse.org MQTT broker
Rugged wireless gateway
Mobile phone
humidity temperature illuminance
light ON/OFF
Modbus RTU
![Page 41: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/41.jpg)
Step 3 – Industrial deployment
• Use a real PLC – Mihini dev. kit is replaced by a real PLC – Only the configuration of the application
(modbus registries #) will have to be updated
• Use a reliable, multi-tenant, M2M server
![Page 42: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/42.jpg)
M2M server
Rugged wireless gateway
humidity temperature illuminance
light ON/OFF
Modbus RTU
Telco!
Billing! etc…!
Mobile phone
![Page 43: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/43.jpg)
Conclusion
• Developing an M2M app with Mihini is simple – Demo app written in a couple hours
• Mihini apps are portable
• Mihini itself is easily portable – make install
• Koneki provides support for editing, debugging and deploying M2M apps
![Page 44: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/44.jpg)
M2M AT ECLIPSE IS ALSO…
![Page 46: Using Eclipse Lua for the Internet of Things · Using Eclipse & Lua for the Internet of Things ... programming • low-level C • memory management ... with a fancy UI](https://reader031.vdocuments.us/reader031/viewer/2022022118/5cc86b9e88c993fb628dd01d/html5/thumbnails/46.jpg)
An all-in-one IDE
• June 2013 • Ready-to-use • Market Place