62
IoT with the best Paris 2016-01-16 VSCP Åke Hedman Maintainer VSCP (Very Simple Control Protocol) Founder Paradise of the Frog

Ake hedman why we need to unite and why vscp is a solution to a problem

Embed Size (px)

Citation preview

Page 1: Ake hedman  why we need to unite and why vscp is a solution to a problem

IoT with the bestParis 2016-01-16

VSCP

Åke HedmanMaintainer VSCP (Very Simple Control Protocol)

Founder Paradise of the Frog

Page 2: Ake hedman  why we need to unite and why vscp is a solution to a problem

Disclaimer

VSCP is not seeking world domination

Does not handle the 15 second rule well

Stay foolish – Be hungry

Page 3: Ake hedman  why we need to unite and why vscp is a solution to a problem

State of things

● Vertical, vertical, vertical, vertical...● A lot of transport mechanisms.● A number of standardization efforts (AllSeen

alliance, IPSO alliance, Tread Group, Eclipse IoT, etc etc etc )

● IoT???????

Page 4: Ake hedman  why we need to unite and why vscp is a solution to a problem

IoT - What is it?

● INTERNET of THINGS● INTERNET = INTER + NET● THINGS● Not just wireless, not just protocol A, not just...● Connecting nets together. ● Intranet of things● In the end its just about Connecting things together● Enables Big Data mining.

Page 5: Ake hedman  why we need to unite and why vscp is a solution to a problem

Problems

Page 6: Ake hedman  why we need to unite and why vscp is a solution to a problem

Problems

● We must know that a device is there and what it can do (Discovery).

● Devices from different manufacturers must understand each other (Message format).

● We need a common way to tell devices what to do (Configuration).

● We need a common way to update firmware of the devices (Firmware update).

● SECURITY!!!!

Page 7: Ake hedman  why we need to unite and why vscp is a solution to a problem

Real world

Messages

Measurements

Page 8: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

42

Page 9: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

● “Answer to the Ultimate Question of Life, the Universe, and Everything.” - The Hitchhiker's Guide to the Galaxy by Douglas Adams

● The approximate length of a marathon in kilometres

● The atomic number for Molybdenum● ...or other things.

Page 10: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

● It's still 42 if sent over a MQTT channel.● ...or in an UDP packet.● ...or sent over a highly secured link.● ...or sent over a wireless mesh network.● ...or sent from a mainframe.● ...or received by the smartest person/machine

in the universe.

Page 11: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurement

● So the conclusion is that the receiver has to know that “42” is a temperature measurement for the value to be useful at that receiving end.

● So we have to add “information” to the value.

Page 12: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

So if we know it's a temperature measurement?

Page 13: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

Typically solved as

by JSON

{

“measurement”: {

“type”: “temperature”,

“value”: 42,

}

}

or in XML

<measurement>

<value type=”temperature”>42</value>

</measurement>

Page 14: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

Still not perfect

Page 15: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

Typically solved as

by JSON

{

“measurement”: {

“type”: “temperature”,

“unit”: “kelvin”,

“value”: 42,

}

}

or in XML

<measurement>

<value type=”temperature” unit=”kelvin”>42</value>

</measurement>

Page 16: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurement

● Wasteful. ● Over air/cable.● In RAM of low end device.● On resources on low end device.

Page 17: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements - VSCPTypically solved as

in JSON

{

“measurement”: {

“head”:0,

“class”: 10,

“type”: 6,

“unit”: 0,

“sensorindex”: 0

“coding”:

“value”: 42,

}

}

in XML

<measurement head=”0” class=”10” type=”6” >

<value type=”temperature” unit=”kelvin”>42</value>

</measurement>

Page 18: Ake hedman  why we need to unite and why vscp is a solution to a problem

Measurements

● SI system.● Well defined data.● Compare with web.

Page 19: Ake hedman  why we need to unite and why vscp is a solution to a problem

On/Off

● Same thing. ● Some send literal “on” and “off”● Others send literal/binary “0” and “1”● Even others send “في” and “بعيدا”

● Or even “ 上の” and “ オフ”● Hard to know what a device is expecting and

equally hard to understand what to do when received.

Page 20: Ake hedman  why we need to unite and why vscp is a solution to a problem

VSCP way

Start with the lowest level

Page 21: Ake hedman  why we need to unite and why vscp is a solution to a problem

How VSCP does it

● Lowest common denominator is the CAN frame● CAN packet size (8-bytes) .● Binary

Page 22: Ake hedman  why we need to unite and why vscp is a solution to a problem

How VSCP does it

● Two levels. Level I and Level II. Mainly differ in packet size.

● What other calls messages we call EVENTS● VSCP is an application level protocol.● On,off,TurnOn,TurnOff etc etc etc etc has a well

defined format.● Events identified by a class (sort of group) and a

type. Temperature for example is CLASS1.MEASUREMENT, Type=6

Page 23: Ake hedman  why we need to unite and why vscp is a solution to a problem

How VSCP does it

● VSCP Level I have a maximum of 512 classes defined (alarms, measurements, information, protocol,.......growing) each with 255 possible types.

● VSCP Level II have a maximum of 65536 classes and where each can have 65535 types.

Page 24: Ake hedman  why we need to unite and why vscp is a solution to a problem

Turning on “something” in VSCP

● So turning on “something” in VSCP is done by sending a CLASS1.CONTROL, Type=5 (TurnOn) event .

● Most often the device(s) that is turned on reply with CLASS1.INFORMATION, Type=3 (On) Event(s) .

● Similar CLASS1.CONTROL, Type=6 (TurnOff) event turn “something” off and expects CLASS1.INFORMATION, Type=4 (Off) Event(s) .

Page 25: Ake hedman  why we need to unite and why vscp is a solution to a problem

Requires content of Level 1 event

● Flags: 7 bits (priority, hardcoded). ● VSCP Class: 9-bits.● VSCP Type: 8-bits● Nickname: 8/16/(24/32)-bits.● Data: 0-8 bytes.

Page 26: Ake hedman  why we need to unite and why vscp is a solution to a problem

CAN4VSCP

● 32-bit id.● Nickname is 8-bits. Can be discovered or hard

coded.● 0-8 data bytes.

Page 27: Ake hedman  why we need to unite and why vscp is a solution to a problem

Other events

Page 28: Ake hedman  why we need to unite and why vscp is a solution to a problem

TurnOn Event over CAN4VSCP

● 32-bit id containing priority, class,type and nickname described here.

● VSCP-Class =30 (CLASS1.CONTROL)● VSCP-Type=5 (TurnOn)● Three data bytes● Byte 0: User specified. Usually set to zero.● Byte 1: Zone● Byte 2: Subzone

Page 29: Ake hedman  why we need to unite and why vscp is a solution to a problem

But TurnOn can look like this to

in JSON

{

“vscpevent”: {

“priority”:0,

“vscpclass”: 10,

“vscptype”: 6,

“guid”: “”

“data”: {0,0,0}

}

}

in XML

<vscpevent priority=”0” vscpclass=”30” vscptype=”5” guid=”” data=”” />

Page 30: Ake hedman  why we need to unite and why vscp is a solution to a problem

General VSCP Properties

● Application level protocol.● No server needed.● Not addressed.● Free.● Open.● KISS (Keep It Simple Stupid).

Page 31: Ake hedman  why we need to unite and why vscp is a solution to a problem

Discovery

Page 32: Ake hedman  why we need to unite and why vscp is a solution to a problem

Discovery

● How do we know things are available?● Beacons● Heart beats

Page 33: Ake hedman  why we need to unite and why vscp is a solution to a problem

How VSCP do it

● Every node send a heartbeat at least once a minute.

● Possible to scan for nodes.● When a node identify itself it itself contain the

key to its configuration and usage.

Page 34: Ake hedman  why we need to unite and why vscp is a solution to a problem

Configuration

Page 35: Ake hedman  why we need to unite and why vscp is a solution to a problem

Configuration

● We always need a way to tell things what to do and how to do it before they become useful for us.

● Pre Windows and HAL sometimes 30 diskettes for drivers one for the application. HAL was the thing that made it happen.

● Just as HAL abstracts hardware we need abstractions for black boxes.

Page 36: Ake hedman  why we need to unite and why vscp is a solution to a problem

The black box

Page 37: Ake hedman  why we need to unite and why vscp is a solution to a problem

The black box

Page 38: Ake hedman  why we need to unite and why vscp is a solution to a problem

The black box

● And they all are all different inside.● They (almost) always need a manual to

understand how to configure them.● “Where is the manual...”●

Page 39: Ake hedman  why we need to unite and why vscp is a solution to a problem

How VSCP do it

Page 40: Ake hedman  why we need to unite and why vscp is a solution to a problem

How does VSCP do it?

● The IC Circuit is a successful black box In the real world.

● Scale well● Can talk to other IC's● Is configured with “switches” or registers.

Page 41: Ake hedman  why we need to unite and why vscp is a solution to a problem

Register Abstraction Model

● So a VSCP black box have a set of registers. Standard registers. User registers.

● Every register is 8-bits wide. ● There is 128 registers (Standard registers)

reserved on every node that must be there.● Level I: 128 * 65536 registers that the maker of

the device can use.● Level II: 32-bit address pointer.

Page 42: Ake hedman  why we need to unite and why vscp is a solution to a problem

Register Abstraction Model – Standard registers

● GUID – Globally unique id.● Pointer to MDF (Module description file).● Boot loader algorithm.● Hardware version.● Firmware version.●

Page 43: Ake hedman  why we need to unite and why vscp is a solution to a problem

GUID

● GUID is a 128 bit globally unique id that identify a unit.

● A nickname (8/16 bit) can be used on a local bus to save bandwidth..

● GUID's can map to many other globally unique id's. See Specification.

● GUID series can be requested for free from [email protected]

Page 44: Ake hedman  why we need to unite and why vscp is a solution to a problem

Module Description File (MDF)

● XML-file that describe the module.● Normally fetched from an Internet location but can be fetched from the

device directly to.● Defines registers and there content.● Defines abstractions (high level data types).● Define events sent by node and there content.● Define actions the nodes decision matrix can generate.● Defines setup wizards.● Firmware update information.● Points to contact info of maker, manual for device, firmware, pictures, is

multilingual and a lot more.

Page 45: Ake hedman  why we need to unite and why vscp is a solution to a problem

Abstractions

● Present register content as high level data types.● bool● string● long● float/double● guid● Etc etc.

Page 46: Ake hedman  why we need to unite and why vscp is a solution to a problem

Decision Matrix

● Optional.● Configure what action a node should perform

when it receives an event.● For example turn on relay one when a TurnOn-

event is received.

Page 47: Ake hedman  why we need to unite and why vscp is a solution to a problem

Decision Matrix

● Optional.● Configure what action a node should perform

when it receives an event.● For example turn on relay one when a TurnOn-

event is received.

Page 48: Ake hedman  why we need to unite and why vscp is a solution to a problem

Setup wizards

● A assisted guide to follow, to get a specific functionality of a device, described in XML.

● Report temperature in degrees Fahrenheit every minute and alarm me if temperature goes over 77 degrees or below 32.

● Can be read and served by all UI's (phones/PC's/tablets/browsers/applications/...)

Page 49: Ake hedman  why we need to unite and why vscp is a solution to a problem

Firmware update

Page 50: Ake hedman  why we need to unite and why vscp is a solution to a problem

Firmware update

● Standard algorithm.● Device specific algorithms.● Who can/is allowed to do it.● Protect copying of products.

Page 51: Ake hedman  why we need to unite and why vscp is a solution to a problem

Implementation

● 2.5K overhead in flash. ● A few bytes of RAM● Can be implemented alongside proprietary

solution.

Page 52: Ake hedman  why we need to unite and why vscp is a solution to a problem

Security

● SSL (TCP/IP)● Aes (Multicast, raw ethernet, wireless)● Other.

Page 53: Ake hedman  why we need to unite and why vscp is a solution to a problem

Multicast

● Used for discovery.● Used to form subnets/groups.

Page 54: Ake hedman  why we need to unite and why vscp is a solution to a problem

Raw Ethernet

● No need for a tcp/ip stack.● Very low on recources.● Do normally not pass a router.

Page 55: Ake hedman  why we need to unite and why vscp is a solution to a problem

For the end user

● A node is discovered.● Get MDF from it. ● Configure the node.● Make it interact with other nodes.● Use wizard to get help to set up a device to do

“something”.● Same every time.

Page 56: Ake hedman  why we need to unite and why vscp is a solution to a problem

Tools

● The VSCP daemon● VSCP Works● VSCP Helper library● Javascript library with HTML5 widgets (websocket)● Firmware code for multiple platforms.● Examples.● Windows/Linux(Pi/Beaglebone)

Page 57: Ake hedman  why we need to unite and why vscp is a solution to a problem

The VSCP Daemon

● The VSCP “server”.● TCP/IP interface. This interface is a superset of a general tcp/ip interface that

can be implemented by devices.● Drivers for everything can be connected. Can be used to abstract non “VSCP

things” to look like they are “VSCP things”. Or the other way around. Many driver available.

● Multicast interface.● Advanced internal decision matrix.● Built in webserver.● Websocket interface● REST interface (plain text/CSV/JSON/JSONP/XML).● Soon built in MQTT and CoAP support.

Page 58: Ake hedman  why we need to unite and why vscp is a solution to a problem

VSCP Works

● Investigate what is happening on local or remote bus.

● Interact with nodes.● Discover nodes.● Configure nodes.● Load firmware into devices.● And more...

Page 59: Ake hedman  why we need to unite and why vscp is a solution to a problem

VSCP Helper library

● C library for Windows/Linux● Bindings for many programming tools available

or on the way.● Many functions to handle VSCP related tasks.● Can be used to connect to a remote VSCP

daemon in an easy way.

Page 60: Ake hedman  why we need to unite and why vscp is a solution to a problem

Javascript library

● Interface the efficient websocket interface.● Buttons.● Gauges.● Diagrams● Tables.

Page 61: Ake hedman  why we need to unite and why vscp is a solution to a problem

...and more

● A lot more.

Page 62: Ake hedman  why we need to unite and why vscp is a solution to a problem

The End

● Contribute to the project (http://www.vscp.org)● Vote for VSCP in Postscape IoT Open source award

http://iotawards.postscapes.com/2015-16/top-iot-open-source-project

● Documentation is here http://vscp.org/#documentation● Getting started guides is here

http://www.vscp.org/wiki/doku.php/howto/start● Software is here

https://github.com/grodansparadis/vscp/releases● Thanks