End-to-end IoT solutions with Java and Eclipse IoT

2,897
-1

Published on

The IoT market is poised to an exponential growth, but there are still lots of barriers that prevent building a real, open, Internet of Things. Over the last years, Eclipse has been growing an ecosystem of open-source projects for IoT, that are used in real-world solutions, from smart gateways bridging sensors to the cloud, to device management infrastructures or home automation systems.

Java is a key-enabler for IoT, and this presentation provides you with concrete examples on how to build end-to-end solutions with the Eclipse IoT Java stack and projects like Paho, Kura, SmartHome, Californium, OM2M, Eclipse SCADA, Concierge ... This session will give you the keys to build a scalable IoT solution on top of open-source technology and open standards.

Published in: Technology

End-to-end IoT solutions with Java and Eclipse IoT

  1. 1. End-to-end IoT solutions with Java and Eclipse IoT Benjamin Cabé Eclipse Foundation
  2. 2. Java for IoT? 9+ million Java developers Java 8 & embedded are fun Lots of IoT devices running on ARM Tooling
  3. 3. Eclipse IoT A vivid open-source community 13* projects across the whole IoT chain * and counting...
  4. 4. Your typical IoT solution Actuators/Sensors + Gateway + [ Cloud ] + User front-end
  5. 5. IOT
  6. 6. IOT
  7. 7. 1. Sensors / Actuators • Sense the physical environment • Act on it
  8. 8. 1. Sensors / Actuators • Sense the physical environment • Act on it Well… that was easy!
  9. 9. 1. Sensors / Actuators • Manipulate sysfs directly with the File API • Use Pi4J (hint: ♥︎) to have full support of GPIO/I2C/SPI • Use MIDlets with Java ME embedded
  10. 10. 1. Sensors / Actuators • Manipulate sysfs directly with the File API • Use Pi4J (hint: ♥︎) to have full support of GPIO/I2C/SPI • Use MIDlets with Java ME embedded
  11. 11. 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
  12. 12. Pi4J in action GpioController gpio = GpioFactory.getInstance(); GpioPinDigitalOutput pin = gpio.provisionDigitalOutputPin( RaspiPin.GPIO_01, "MyLED", PinState.HIGH); Thread.sleep(5000); pin.low(); Thread.sleep(5000); pin.toggle(); gpio.shutdown();
  13. 13. 2. Gateway Network by Nicholas Menghini from The Noun Project
  14. 14. 2. Gateway Connect sensors to the world Network by Nicholas Menghini from The Noun Project
  15. 15. 2. Gateway Connect sensors to the world Network by Nicholas Menghini from The Noun Project Manage the hardware and software running at the edge
  16. 16. 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
  17. 17. CoAP with Californium CoapServer, CoapResource, CoapExchange 1. Implement custom resources (extend CoapResource) 2. Add resources to the CoAP server 3. Start the server
  18. 18. CoAP with Californium import static org.eclipse.californium.core.coap.CoAP.ResponseCode.*; // shortcuts 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) } }
  19. 19. MQTT with Paho 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/#"); Read more: https://www.eclipse.org/paho/clients/java/
  20. 20. Manage? • Gateway itself – wireless modem, firewall, … • Applications – Install/Uninstall software packages – Start/Stop applications • Sensors – H/W abstraction layer
  21. 21. Eclipse Kura Applications App 1 App 2 . . . . App n Network Configuration Network Management Field Gateway Basic Services Device Abstraction OSGi Application Container Java VM Protocols Connectivity and Delivery Administration GUI Operation & Management Linux Hardware
  22. 22. OSGi with Concierge OSGi? – A dynamic component system for Java – Many standard services • Eventing, configuration management, UPnP, … – A target of choice for modular IoT software Eclipse Concierge provides low footprint implementation (~300-400kb JAR files) http://eclipse.org/concierge
  23. 23. Eclipse Kura
  24. 24. Eclipse Kura
  25. 25. Eclipse Kura
  26. 26. Eclipse Kura
  27. 27. Eclipse Kura
  28. 28. Eclipse Kura
  29. 29. Eclipse Kura
  30. 30. Eclipse Kura
  31. 31. Your typical Kura component • Uses Modbus, CAN-Bus, etc. built-in device abstraction services – Or implement your own service
  32. 32. 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
  33. 33. Your typical Kura component (3) • Implements ConfigurableComponent – Enables configuration from the UI – … as well as from the cloud
  34. 34. 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: https://wiki.eclipse.org/Kura/Getting_Started
  35. 35. 3. Cloud backend • Allow virtual point-to-point communication between the IoT devices • Provide device management capabilities to manage fleets of devices on the field
  36. 36. MQTT broker with Moquette • Supports QoS 0, 1 and 2 • Aligned with latest MQTT 3.1.1 specification • Ready to be deployed in OSGi containers • WebSockets • Leverages LMAX Disruptor buffer
  37. 37. MQTT broker with Moquette https://code.google.com/p/moquette-mqtt/ Very simple to install: tar zxf distribution-0.6-bundle-tar.tar.gz cd bin ./moquette.sh Note: Moquette has been recently proposed as an Eclipse IoT project
  38. 38. 4. End-user interaction Mobile Web Other IoT gadgets: wearables, …
  39. 39. Android Developing for IoT on Android is dead simple – MQTT Android service https://www.eclipse.org/paho/clients/android – Android Wear: you can easily bridge Google Play’s DataLayer to MQTT
  40. 40. Web MQTT over Websockets enables direct MQTT communication from noBackend web-apps – https://www.eclipse.org/paho/clients/js/ Eclipse Ponte is also a good way to bridge MQTT or CoAP to HTTP – https://eclipse.org/ponte
  41. 41. Tooling • Java support in the Eclipse IDE from day 1 • Remote debug • Java 8 (lambdas, …) • OSGi – PDE (Plug-in Development Environment) – Remote OSGi with mToolkit
  42. 42. Moaaar Eclipse IoT and Java!
  43. 43. See you soon!
  44. 44. See you soon! http://www.meetup.com/Virtual-IoT
  45. 45. Thanks! <benjamin@eclipse.org> @kartben http://iot.eclipse.org
  46. 46. Show me the code! Kura OSGi runtime JVM Cloud Service DataService DataTransportService Administration GUI

×