• No results found

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

N/A
N/A
Protected

Academic year: 2021

Share "End-to-end IoT solutions with Java and the Eclipse IoT stack"

Copied!
38
0
0

Loading.... (view fulltext now)

Full text

(1)

End-to-end IoT solutions

with Java and the

(2)
(3)
(4)
(5)

End-to-end IoT?

Actuators/Sensors + Gateway + [ Cloud ] + User front-end

(6)

1. Sensors/Actuators

➔ Sense the physical environment ➔ Act on it

(7)

1. Sensors/Actuators

➔ Sense the physical environment ➔ Act on it

That was

easy, eh?

(8)

1. Sensors/Actuators

➔ Manipulate sysfs directly

➔ Use Pi4J to have full support of GPIO/I2C/SPI

(9)

Sensors/Actuators

➔ Pi4J – http://pi4j.com

✓ Complete access to GPIOs/I2C/SPI

✓ Very mature codebase, based on WiringPi ✓ Support for popular shields (PiFace,

Gertboard, …)

(10)

Pi4J in action

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();

(11)
(12)
(13)
(14)

Gateway

Connect

sensors to the world and software running at Manage the hardware the edge

(15)

Connect?

➔ CoAP

✓ « HTTP over UDP »

✓ Expose your device as a resource to the Internet of Things

➔ MQTT

✓ Publish/Subscribe model

(16)

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

(17)

Eclipse Californium

➔ Focus on scalability and usability ➔ To be used in IoT cloud servers or

M2M/IoT devices running Java ➔ Includes DTLS implementation

(Scandium),

(18)

Californium 101

oapSe e , oapResou e, oapEx han e

1. Implement custom resources (extend oapResou e)

2. Add resources to the CoAP server 3. Start the server

(19)

Californium 101

mpo s a o .e pse. a o n um. o e. oap. oAP.Response ode.*; // sho u s pub ass M Resou e ex ends oapResou e {

@O e de

pub o d hand eGET( oapEx han e ex han e) {

ex han e. espond("he o wo d"); // ep w h 2.05 pa oad ( ex /p a n)

}

@O e de

pub o d hand ePOST( oapEx han e ex han e) {

ex han e.a ep (); // ma e a sepa a e esponse

(ex han e. e Reques Op ons() ...) {

// do some h n spe o he eques op ons

}

ex han e. espond( REATED); // ep w h esponse ode on (sho u )

} }

(20)

MQTT: Publish & Subscribe

Sub KETTLE232/# Pub KETTLE232/temp Payload: 21°C Pub KETTLE232/temp Payload: 21°C BROKER

(21)

Eclipse Paho

➔ Open-source MQTT clients ➔ Pick your language!

✓ Java

✓ JavaScript

✓ C/C++, Objective C

(22)

Paho 101 (Java)

Mq en new Mq en (" p:// o .e pse.o :1883",

Mq en . ene a e en Id()); mq en .se a ba (new Mq a ba () {

@O e de

pub o d messa eA ed(S n op , Mq Messa e messa e) h ows Ex ep on { // p o ess e e ed messa e // ... } }); mq en . onne ();

(23)

MQTT brokers

➔ Eclipse Mosquitto

✓ C implementation

✓ Scalable (1000 clients == 3MB RAM)

➔ Eclipse Moquette

✓ Java implementation

(24)

Manage?

➔ Gateway itself

✓ wireless modem, firewall, …

➔ Applications

✓ Install/Uninstall software packages ✓ Start/Stop applications

➔ Sensors

(25)

Java VM

OSGi Application Container

Device Abstraction Gateway Basic Services

Network Configuration

Network Management Field Protocols Connectivity and Delivery

Administration GUI

Operation & Management

Linux Hardware

App 1 App 2 . . . . App n

Applications

(26)

Installing Kura

d ~

sudo ap - e upda e

w e h ps://s3.amazonaws. om/ u a_down oads/ aspb an/ e ease/1.1.0/ \

u a_1.1.0_ aspbe -p _a m 6.deb

sudo dp - u a_1.1.0_ aspbe -p _a m 6.deb

sudo ap - e ns a

(27)

First steps with Kura

➔ Network management

✓ Cellular Modem, WiFi ✓ Firewall

✓ NAT

➔ OSGi and system administration

(28)

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)

(29)
(30)

Practical example: Greenhouse

➔ A Senso Se e implementation leveraging Pi4J

for GPIO/I2C

➔ A configurable G eenhousePub she component that:

✓ consumes a Senso Se e (GPIO manipulation)

✓ consumes a Da aSe e (MQTT communication)

✓ exposes a Senso han edL s ene (be notified of external GPIO updates)

(31)

Talk is cheap…

(32)

And how about CoAP?

➔ Californium can easily be embedded in a Kura bundle

➔ Another OSGi component can:

✓ consume the Senso Se e ✓ expose CoAP resources

(33)

End-user interaction

➔ JavaFX Charts ➔ Eclipse BIRT

➔ Smartphone app (e.g Android)

✓ https://www.eclipse.org/paho/clients/android

➔ MQTT + WebSockets = ♡

(34)

If you had to remember only 3 things...

Kura is awesome! Go download it now! http://eclipse.org/kura

(35)

If you had to remember only 3 things...

Build your own greenhouse & follow the tutorial

http://iot.eclipse.org/java/tutorial

(36)

If you had to remember only 3 things...

Eclipse Open IoT Stack for Java is much more than Kura

http://iot.eclipse.org/java

(37)
(38)

Thank you! Questions?

[email protected]

@kartben

References

Related documents

Assess the feasibility of developing, administering and using an Ontario-wide database that would allow Health and Safety Associations and workplaces to benchmark performance

PERFORMANCE OF SCHOOLS IN ALPHABETICAL ORDER. ABRA

Transfer the membrane to a glass tray filled with 200ml of washing solution I.. Shake the glass tray at RT for

This lesson is complete when the student can maintain flight within 150 feet, 15 degrees, and 15 knots, and successfully complete all review questions following the assigned

Second, attentional and executive control are thought to be processes affected by anxiety and to explain poor performance to cognitive tasks in anxious individuals. Third, I

The RNZCGP is working with the Cook Islands Ministry of Health on setting up a programme for Cook Island generalist doctors to train in generalist practice/rural hospital medicine

Paragraph 2 of Rule XXIV further restricts the notion of a port of refuge. It envisages the case in which the master, as a result of low water, is obliged to enter a port of refuge

The more counterintuitive finding of this study is that introducing a monetary reward to stimulate new product ideation might in some cases backfire and be detrimental to