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.

Creating a Java Internet of Things Gateway


Published on

At JavaOne, Eurotech's David Woodard presented How to create a Java-based M2M / Internet of Things Gateway

  • Be the first to comment

Creating a Java Internet of Things Gateway

  1. 1. Creating a Java Internet of Things Gateway David Woodard, Eurotech
  2. 2. Internet / TCP/IP Sometimes IoT Solutions look simple … Business Application Sensors, Actuators, Displays, … Service Gateway Single or no special application on gateway A single application to communicate with Only one type of Gateway HW & SW Only one type of device / sensor No connectivity options required
  3. 3. Internet / TCP/IP Ethernet WiFi 3G / LTE Satellite WiMAX Other ... But it gets complex Business Application Sensors, Actuators, Displays, … •Multiple services on the gateway / edge node •Different connectivity options •More than one kind of vertical market value proposition •Customer specific business logic 2G / 2.5G xDSL Cable
  4. 4. ... More complexity with multiple consumers @ Business Applications Sensors, Actuators, Displays, … ?
  5. 5. IoT Architectures Business Applications Sensors, Actuators, Displays, … @ Application Framework + Multi-Service Gateway M2M/IoT Integration Platform on Cloud M2M Integration Platform
  6. 6. IoT Gateway Stack Increase productivity and lower time to market OSGi on Linux Hardware Java SE Embedded Code Code Code
  7. 7. Birth of •June 16, 2013 •December 16, 2013 v0.7.0 •August14, 2014 •September 25, 2014
  8. 8. Linux OS Embedded App Simplify the design, deployment and remote management of embedded applications. •Modular software components •Manage cloud connectivity •Configure the network, such as Wi-Fi and cellular bearers, firewalling and routing, etc. •Support different protocols to connect to different servers or devices (ex. MQTT, Serial, Modbus, CANBus). •Allow for remote application and device management and configuration. •Cohesive and integrated ensuring application portability Java / OSGi Open HW Industrial HW Eclipse
  9. 9. Services Java SE 7 (Oracle Java SE Embedded, OpenJDK) OSGi Application Container (Eclipse Equinox, Concierge) Device Abstraction javax.comm Basic Gateway Services DB Service Clock Service Device Profile Watchdog Network Configuration Network Configuration Field Protocols Connectivity and Delivery Data Services MQTT Paho Administration GUI Applications Your Application Remote Management Configuration Management javax.usb / udev Cloud Services Your Application Firewall, Port Forwarding Link Monitors Cellular, Wi-Fi, Ethernet GPS Position GPIO / SPI / PWM / I2C Modbus CANBus Custom Protocols Updates Management Remote Access (VPN)
  10. 10. Developer’s Experience Emulate on PC Deploy on Target Cloud Managed Start developing your IoT /M2M application in the comfort of your PC. •Full Eclipse Integration •Target Platform Definition •Emulated Services •Run/Debug from Eclipse •Support Mac/Linux Hosts When you are ready, deploy your application on the gateway. •One-click Deployment •Eclipse Plugin •Remote Debugging Provision and manage your applications in field devices from the Cloud. •Remote OSGi Management via MQTT •Web-based Console
  11. 11. Kura Data Transport Optioins •DataTransportService –Available for standard MQTT messaging. Allows consumers of the service to connect to brokers, publish messages, and receive messages on subscribed topics •DataService –Delegates data transport to the DataTransportService –Provides extended features for managing broker connections, buffering of published messages, and priority based delivery of messages •CloudService –Further extends the functionality of DataService. –Provides means for more complex flows (i.e. request/response) –Manages single broker connection across multiple applications –Provides payload data model with encoding/decoding serializers –Publishes life cycle manages for devices and applications
  12. 12. Kura Configurable Component <?xml version="1.0" encoding="UTF-8"?> <MetaData xmlns= localization="en_us"> <OCD id="org.eclipse.iot.greenhouse.publisher.GreenhousePublisher" name="Greenhouse Publisher" description="Settings for the greenhouse application."> <AD id="warning.level" name="warning.level" type="Integer" cardinality="0" reguired="true" default="20" description="Triggers alarm if temperature falls below this limit." /> </OCD> </MeataData>
  13. 13. Kura Configurable Component Applications implementing Configurable Component will be available in Kura UI Attributes configured in XML appear in form panel
  14. 14. Network Services
  15. 15. Greenhouse Demo Architecture Temperature Sensor Humidity Sensor Light Sensor I2C GPIO
  16. 16. OSGi Services •CloudClientListener (From Kura) –Provided service for handling messaging events (connection established, message arrived, message sent, etc.) •CloudService (From Kura) –Consumed service to manage connection to cloud across multiple applications, publish life cycle messages, serialize/deserialize compressed data payload, and more. •SensorChangedListener (From Application) –Provided service to send MQTT message once a sensor has detected a change •GreenhouseSensorService (From Application) –Provided service for getting values from sensors and setting actuator values (i.e. – LED)
  17. 17. Greenhouse Application public class GreenhousePublisher implements ConfigurableComponent, CloudClientListener, SensorChangedListener { private static final String APP_ID = "greenhouse-demo"; _cloudClient = _cloudService.newCloudClient(APP_ID); _cloudClient.addCloudClientListener(this); @Override public void onConnectionEstablished() { _cloudClient.subscribe("#", 0); } @Override public void sensorChanged(String sensorName,Object newValue) { KuraPayload payload = new KuraPayload; payload.setTimestamp(new Date()); payload.addMetric("value", newValue); int messageId = cloudClient.publish(topic, payload, qos, retain, 2); } }
  18. 18. GreenhouseSensorService public class Pi4JGreenhouseSensorService implements GreenhouseSensorService { _gpioController = GpioFactory.getInstance; _i2cbus = I2CFactory.getInstance(I2CBus.BUS_1; _temperatureSensor = _i2cbus.getDevice(0x40); _lightActuator =_gpioController.provisionDigitalMultipurposePin( RaspiPin.GPIO_00, "led”, PinMode.DIGITAL_OUTPUT); @Override public void setActuatorValue(String actuatorName, Object value){ _lightActuator.setState("on".equals(value)); notifyListeners("light", value); } }
  19. 19. Eurotech Everyware Cloud
  20. 20. Business Logic
  21. 21. MQTT Topics and Payloads javaonedemo sensors actuator •Timestamp •Metrics: •value •warn •Timestamp •Metrics: •value Kura Payload Kura Payload temperature humidity lux light
  22. 22. on Everyware Software Framework (ESF) Kura & ESF Linux OS Java/OSGi on Elements outside the scope of Kura Linux OS Java/OSGi on on ESF now builds on Kura, with the addition of commercial support and extra features: •Everyware Cloud remote management and logging •Diagnostic •Everyware VPN •Field Protocols •Bundles for specific vertical applications •Device provisioning Core Elements of ESF, a proven application framework for embedded devices form the basis for Kura
  23. 23. You are important! •Learn More - come visit us on the Exhibition Floor: –Eurotech Booth –Eclipse Booth •Contribute!
  24. 24. Thank You!