49
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH Pimping up Industry Devices with Rasperry Pi, Vert.x und Java 8 @ atsticks Anatole Tresch Principal Consultant

Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

  • Upload
    buithuy

  • View
    218

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA

HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH

Pimping up Industry Devices with

Rasperry Pi, Vert.x und Java 8

@atsticks

Anatole Tresch – Principal Consultant

Page 2: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Anatole Tresch

Open Source Enthusiast

Apache PPMC Member

Consultant, Trainer, Software Architect for Java and Container Technologies

Oracle Star Spec Lead

More than 25 years of software development experience

Contact: [email protected]

Blog: http://maketechsimple.wordpress.com

Slideshare: http://www.slideshare.net/anatoletresch

Twitter: atsticks

Page 3: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Agenda

3

1. Once upon a time…

2. The Requirements

3. Insights

Connection Endpoints

The Protocol Data

Event Handling

Pandora’s Box

4. Business Value and Future

Page 4: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Houston, we

have a

problem…

Page 5: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

How it all started…

• A phone call

• A kick-off meeting

• Agile Setup

• An offer

• A prototype

• A successful demo

• …

Page 6: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

What ?

Give me some

context…

Page 7: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The Machines

http://www.belimed.com

Page 8: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The Management System

• Windows Application

• Can be connected to multiple machines

• Used for

• Monitoring

• Auditing & History

• Machine Configuration

Page 9: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Deployment View

Network Issues

- Failures

- Process failures

- Outages

- IP Config Lost or invalid

- IP Setup Changes- Software Updates

- Outages

Cabling, Connector

Issues

Page 10: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

10

What the Customer wanted

(aka Requirements)

Page 11: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The Requirements for the Retrofit-Box (RFBox)

• Ensure Audit can be done in case of

• Network Failures

• Printer Failures

• The Box hereby

• should be transparent to the management system

• can be attached to different machines and interfaces

• runs with no outages

• is transparent to the machine

Page 12: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Solution

Page 13: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The system context

Page 14: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

14

Insights

Page 15: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Connection Endpoints

Page 16: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Serial Communication RS485

Page 17: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

• STX (Start of TXT)

• RS 485: 0x02 in payload need tobe masked by 0x00

• IP: no 0x02 masking

• 5 <= LEN <= 255

• 3 <= CMD <= 255

• 0 <= DATA <= 250

• CHK:• CHK = 0x00

• Repeat for all bytes:• CHK << 1

• CHK += Carry

• For IP: always 0x00

The Binary Protocol - Structure

Page 18: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The Binary Protocol - Datatypes

Page 19: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The Binary Protocol – Example (Status Response)

Page 20: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Detailed Example: Status Request

Page 21: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Machine Response - Examples

STXLENNODECMDPAYLOADCHK

Silence:

02380470000000010000000000000020002000200020002000200020002000200020002000200020002000200020

00200020002000200076

STXLENNODECMDPAYLOADCHK

Process start:02800472050000011e00000001000049004300530020005400650073007400200020002000200020002000200020002000200

02000200020002000200020002000200020002000200020002000200020002000200020002000200020002000330031002e00

310032002e003200300031003500560034002e0030003000200010

Process data (1/second, cycle duration: 10-40 minutes)022e040f01000001000000000000011e0000000100000b00007d010000000000000000000000004f000000000083

022e040f01000001000000000000001e0000000100000b00007b010000000000000000000000004f000000000033

022e040f01000001000000000000001e0000000100000b00007a010000000000000000000000004f00000000002b

022e040f01000001000000000000001e0000000100000b000078010000000000000000000000004f00000000001b

022e040f01000001000000000000001e0000000100000b000077010000000000000000000000004e0000000000f2

022e040f01000001000000000000001e0000000100000b000076010000000000000000000000004e0000000000ea

022e040f01000001000000000000001e0000000100000b000074010000000000000000000000004e0000000000da

022e040f01000001000000000000001e0000000100000b000073010000000000000000000000004e0000000000d2

022e040f01000001000000000000001e0000000100000b000072010000000000000000000000004e0000000000ca

022e040f01000001000000000000001e0000000100000b000071010000000000000000000000004e0000000000c2

022e040f01000001000000000000001e0000000100000b00006f010000000000000000000000004d000000000092

022e040f01000001000000000000001e0000000100000b00006e010000000000000000000000004d00000000008a

022e040f01000001000000000000001e0000000100000b00006d010000000000000000000000004d000000000082

Process end:02190410400000011e0000000000000072010000000000005

Page 22: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Event Handling

22

All Communications are handled

also internally asynchronousl via

the Vertx event bus.

Page 23: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

23

Opening the

Pandora’s Box…

Page 24: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Internal Components

24

Page 25: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Internal Components – Level 1

25

Page 26: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Mini UPS, LEDs, Boxing

• Protection

• Coverage from Humidity and Heat

• Simple User Interface

(Controllable LED Button)

• Unit of Shipment

• Connectivity to Power, RS 485

Buses, IP, Printer

Page 27: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Control Scripts

• LED Blinking

• Voltage Monitoring, Controlled Shutdown, Prevent Startup

• Button Action Handling

• Respawning of failed processes

Page 28: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Symbian Linux

• Read-Only System FS

• Automatic Application Process Startup

• SSH Server

• TCP/IP Stack

Page 29: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Configurator

• Authentication

• Configuration file import

• 18n file import

• RFBOX main process jar updates and restarts

• Based on

• Java 8

• Will probably be replaced with rpm packaging/apt

Page 30: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Main Application

• Main RFBOX application

• Based on

• Java 8

• Vertx.io

Page 31: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

RFBox Application Components

Page 32: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Business Value & Future

Page 33: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Imagine…

Page 34: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

We have an installation base of thousands of

machines world wide…

Page 35: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Customers expect very fast reaction times…

Page 36: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Customers expect quality services…

Page 37: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

So if you would know always…

Page 38: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…when machines failed,

Page 39: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…when machines show deviations

(=they will make troubles in the future),

Page 40: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…how much the machines have been used

and

Page 41: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…whatever else the collected data may

show…

Page 42: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…that would be nice, wouldn’t it?

Page 43: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

BUT…

Page 44: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…the best thing is…

Page 45: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

…you know it before your customer does!

Page 46: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

The IOT Gateway Project

Global

IOT

Gateway

Page 47: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Summary

Page 48: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

Summary

• All Started with a small fast prototype

• Building Industry Devices is hard and interdisciplinary

• Building Medical Devices is even harder

• Low Level programming with Java is fun

• If you have to deal with asynchronous events use a good library from scratch

• Vertx and Java 8 are awesome

Page 49: Pimping up Industry Devices with Rasperry Pi, Vert.x und ... · PDF fileba sel bern brugg ' h66(/'25) frankfur t a. m. freiburg i. br. genev a hamburg copenhagen lausanne munich stuttgar

@atsticks maketechsimple.wordpress.com

[email protected]

Anatole Tresch

Principal Consultant