Generative Software GmbH
Java User Group Freiburg
5. März 2018
Internet of Things für Java-Entwickler
1
Agenda
 What is IoT?
 IoT Gateway with Eclipse IoT
 The Story of the Smart Greenhouse
 Live-Demo of the Smart Greenhouse
 The Architecture of an IoT Gateway
2Generative Software GmbH
What is IoT?
3Generative Software GmbH
Goals of IoT Solutions
 Transparency – what is going on?
 Traceability – what was going on?
 Prediction – what will be going on?
 Emergency – what is badly wrong?
 Optimization – what to do to improve processes?
 Agility – what intervention makes sense?
 Automation – what can be done by machines?
4Generative Software GmbH
Sensor Categories
5Generative Software GmbH
Gateway, Server, Cloud
Passive
Active – Always On
Active – Wake Up
Gateway, Server, Cloud
Gateway, Server, Cloud
Microprocessor
Where to use Sensor Data
6Generative Software GmbH
Time Frame On Device (Edge) On Stream (Fog) In Batch (Cloud)
Hours to Weeks In Database
Strategic Insight
Machine Learning
Minutes to Hours In Process
Performance Insights
Summary Statistics
Seconds to Minutes Operational Insight
Rules Engine
Microseconds to Seconds Signal Processing
IoT Gateway
Protocols
7Generative Software GmbH
HTTP CoAP AMQP XMPP MQTT
Architecture Request/Response Request/Response Point-to-Point
Publish/Subscribe
Request/Response
Publish/Subscribe
Publish/Subscribe
Representation Text, Binary Binary Binary Text Binary
Transport TCP UDP TCP TCP TCP
Security (Transp.) TLS DTLS TLS TLS TLS
Discovery No Yes No No No
Scope Device-to-Cloud Device-to-Device Device-to-Cloud
Cloud-to-Device
Device-to-Cloud
Cloud-to-Device
Device-to-Cloud
Cloud-to-Device
Suitable for
Constr. Devices
Possibly Yes Possibly Possibly Yes
Server Updates Pull Pull, Push Push Push Push
Networks
8Generative Software GmbH
Data Unit OSI Layer Examples
Host/Service
Layers
Data Application HTTP, FTP, ‚IoT Protocols‘ Peer-to-Peer
Protocols
Presentation TLS, SSL
Session NetBIOS
Segment/Datagram Transport TCP, UDP
Network
Protocols
Device/Media
Layers
Packet/Datagram Network IP, ARP, ICMP, IPSec
Frame Data Link Ethernet, ATM, PPP
Bit Physical Ethernet, WiFi, USB, Bluetooth, SPI, I2C
Eclipse IoT
9Generative Software GmbH
 Working Group
– Members: 39 (Mar 2018), RedHat, SAP, Intel, Bosch, Canonical,
Cloudera, DB Systel, Huawei, IBM, Siemens, Sierra Wireless, …
– Community: IoT Testbeds, Youtube, Meetups, Whitepapers,
Surveys, Conferences, Open IoT Challenge …
 Technology
– Eclipse Projects: Paho, Kura, Californium, Mosquitto, Vorto, Milo,
Kapua, Hono, HawkBit, …
– Standards: CoAP, MQTT, OPC UA, OMA LWM2M, …
– Programming Languages: Java, C, C++, Python, …
OSGi
10Generative Software GmbH
 Originally: Open Services Gateway initiative
 Today: OSGi Alliance (defines APIs and Test Cases)
 Open, modular and scalable „Service Delivery Platform“
 Java-based
 Well-known Open Source Frameworks:
– Knoplerfish
– Eclipse Equinox
– Apache Felix
– Concierge
 Modularization with so-called „Bundles“
 Visibility of Java Packages
 Semantic Versioning of Java Packages
 (Declarative) Services
Smart, Smarter, …
11Generative Software GmbH
Requirements for the IoT Greenhouse
 Show all Sensor Values on a Display
 Control Plant Lamp depending on Luminocity
 Control Water Pump depending on Soil Humidity
 Control Heating depending on Air Temperature
 Switch on a Buzzer when Gas Sensor detects Gas
 Send Sensor Data to a Server and store it there
12Generative Software GmbH
Buy an IKEA Mini Greenhouse …
13Generative Software GmbH
… assemble it …
14Generative Software GmbH
… fill it with Hardware …
15Generative Software GmbH
… add Software to it …
16Generative Software GmbH
… connect it with a Network …
17Generative Software GmbH
… and ready is the Smart Greenhouse
Software Stack
Eclipse IoT
 Kura (IoT Gateway Software, Java+OSGi)
 Mosquitto (MQTT Broker)
 Paho (MQTT Client)
 Californium (CoAP)
Jakarta EE
 JAX-RS
 JAXB
 JSF
 Servlets
 EJB
 JPA
19Generative Software GmbH
The Smart Greenhouse - Details
20Generative Software GmbH
IoT Gateway (Raspberry Pi 2)
Kura, Paho, Californium
IoT Server
Paho, Californium
Glassfish 4.1
Java EE
Network Connection
Sensors
MQTT Broker
Mosquitto
Actuator „LED Strip“
Hose to Actuator „Pump“
LCD Display
What shall the IoT Solution do?
1. Read Sensors with the Kura IoT Gateway
2. Execute Business Logic with the Kura IoT Gateway
3. Send Sensor Data to Mosquitto with Paho (MQTT)
4. Collect Sensor Data with Paho and Servlets
5. Persist Sensor Data by Means of a REST API (JAX-RS, EJB, JPA)
6. Display Sensor Data by Means of a JSF Web App (uses same REST-API)
7. Control Actuators with a JSF Web App and Californium (CoAP)
8. Execute Business Logic on a Server with Paho and EJBs
21Generative Software GmbH
Live Demo!
22Generative Software GmbH
MQTT
(Message Queue Telemetry Transport)
23Generative Software GmbH
Message
Broker
Publisher Subscriber
publish to …
client-id/app-id/temperature
subscribe to …
client-id/app-id/temperature
1 2
SubscriberPublisher
MQTT
24Generative Software GmbH
 [account-name]/[client-id]/[app-id]/[resource-id]
 Subscription Wildcards
# … e.g. client-id/app-id/#
client-id/app-id/temperature
client-id/app-id/plant/light
client-id/app-id/plant/moisture
+ … e.g. client-id/app-id/+/light
client-id/app-id/plant/light
 Do not subscribe to # (all messages)
CoAP
(Constrained Application Protocol)
25Generative Software GmbH
CoAP
Server
CoAP
Client
GET request: coap://<CoAP-Host>:5683/temperature
response
GET
PUT
POST
DELETE
1
2
3
OSGi Container
Eclipse Kura
Paho
CoAP
OpenJDK I/O
Californium
…
Paho
Publisher
Device Service
Simulation
MQTT
Service Interfaces
Legende
Service-Aufrufe
Data Flow
OSGi Bundle
Simulationsdaten
Sensordaten simulieren
und verschicken
26Generative Software GmbH
OSGi Container
Eclipse Kura
Paho
CoAP
OpenJDK I/O
Californium
…
Paho
Publisher
Business Logic
Device Service
Simulation
MQTT
Service Interfaces
Legende
Service-Aufrufe
Data Flow
OSGi Bundle
Simulationsdaten
Gateway-Logik
simulieren
27Generative Software GmbH
Device Access with Java
 OpenJDK Device I/O: GPIO, I2C, UART, SPI
 TinyB: Bluetooth LE
 Pi4J: Object-Oriented API to access I/O
Capabilities of Raspberry Pi
28Generative Software GmbH
Kura
Eclipse Kura
Paho
CoAP
OpenJDK I/O
Californium
…
Kura
Data Service
Device Service
MQTT
Service Interfaces
Legende
Service-Aufrufe
Data Flow
OSGi Bundle
Echte Sensordaten
verschicken
29Generative Software GmbH
Kura
Eclipse Kura
Paho
CoAP
OpenJDK I/O
Californium
…
Kura
Data Service
Business Logic
Device Service
MQTT
Service Interfaces
Legende
Service-Aufrufe
Data Flow
OSGi Bundle
Gateway-Logik
implementieren
30Generative Software GmbH
Tutorials on Github and Bitbucket
31Generative Software GmbH
Eclipse Tutorial: github.com/kartben/kura-greenhouse-demo
Greenhouse Tutorial: bitbucket.org/jenerateit/tutorial-smart-greenhouse
Tutorial IOTDEV-Kurs: bitbucket.org/jenerateit/tutorial-smart-production-monitoring
Thank you!
 Summary
 Questions
 Outlook
32Generative Software GmbH
Marcus Munzert
CEO and President
munzert@generative-software.com
Generative Software GmbH
Cornelia-Schlosser-Allee 15
79111 Freiburg
Germany
www.generative-software.de
www.virtual-developer.com

Java User Group Freiburg - Internet of Things für Java-Entwickler

  • 1.
    Generative Software GmbH JavaUser Group Freiburg 5. März 2018 Internet of Things für Java-Entwickler 1
  • 2.
    Agenda  What isIoT?  IoT Gateway with Eclipse IoT  The Story of the Smart Greenhouse  Live-Demo of the Smart Greenhouse  The Architecture of an IoT Gateway 2Generative Software GmbH
  • 3.
  • 4.
    Goals of IoTSolutions  Transparency – what is going on?  Traceability – what was going on?  Prediction – what will be going on?  Emergency – what is badly wrong?  Optimization – what to do to improve processes?  Agility – what intervention makes sense?  Automation – what can be done by machines? 4Generative Software GmbH
  • 5.
    Sensor Categories 5Generative SoftwareGmbH Gateway, Server, Cloud Passive Active – Always On Active – Wake Up Gateway, Server, Cloud Gateway, Server, Cloud Microprocessor
  • 6.
    Where to useSensor Data 6Generative Software GmbH Time Frame On Device (Edge) On Stream (Fog) In Batch (Cloud) Hours to Weeks In Database Strategic Insight Machine Learning Minutes to Hours In Process Performance Insights Summary Statistics Seconds to Minutes Operational Insight Rules Engine Microseconds to Seconds Signal Processing IoT Gateway
  • 7.
    Protocols 7Generative Software GmbH HTTPCoAP AMQP XMPP MQTT Architecture Request/Response Request/Response Point-to-Point Publish/Subscribe Request/Response Publish/Subscribe Publish/Subscribe Representation Text, Binary Binary Binary Text Binary Transport TCP UDP TCP TCP TCP Security (Transp.) TLS DTLS TLS TLS TLS Discovery No Yes No No No Scope Device-to-Cloud Device-to-Device Device-to-Cloud Cloud-to-Device Device-to-Cloud Cloud-to-Device Device-to-Cloud Cloud-to-Device Suitable for Constr. Devices Possibly Yes Possibly Possibly Yes Server Updates Pull Pull, Push Push Push Push
  • 8.
    Networks 8Generative Software GmbH DataUnit OSI Layer Examples Host/Service Layers Data Application HTTP, FTP, ‚IoT Protocols‘ Peer-to-Peer Protocols Presentation TLS, SSL Session NetBIOS Segment/Datagram Transport TCP, UDP Network Protocols Device/Media Layers Packet/Datagram Network IP, ARP, ICMP, IPSec Frame Data Link Ethernet, ATM, PPP Bit Physical Ethernet, WiFi, USB, Bluetooth, SPI, I2C
  • 9.
    Eclipse IoT 9Generative SoftwareGmbH  Working Group – Members: 39 (Mar 2018), RedHat, SAP, Intel, Bosch, Canonical, Cloudera, DB Systel, Huawei, IBM, Siemens, Sierra Wireless, … – Community: IoT Testbeds, Youtube, Meetups, Whitepapers, Surveys, Conferences, Open IoT Challenge …  Technology – Eclipse Projects: Paho, Kura, Californium, Mosquitto, Vorto, Milo, Kapua, Hono, HawkBit, … – Standards: CoAP, MQTT, OPC UA, OMA LWM2M, … – Programming Languages: Java, C, C++, Python, …
  • 10.
    OSGi 10Generative Software GmbH Originally: Open Services Gateway initiative  Today: OSGi Alliance (defines APIs and Test Cases)  Open, modular and scalable „Service Delivery Platform“  Java-based  Well-known Open Source Frameworks: – Knoplerfish – Eclipse Equinox – Apache Felix – Concierge  Modularization with so-called „Bundles“  Visibility of Java Packages  Semantic Versioning of Java Packages  (Declarative) Services
  • 11.
  • 12.
    Requirements for theIoT Greenhouse  Show all Sensor Values on a Display  Control Plant Lamp depending on Luminocity  Control Water Pump depending on Soil Humidity  Control Heating depending on Air Temperature  Switch on a Buzzer when Gas Sensor detects Gas  Send Sensor Data to a Server and store it there 12Generative Software GmbH
  • 13.
    Buy an IKEAMini Greenhouse … 13Generative Software GmbH
  • 14.
    … assemble it… 14Generative Software GmbH
  • 15.
    … fill itwith Hardware … 15Generative Software GmbH
  • 16.
    … add Softwareto it … 16Generative Software GmbH
  • 17.
    … connect itwith a Network … 17Generative Software GmbH
  • 18.
    … and readyis the Smart Greenhouse
  • 19.
    Software Stack Eclipse IoT Kura (IoT Gateway Software, Java+OSGi)  Mosquitto (MQTT Broker)  Paho (MQTT Client)  Californium (CoAP) Jakarta EE  JAX-RS  JAXB  JSF  Servlets  EJB  JPA 19Generative Software GmbH
  • 20.
    The Smart Greenhouse- Details 20Generative Software GmbH IoT Gateway (Raspberry Pi 2) Kura, Paho, Californium IoT Server Paho, Californium Glassfish 4.1 Java EE Network Connection Sensors MQTT Broker Mosquitto Actuator „LED Strip“ Hose to Actuator „Pump“ LCD Display
  • 21.
    What shall theIoT Solution do? 1. Read Sensors with the Kura IoT Gateway 2. Execute Business Logic with the Kura IoT Gateway 3. Send Sensor Data to Mosquitto with Paho (MQTT) 4. Collect Sensor Data with Paho and Servlets 5. Persist Sensor Data by Means of a REST API (JAX-RS, EJB, JPA) 6. Display Sensor Data by Means of a JSF Web App (uses same REST-API) 7. Control Actuators with a JSF Web App and Californium (CoAP) 8. Execute Business Logic on a Server with Paho and EJBs 21Generative Software GmbH
  • 22.
  • 23.
    MQTT (Message Queue TelemetryTransport) 23Generative Software GmbH Message Broker Publisher Subscriber publish to … client-id/app-id/temperature subscribe to … client-id/app-id/temperature 1 2 SubscriberPublisher
  • 24.
    MQTT 24Generative Software GmbH [account-name]/[client-id]/[app-id]/[resource-id]  Subscription Wildcards # … e.g. client-id/app-id/# client-id/app-id/temperature client-id/app-id/plant/light client-id/app-id/plant/moisture + … e.g. client-id/app-id/+/light client-id/app-id/plant/light  Do not subscribe to # (all messages)
  • 25.
    CoAP (Constrained Application Protocol) 25GenerativeSoftware GmbH CoAP Server CoAP Client GET request: coap://<CoAP-Host>:5683/temperature response GET PUT POST DELETE 1 2 3
  • 26.
    OSGi Container Eclipse Kura Paho CoAP OpenJDKI/O Californium … Paho Publisher Device Service Simulation MQTT Service Interfaces Legende Service-Aufrufe Data Flow OSGi Bundle Simulationsdaten Sensordaten simulieren und verschicken 26Generative Software GmbH
  • 27.
    OSGi Container Eclipse Kura Paho CoAP OpenJDKI/O Californium … Paho Publisher Business Logic Device Service Simulation MQTT Service Interfaces Legende Service-Aufrufe Data Flow OSGi Bundle Simulationsdaten Gateway-Logik simulieren 27Generative Software GmbH
  • 28.
    Device Access withJava  OpenJDK Device I/O: GPIO, I2C, UART, SPI  TinyB: Bluetooth LE  Pi4J: Object-Oriented API to access I/O Capabilities of Raspberry Pi 28Generative Software GmbH
  • 29.
    Kura Eclipse Kura Paho CoAP OpenJDK I/O Californium … Kura DataService Device Service MQTT Service Interfaces Legende Service-Aufrufe Data Flow OSGi Bundle Echte Sensordaten verschicken 29Generative Software GmbH
  • 30.
    Kura Eclipse Kura Paho CoAP OpenJDK I/O Californium … Kura DataService Business Logic Device Service MQTT Service Interfaces Legende Service-Aufrufe Data Flow OSGi Bundle Gateway-Logik implementieren 30Generative Software GmbH
  • 31.
    Tutorials on Githuband Bitbucket 31Generative Software GmbH Eclipse Tutorial: github.com/kartben/kura-greenhouse-demo Greenhouse Tutorial: bitbucket.org/jenerateit/tutorial-smart-greenhouse Tutorial IOTDEV-Kurs: bitbucket.org/jenerateit/tutorial-smart-production-monitoring
  • 32.
    Thank you!  Summary Questions  Outlook 32Generative Software GmbH Marcus Munzert CEO and President munzert@generative-software.com Generative Software GmbH Cornelia-Schlosser-Allee 15 79111 Freiburg Germany www.generative-software.de www.virtual-developer.com