3
Connectivity Data AnalyticsThings Action
Internet of Things
機器ごと、業界ごと、シーンごと、
やりたいことで、シナリオいろいろ
組込み機器、人⇔送受信⇔蓄積、表示、分析、活用
PaaSをビルディングブロックで組み合わせ、構築する
Microsoft Azure
デバイス接続
サービス
データ
実時間分析
サービス
ML
ダッシュボード
サービス連携
データ・サービスを
第三者へ売る
PC・タブレット・スマホ
開発・運用コスト低
スケール可能!!
ストレージ
その他の
ビッグデータ
エンタープライズサービス等
外部サービス
メッセージング
管理
Microsoft Azure
メッセージング
管理
Predictive Maintainance
Connected Factory
Remote Monitoring
Remote
Monitoring
Predictive
Maintenance
Connected
Factory
http://www.azureiotsuites.com
https://github.com/Azure/azure-iot-remote-monitoring
https://github.com/Azure/azure-iot-connected-factory
https://github.com/Azure/azure-iot-predictive-maintenance
https://github.com/Azure/LearnAnalytics-PredictiveAnalyticsForIoT
IoT の障壁を取り除く これまでの限界を超える 実績のある技術を
活用する
Microsoft Azure
Azure
IoT Hub
Field
Gateway
Cloud
Protocol
Gateway
デバイス
Microsoft Azure
Azure
IoT Hub
Field
Gateway
Cloud
Protocol
Gateway
メッセージング(双方向)
ファイルアップロード
デバイス
プロパティ同期
メソッドコール
デバイスレジストリ
メッセージング(受信)
メッセージング(送信)
Twin – プロパティ同期
クエリ
ジョブ
デバイス毎の秘密鍵
デバイス毎の証明書
受信のルーティング
モニタリング
ファイルアップロード
https://microsoft.github.io/techcasestudies/iot/2017/03/03/seraku.html
http://azure.microsoft.com
http://github.com/Azure/azure-iot-sdks
SDKでの接続が
確認済みの
組込み機器カタログ
https://catalog.azureiotsuite.com/
Microsoft Azure
デバイス
Microsoft Azure
デバイス
接続
受信スレッド作成
メッセージ作成
メッセージ送信
切断
var client = DeviceClient.CreateFromConnectionString(
“接続文字列",TransportType.Mqtt);
await client.OpenAsync();
ReceiveMessagesAsync(client);
var data = new
{
MeasuredTime = DateTime.Now,
Muscle = arduino.analogRead("A1")
};
var json = JsonConvert.SerializeObject(data);
var msg = new Message(Encoding.UTF8.GetBytes(json));
await client.SendEventAsync(msg);
await client.CloseAsync();
private async void ReceiveMessagesAsync(DeviceClient client)
{
while (true)
{
var message = await client.ReceiveAsync();
var content = Encoding.UTF8.GetString(message.GetBytes());
・・・ 受信メッセージの処理
await client.CompleteAsync(message);
}
}
https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/ubuntu_apt-get_sample_setup.md
接続
受信スレッド作成
メッセージ作成
メッセージ送信
切断
#include "iothub_client.h“
#include "iothub_message.h“
#include "iothubtransportamqp.h“
…
IOTHUB_CLIENT_HANDLE iotHubClientHandle;
iotHubClientHandle = IoTHubClient_CreateFromConnectionString(cs, AMQP_Protocol));
IoTHubClient_SetMessageCallback(iotHubClientHandle, ReceiveMessageCallback, NULL);
EVENT_INSTANCE* eventinstance = (EVENT_INSTANCE*)malloc(sizeof(EVENT_INSTANCE));
unsigned char* msg = “{¥”MeasuredTime¥”:¥”…
eventinstance->messageHandle = IoTHubMessage_CreateFromByteArray(msg, msgLen));
IoTHubClient_SendEventAsync(
iotHubClientHandle,
eventinstance->messageHandle,
SendConfirmationCallback, eventinstance)
HostName=IoTHubName.azure-devices.net;DeviceId=myDeviceId;SharedAccessKey=myBase64EncodedAccessKey
http://catalog.azureiotsuite.com
https://www.unirobot.com/
Microsoft Azure
IoT Hub
Local Netwoark
⇔
⇔
⇔
登録済
http://github.com/Azure/azure-iot-edge
Microsoft Azure
IoT Hub
Message Bus
Module A Module B Module D Module E
メッセージバスに送信したメッセージは
他のすべてのモジュールが受信
リンクの設定による
送信元・先の限定
Module の役割は任意
JSONによる
定義ファイル
静的、動的
両方をサポート
Message Bus
Local
Comm
Module
Extended
Module
IoT Hub
Mapper
IoT Hub
Client
IoT SDK
リモートモニタリング・制御
多数のIoTデバイスからの収集データ
をマージ
先進AIの適用を可能にする、
無限に近いコンピューティング
リソースとストレージ
リアルタイム応答に必要な
ローレーテンシーでタイトな
コントロールループ
プライバシーデータや知的財産の保護
Message
Bus
Module
Embedded George
http://github.com/ms-iotkithol-
jp/AzureIoTGatewayExtention
ドローンワークス(株)
http://github.com/drone-
works/AzureIoTGatewaySDKExtention
Gateway Box
Stream
Analytics
PowerBI
Blob
Storage
すべてのイベントデー
タをアーカイブ保存
ダッシュボード表示
SQL
Database
EventHubs
ソーラーパネル 制御機器
RC485 ソーラーパネル
稼働状況
アラート情報
Armadillo
Modbus
Azure IoT
Gateway SDK
KES Software
IoT
Hub
アラート情報を
ルーティング
SoftBank 3G/4G
Module
WebJob/
Functions
SendGrid
担当者へメールを送信
Microsoft Azure
Edge
× 金沢エンジニアリングシステムズ
プロジェクト全体統括
LTE回線提供
Edgeソフトウェア開発
(Azure IoT Gateway SDKを活
用)
Azure IoT Gateway SDKを活用し
Edgeソフトウェア開発工期を圧縮
KESのEdge側開発ノウハウを活用し
200種類のプロトコルへの対応を実現可能
Message Bus
Local
Comm
Module
Extended
Module
IoT Hub
Mapper
IoT Hub
Client
IoT SDK
Microsoft Azure
http://pcn.club/katsuyama/azure201703/
計画
プロビジョニ
ング
構成監視
使用中止
計画:
• 管理用メタデータ検討と定義
プロビジョニング:
• デバイスの登録と管理用メタデータ設定
構成:
• 正常性とセキュリティの維持
• 一括構成変更、ファームウェア更新
監視:
• 継続的なモニタリングと異常時の通知
使用中止:
• 使用停止と資格情報の安全な破棄
• デバイス交換中の、デバイス情報保持
49
クラウドのバックエンドサービスDevice App
IoT Hub
C2D
D2C
Device Twin
Direct Methods
テレメタリー
クラウドからメッセージを
デバイスに送る
Properties
経過も通知受信可能な
デバイスのメソッドを起動
Properties
クラウド側から指定可能な変数
デバイス側由来の変数
クラウド側で付与可能な
メタデータ
Methods
Read/Write Read
Read/WriteRead/Notification
プロパティ更新、メソッドコールは
IoT Hubに履歴として保存される
Microsoft Azure
RegistryManager registryManager =
RegistryManager.CreateFromConnectionString(“サービス接続文字列”);
await registryManager.OpenAsync();
var newDevice = new Device(newDeviceId);
newDevice = await registryManager.AddDeviceAsync(newDevice);
var twin = await registryManager.GetTwinAsync(newDevice.Id);
var props = new { dmConfig = new {
TelemetryCycle = TelemetryCycle, Latitude = Latitude, …
} };
Var json = JsonConvert.SerializeObject(props);
await registryManager.UpdateTwinAsync(newDevice.Id, json, twin.ETag);
接続
デバイス登録
Twin取得
Desired
Properties設定
HostName=IoTHubEndPoint; SharedAccessKeyName =roleName;SharedAccessKey=Base64EncodedAccessKey
var deviceClient = DeviceClient.CreateFromConnectionString(cs, TransportType.Mqtt);
await deviceClient.SetDesiredPropertyUpdateCallback(DPUpdateCallback, this);
private Task DPUpdateCallback(TwinCollection desiredProperties, object userContext)
{
return Task.Run(() =>
{
var json = desiredProperties.ToJson();
…
});
}
var registedDeviceTwin = await registryManager.GetTwinAsync(deviceId);
var rp =
JsonConvert.DeserializeObject(registedDeviceTwin.Properties.Reported.ToJson();
var rpJSON = (JObject)JsonConvert.DeserializeObject(rp);
var reportedProps = new Models.ReportedProperties() {
BatteryLevel = ThingsCar.BatteryLevel,…, ThingsCar.Status };
var json = JsonConvert.SerializeObject(reportedProps);
var patch =JsonConvert.DeserializeObject<TwinCollection>(json);
await deviceClient.UpdateReportedPropertiesAsync(patch);
ServiceClient serviceClient =ServiceClient.CreateFromConnectionString(cs);
var method = new CloudToDeviceMethod("reboot");
var payload = “after 30 seconds…"
method.SetPayloadJson(payload);
var callResult = await serviceClient.InvokeDeviceMethodAsync(deviceId, method);
after 30 seconds…
var deviceClient = DeviceClient.CreateFromConnectionString(cs,TransportType.Mqtt);
await deviceClient.SetMethodHandlerAsync("reboot", RebootMethod, this);
private Task<MethodResponse> RebootMethod(MethodRequest request, object context)
{
return Task.Run(() => {
…
return new MethodResponse(
Encoding.UTF8.GetBytes("{¥"Status¥":¥"Rebooting¥"}"),0);
});
}
※Payloadは、request.DataAsJsonで取得
IoT Hub
Device Twin/Methods
Device
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Device Twin/Methods
Jobs
Schedule and Broadcast
Device Twin Changes
Set Desired Properties,
Tags, Call Methods
Queries – SQL like
Query Across
Device Twin State
For Business Logic,
Reporting and
Compliance
JSONで
結果取得
IoT Hub Device ManagementのJobコレクション
IoT Hub
デフォルトの
メッセージングDevice
Device
Device
Device Twin
Properties
プロパティ、タグで
フィルタリング
Tag.ServiceType = …
Desired.DeviceType = …
• タグ/プロパティで条件付け、
後続の処理を分離
• 大規模 IoT への対応
Microsoft Azure
デバイス接続管理
(ID、Device Key)
メッセージング
(送受信、受信確認)
機器管理
(Device Twin、Query、Job)
デバイス
IoTシナリオ用
モジュール
IoT Edge Ext
計測データ、コマンド
HTTPS/AMQPS/MQTT
OS/Firmware
プロパティ、ジョブ
MqTT
“IoTシナリオアプリ”
FA、医療、流通、リテール、社会インフラなど、
それぞれの事業領域毎の専門アプリケーション
“IoT Edge Ext”
特定の事業領域によらず、機器としての管理機能向けロジック
アプリ実行状況確認、アプリやファームウェアのアップデートなど
Device
Twin
メッセージング
Azure IoT Edge IoT Hub
Devices
Local Storage
Azure Machine
Learning
(Container)
Functions
RuntimeContainer
Management
Device
Twin
Device
Twin
Azure Stream
Analytics
(Container)
Azure Functions
(Container)
Cognitive Services
(Container)
Custom Code
(Container)
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
Module
Twin
https://microsoft.qualtrics.com/jfe/form/SV_0oknoIujzm1haOV
Microsoft Azure
セッションアンケートにご協力ください
➢ 専用アプリからご回答いただけます。
decode 2017
➢ スケジュールビルダーで受講セッションを
登録後、アンケート画面からご回答ください。
➢ アンケートの回答時間はたったの 15 秒です!
Ask the Speaker のご案内
本セッションの詳細は『Ask the Speaker Room』各コーナーカウンタにて
ご説明させていただきます。是非、お立ち寄りください。
© 2017 Microsoft Corporation. All rights reserved.
本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。

20170703_05 IoTビジネス共創ラボ