Presentation is loading. Please wait.

Presentation is loading. Please wait.

M2M Communications with mbed

Similar presentations


Presentation on theme: "M2M Communications with mbed"— Presentation transcript:

1 M2M Communications with mbed
Eric Liang # Date:2015/06/16

2 Outline M2M Communication for ptt 地震文 MQTT HTTP CoAP
mbed (client ) + Raspberry pi (broker) HTTP Mbed (client ) + MCS (MediaTek Cloud Sandbox ) CoAP Mbed ( CoAP Server ) + Firefox ( Copper client )

3 M2M Communication for PTT 地震文
mbde Arch Pro + MPU 6050 mbed K64F + FXOS8700 Raspberry Pi 2

4 MQTT 輕量級訊息佇列 ( message queueing ) 傳輸協定 非同步訊息(事件) 通訊模式
Low overhead ( 2 bytes header) 適合應用於低頻寬網路 支持各種流行編程語言(包括 C,Java,Ruby,Python...)& Client 容易使用 發佈 (Publish) / 訂閱 (Subscribe)  模式,簡化應用程序的開發 發佈 和 訂閱 傳送資料透過 標題 (Topics) 訊息佇列( message queues ) 底層協定為TCP/IP 提供三種不同消息傳遞等級,讓消息能按需到達目的地,適應在不穩定工作的網絡傳輸 (Wireless Network disruptions)

5 MQTT (Cont’d) Refer to: “temperature” = “22.5” subscribe “temperature”
Client C “temperature” = “22.5” subscribe “temperature” Broker “temperature” = “22.5” subscribe “temperature” publish “temperature” “22.5” Client A Client B Refer to:

6 MQTT Client + mbed

7 MQTT Client + mbed (Cont’d)

8 MQTT Client + mbed (Cont’d)

9 MQTT + RPi Install the mosquitto 1.4.1 on Raspberry Pi
Run the Broker Server Subscribe – by Python-mosquitto Refer to

10 MQTT Demo ( mbed + RPi ) Topic: sen/g-sensor Message: Name X Y Z G
Eric

11 HTTP ( Cont’d ) Web Open IoT Cloud Architecture
Physical Web: WoT ( Web of Things ) + REST API

12 HTTP Apache / IIS / nginx / Tomcat / Node.js GET / POST / PUT / DELETE
200 OK / 201 Create / 400 Bad Request / 401 Unauthorized / 404 Not Found 500 Internal Server Error / 501 Not Implemented

13 HTTP Client + mbed

14 HTTP Client + mbed / MCS mediaTek Cloud Sandbox mbed HTTP Client Demo

15 CoAP ( Constrained Application Protocol )
M2M Protocol CoAP over UDP ( Sever default port: 5683 ) The smallest size is 4 Bytes ( Header only ) Suit for Small Device ( 256KB Flash 32KB RAM CPU 20MHz) Request / Response ( like HTTP ) Resource Discover ( by URI: .well-known/core ) GET /.well-known/core Response: <sensors/temp>;sz=512;title=Temperature Sensor;ct=50

16 CoAP Header Ver: CoAP version, 01 ( like HTTP1.0 / HTTP1.1 )
T: Confirmable (0), Non-confirmable (1), Acknowledgement (2), or Reset (3) TKL: Token Length (0-8 bytes) Code: Request / Reply Code. 2.xx, 4.xx, 5.xx Message ID: Used to detect message duplication. Token: is used to match a response with a request. Options: like HTTP Header. Host: xx, URI, Request parameter or content-type : (0xFF) indicates the end of options and the start of the payload. Payload: Data Content

17 CoAP Request /Response Code
0.01 GET 0.02 POST 0.03 PUT 0.04 DELETE Response 2.04 Changed 2.05 Content (HTTP 200 OK ) 4.00 Bad Request ( HTTP 400 ) 4.01 Unauthorized ( HTTP 401) 5.00 Internal Server Error ( HTTP 500 ) 5.01 Not Implemented ( HTTP 501 )

18 CoAP Option Format 1’s Option Delta = 11 => Uri-Path (11), \sen\temperature 2’s Option Delta = 1, => 1+11 Content-Format (12), text/plain, application/json 3’s Option Delta = 3, => Uri-Query (15), ?value1=1&value2=2

19 Example of CoAP CoAP Client “GET” the temperature value from Server
CoAP URI: coap:// GET Reply

20 CoAP ( WebIOPi + Copper )
Installer the WebIOPi on Rpi Download the WebIOPi (WebIOPi tar.gz) $ tar xvzf WebIOPi-x.y.z.tar.gz   $ cd WebIOPi-x.y.z   $ sudo ./setup.sh  $ sudo webiopi -d -c /etc/webiopi/config Web’s id:password: webiopi/raspberry Copper ( Mozilla Plug-in Module ) Refer to

21 WebIOPi + Copper ( Demo)
Set the Pin4 as digital out Set GPIO 4 by CoAP protocol coap://ip:5683/GPIO/4/value/1

22 WebIOPi + Copper ( Cont’d)


Download ppt "M2M Communications with mbed"

Similar presentations


Ads by Google