Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Devoxx 2015 - Building the Internet of Things with Eclipse IoT

2,967 views

Published on

Eclipse is much more than an IDE. Repeat after me: "Eclipse is much more than just an IDE! Eclipse has a lot of cool projects that can get me started with the Internet of Things!". So whether or not you are using Eclipse as your IDE, this session will give you a crash course on the available technologies to build the Internet of Things on top of Java. You will learn how protocols like MQTT, CoAP or LwM2M and embedded frameworks like Kura help solve classical IoT issues, and you will get useful tips to move from "yay, I blinked an LED!" to more useful industrial IoT scenarios.

Published in: Technology

Devoxx 2015 - Building the Internet of Things with Eclipse IoT

  1. 1. Building the Internet of Things with Eclipse IoT Benjamin Cabé – Eclipse Foundation @kartben Devoxx France - April 10, 2015
  2. 2. Java for IoT? ● 9+ million Java developers ● Java 8 & embedded are fun ● Lots of IoT devices running on ARM ● Tooling
  3. 3. End-to-end IoT?
  4. 4. End-to-end IoT?
  5. 5. End-to-end IoT?
  6. 6. End-to-end IoT?
  7. 7. Talking to sensors? ● Pi4J – http://pi4j.com ○ Complete access to GPIOs/I2C/SPI ○ Very mature codebase, based on WiringPi ○ Support for popular shields (PiFace, Gertboard, …) ○ Lots of code samples
  8. 8. Talking to sensors? Gp o on o e p o = Gp oFa o . e Ins an e(); Gp oP nD a Ou pu p n = p o.p o s onD a Ou pu P n( Rasp P n.GPIO_01, "M LED", P nS a e.HIGH); Th ead.s eep(5000); p n. ow(); Th ead.s eep(5000); p n. o e(); p o.shu down();
  9. 9. Gateway
  10. 10. Gateway
  11. 11. Gateway
  12. 12. Gateway Connect sensors to the world Manage the hardware and software running at the edge
  13. 13. Connect? ● CoAP ○ « HTTP over UDP » ○ Expose your device as a resource to the Internet of Things ● MQTT ○ Publish/Subscribe model ○ More room for local processing
  14. 14. CoAP: The web-of-things /walk /hand/left/raise /eye/picture /on /red /green /blue /mtbf /on /on /buttons /buttons/1/push /bat-level /engine/status /position /fuel /CO2 /noise /lights/on
  15. 15. Eclipse Californium ● Focus on scalability and usability ● To be used in IoT cloud servers or M2M/IoT devices running Java ● Includes DTLS implementation (Scandium), HTTP/CoAP bridge, Plugtests, … http://eclipse.org/californium
  16. 16. import static org.eclipse.californium.core.coap.CoAP.ResponseCode.*; public class MyResource extends CoapResource { @Override public void handleGET(CoapExchange exchange) { exchange.respond("hello world"); // reply with 2.05 payload (text/plain) } @Override public void handlePOST(CoapExchange exchange) { exchange.accept(); // make it a separate response if (exchange.getRequestOptions() ...) { // do something specific to the request options } exchange.respond(CREATED); // reply with response code only (shortcut) } }
  17. 17. MQTT: Publish & Subscribe Sub KETTLE232/#Pub KETTLE232/temp Payload: 21°C Pub KETTLE232/temp Payload: 21°C BROKER
  18. 18. Eclipse Paho ● Open-source MQTT clients ● Pick your language! ○ Java ○ JavaScript ○ C/C++, Objective C ○ Go, Lua, Python, .NET, WinRT, … http://eclipse.org/paho
  19. 19. MqttClient c = new MqttClient("tcp://m2m.eclipse.org:1883", MqttClient.generateClientId()); mqttClient.setCallback(new MqttCallback() { @Override public void messageArrived(String topic, MqttMessage message) throws Exception { // process received message // ... } }); mqttClient.connect(); mqttClient.subscribe("mygateway/#");
  20. 20. MQTT brokers ● Eclipse Mosquitto ○ C implementation ○ Scalable (1000 clients == 3MB RAM) ● Eclipse Moquette ○ Java implementation ○ Based on Netty and LMAX disruptor
  21. 21. Manage? ● Gateway itself ○ wireless modem, firewall, … ● Applications ○ Install/Uninstall software packages ○ Start/Stop applications ● Sensors ○ H/W abstraction layer
  22. 22. Java VM OSGi Application Container Device Abstraction Gateway Basic Services Network Configuration Network Management Field Protocols Connectivity and Delivery AdministrationGUI Operation&Management Linux Hardware App 1 App 2 App n. . . . Applications Eclipse Kura
  23. 23. Installing Kura cd ~ sudo apt-get update wget https://s3.amazonaws.com/kura_downloads/raspbian/release/ 1.1.0/kura_1.1.0_raspberry-pi_armv6.deb sudo dpkg -i kura_1.1.0_raspberry-pi_armv6.deb sudo apt-get install -f sudo reboot
  24. 24. First steps with Kura ● Network management ○ Cellular Modem, WiFi ○ Firewall ○ NAT ● OSGi and system administration ● IoT server communication settings
  25. 25. First steps with Kura
  26. 26. First steps with Kura
  27. 27. First steps with Kura
  28. 28. First steps with Kura
  29. 29. First steps with Kura
  30. 30. First steps with Kura
  31. 31. First steps with Kura
  32. 32. First steps with Kura
  33. 33. Kura API ● OSGi services that you can re-use in your own components ○ o Se e ○ Da aSe e, oudSe e ○ p oSe e (AES, base64, SHA-1) ○ Pos onSe e (geolocation) ○ … and many others ● And of course you can leverage a huge ecosystem of Java and OSGi libraries
  34. 34. Your typical Kura component ● Uses Modbus, CAN-Bus, etc. built-in device abstraction services ○ Or implement your own service
  35. 35. Your typical Kura component (2) • Uses Kura built-in transport services to talk to the cloud – TransportService – « raw » protocol – DataService – local storage, auto reconnect – CloudService – optimized binary payload, advanced device management
  36. 36. Your typical Kura component (3) • Implements ConfigurableComponent – Enables configuration from the UI – … as well as from the cloud
  37. 37. Your typical Kura component (4) • Bundled with other bundles/components in a deployment package – Zip file containing a Manifest & OSGi bundles • Can be deployed from Kura Web UI or over the air Read more: http://eclipse.github.io/kura/doc/kura-setup
  38. 38. End-user interaction ● JavaFX Charts ● Eclipse BIRT ● Smartphone app (e.g Android) ○ https://www.eclipse.org/paho/clients/android ● MQTT + WebSockets = ♡ ○ https://www.eclipse.org/paho/clients/js
  39. 39. Kura is awesome! Go download it now! http://eclipse.org/kura If you had to remember only 3 things... #1
  40. 40. Build your own greenhouse & follow the tutorial http://iot.eclipse.org/java/tutorial If you had to remember only 3 things... #2
  41. 41. Eclipse IoT is much more than Kura and Java! http://iot.eclipse.org/ If you had to remember only 3 things... #3
  42. 42. Get Involved! ● Open bugs / fix bugs ● Request new features ● Write articles, tutorials ● Participate on the mailing lists ● Propose your project!
  43. 43. Coming next?
  44. 44. Coming next? ● Device Management ○ LwM2M, LwM2M over MQTT, IPSO Smart Objects ● Security ○ TinyDTLS ● Open-source IoT server? ○ Several members interested in defining and implementing the OpenStack for IoT
  45. 45. Thank you! Questions? benjamin@eclipse.org @kartben http://iot.eclipse.org

×