PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS,...

31
www.nabto.com PLATFORM FOR THE INTERNET OF THINGS

Transcript of PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS,...

Page 1: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

www.nabto.com

PLATFORM FOR

THE INTERNET OF THINGS

Page 2: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

AGENDA

• What is Nabto

• Architecture

• Devices as web servers

• Programming a micro web server

• Client API

• Live examples

Page 3: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

PROBLEM?

Devices

Internet

User • Firewalls and security • Server bottlenecks • Complex development • HTML design for different purpose

Page 4: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

CONNECT – SIMPLE AND SECURE

Nabto’s vision: Develop a communication platform for the “Internet of things”. The platform solves the following issues:

• Connect: Remote (browser) access – Increase end-user value of your product by offering

remote access

• Simple: Simple platform – Lower development and maintenance cost of your

firmware

• Secure: Maximal security – Nabto is build upon state-of-the-art security

Page 5: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

NABTO – THE PRODUCT

UDP stack

System On Chip

Nabto uServer Client

Cloud service: Base station

Direct interactive P2P connection

Nabto Client

API

A software platform for the ”Internet Of Things” With a peer-to-peer interactive client pull focus

Connect Request

- Identification - Data-push - Awareness

Page 6: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

EXISTING DESIGN

Device Software

Vendor API Client

Cloud service: Relay

Compared to existing design

HTTP - Data-push - Awareness

Notice: • All data relayed through the cloud service (performance, security issues) • No internet = no interface and access • All HMI computing is central • Latency is suboptimal • HMI computing is not (necessarily) encapsulated modular

Page 7: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

NO INTERNET – NO PROBLEM

Browser Nabto

Browser Plugin

Nabto uServer

Embedded Logic

PC Nabto device

2. I’m here : IP address

3. nabto:// connection

NB: LAN can be just a net-cable from Laptop to device

1. Broadcast : are you on LAN?

Page 8: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

WEB SERVERS

What they got

Standard Internet-platform: Expensive

Complex

What they need

Nabto platform:

Inexpensive

Simple

NB: HTTP was created a CERN for another problem type

Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ...

Page 9: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

MOVE THE COMPLEXITY TO THE CLIENT

Browser Nabto

Browser Plugin

Nabto uServer

Embedded Logic

PC Internet aware device

Complexity is moved from Device to Client platform by installing a protocol plugin on the client

Complexity

Page 10: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

HTML DEVICE DRIVER

Browser Nabto

Browser Plugin

Nabto uServer

Embedded Logic

PC Internet aware device

English HTML-DD

Spanish HTML-DD

French HTML-DD

German HTML-DD

Company HTML-DD

OEM1 HTML-DD

OEM2 HTML-DD

OEM3 HTML-DD

Page 11: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

MICRO WEB SERVER EXAMPLE

• Web server running on 8 bit Atmel AVR CPU with 2 kB of RAM, 32 kB flash

Page 12: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

REAL LIFE EXAMPLE: DANFOSS

Freescale MCF52255 – 64kb RAM 512kb flash

Page 13: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

NABDUINO

http://nabduino.com

Page 14: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

NABDUINO BOARD

DEMO - http://demo2.nabduino.net

Page 15: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

www.nabto.com

BREAK

15 minutes break

Page 16: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

DEVELOPMENT TOOLS

http://nabduino.com/download

• Download and install MPLAP X IDE • Download and install MPLAB C18 compiler

• Don’t download the XC compilers (when asked to) • Only build bootloader_release with free compiler

• Goto Microchip Application Libraries • Download and install Microchip Libraries for Applications

• Download Nabto Updater • Copy NabtoUpdater.exe to location for easy drop’ing

• Download and unzip the Starterkit • cd unabto_starterkit\unabto\external

• mklink /J Microchip "C:\microchip_solutions_v2013-02-15\Microchip"

Page 17: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

DELIVERY

Client Nabto Client

API

Nabto Framework

Product logic

Nabto Base

station

Closed

source -

Client API

Source

available -

Starter Kit ($)

Closed

source ($)

Chip and

Hardware

modules ($)

Nabto Interface

Product logic

Page 18: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

1. IMPLEMENT FUNCTIONS

• Implement 14 platform functions (or use an existing implementation) • Implement the application event handler (see later) • Implement the main loop (loop or event driven)

Nabto Framework

Platform Interface

Device platform

UDP/IP stack

main application_event

Application Interface

#define NABTO_DEVICE NABTO_DEVICE_PIC18

nabto_init_socket nabto_close_socket nabto_read nabto_write nabto_random …

Page 19: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

2. IMPLEMENT MAIN LOOP

int main() { nabto_main_context_t nmc; nabto_init_default_values(&(nmc.nms)); nmc.nms.id = "foo.u.nabto.net"; nabto_main_init(&nmc); while (true) { nabto_main_tick(&nmc); sleep_ms(10); } nabto_main_close(&nmc); return 0; }

Page 20: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

3. IMPLEMENT EVENT HANDLER

application_event_result_t application_event( application_request_t* req, buffer_read_t* ibuf, buffer_write_t* obuf) {

switch (req->query_id) {

case 0x0a: {

uint16_t sensor_id;

uint8_t filter;

uint16_t temperature;

buffer_read_uint16(ibuf, &sensor_id);

buffer_read_uint8(ibuf, &filter);

temperature = readTemperature(sensor_id, filter);

buffer_write_uint16(obuf, temperature);

return AER_REQ_RESPONSE_READY;

} } return AER_REQ_INV_QUERY_ID; }

Page 21: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

4. IMPLEMENT HTML-DD

Client Client

API Nabto

Framework Embedded

Logic

Client Internet aware device

“HTML-Device driver” encapsulates GUI and defines specific data transport interface of the device

HTML Device Driver

Compact nabto protocol

Page 22: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

HTML DEVICE DRIVER

Just a simple .zip file

• /static

– Static content = jpg, png, css, javascript, etc.

• /nabto

– HTML templates (old style)

• /nabto/unabto_queries.xml

– Mapping : Request URL -> Binary format

– Mapping : Response -> JSON response

Page 23: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

EXAMPLE : GETTEMPERATURE

<query name="getTemperature" id="0x0a">

<request>

<parameter name="sensorId" type="uint16"/>

<parameter name="filter" type="uint8" default="0"/>

</request>

<response format=“json">

<parameter name="temperature" type=“uint16"/>

</response>

</query>

Page 24: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

EXAMPLE : GETTEMPERATURE REQUEST

Nabto Browser Plugin

Nabto Framework

Embedded Logic

Internet aware device

Browser

User input - via a nice menu nabto://5924.nabduino.net/getTemperature?sensorId=3

0x0a | 0x00 0x03 | 0x00

Buf[0] : GetTemperature request identifier Buf[1,2] : Sensor identification Buf[3] : Filter identification (see former slide for XML definition)

Request buffer:

application_event(0x0a, &Buf[1], 3)

C call

Page 25: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

EXAMPLE : GETTEMPERATURE RESPONSE

Nabto Browser Plugin

Nabto Framework

Embedded Logic

Internet aware device

Browser

0x16 0x80

function queryDevice(request) {

jQuery.getJSON(request, null, function(response) {

var response = response["response"];

$(”button”).val(response[”temperature"])

});

}

Response buffer: application_event() function returns response buffer

The temperature is: 22,5

User GUI

Respone in JSON format Handled by JavaScript:

Page 26: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

BUILDING AND BURNING

• Start MPLAB.X IDE and open project – unabto_starterkit/unabto/demo/nabduino/MPLAB.X

• Set Nabduino as main project (in Projects window) • Edit src/application.c (application_event) • Build main project • Open an Explorer

– Go to dist/bootloader_release/production in MPLAB.X

• Drag MPLAB.X.production.hex to NabtoUpdater.exe • Reset the nabduino board

• Documentation:

– unabto_starterkit/doc/starter_kit/unabto_starterkit.html

Page 27: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

CLIENT API

Customer Client

Software

Nabto Protocol Adapter

PC / Smartphone

TCP Port

On demand TCP-Portforwarding

Nabto Protocol Adapter

IP interface

On demand VPN-forwarding Virtual

Network card

Browser

On demand HTTP-proxyforwarding

Nabto Browser Plugin

APP

On demand Low-footprint HTTP

Nabto Client API

Programatic

Remote Procedure Calls Or JSON requests

Page 28: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

NABTO – CLIENTAPI - PROGRAM CONNECTION

UDP stack

System On Chip

Device

Nabto Framework Program

Base station

PC

Cloud service

P2P connection

Data connection

Nabto Client

API

Discovery services

Page 29: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

CLIENT API

• Configuration and initialization API • nabtoStartup • nabtoShutdown

• Session API • nabtoOpenSession • nabtoFetchUrl • nabtoAsyncFetch • nabtoCloseSession

• Streaming API • nabtoStreamOpen • nabtoStreamRead • nabtoStreamWrite • nabtoStreamClose

• Tunnel API (next release) • nabtoTunnelOpenTcp • nabtoTunnelInfo • nabtoTunnleClose

Page 30: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

TUNNELING

Device n.demo.net

Nabto Framework

Client client.home.net nabto

Nabto Client

API

Server 192.168.

1.34 TCP/IP

Port

80

Port

55

55

nabtoTunnelOpenTcp(..., 5555, ”n.demo.net”, ”192.168.1.34”, 80);

Some application

TCP/IP

Connect to port 5555 on client.home.net, for instance: % wget http://client.home.net:5555/some-file

Fire

wal

l

Page 31: PLATFORM FOR THE INTERNET OF THINGS - Nabto Nabto Nabduino Lesso… · Ardunio, ColdFire, FreeRTOS, GainSpan, Microchip, RTX4100, ... MOVE THE COMPLEXITY TO THE CLIENT Browser Nabto

THANK YOU FOR LISTENING

www.nabto.com