Das Internet of Things lässt sich Systemtechnisch in drei Bereiche einteilen: Constrained Devices, Gateways und Cloud Platforms. Im Bereich der Cloud hat Java ein Heimspiel. Und auf constrained Devices ist Java immer noch eher eine Randerscheinung. Doch auf dem Verbindungsstück, dem IoT Gateway, kann Java all seine Stärken ausspielen.
In diesem Vortrag wird gezeigt, wie man als Java-Entwickler mit ein paar Eclipse IoT Projekten und einem Raspberry Pi ein IoT Gateway prototypisieren kann. Es werden dabei auch nicht-Java-Themen wie zum Beispiel Sensorik und General Purpose Input Output (GPIO) gestreift. Zur Veranschaulichung wird ein für Demonstrationszwecke selbstgebautes, smartes Mini-Gewächshaus mitgebracht, in dem einige Sensoren und Aktoren verbaut sind und dessen Software mit Java entwickelt ist.
2. 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
4. 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
5. Sensor Categories
5Generative Software GmbH
Gateway, Server, Cloud
Passive
Active – Always On
Active – Wake Up
Gateway, Server, Cloud
Gateway, Server, Cloud
Microprocessor
6. 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
7. 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
8. 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
12. 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
13. Buy an IKEA Mini Greenhouse …
13Generative 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 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
26. 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
27. 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
28. 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