Abstract (概要)
このページでは IoT Gateway for BLE アプリの使い方を紹介します
I will introduce how to use of IoT Gateway for BLE app in this page.
Getting Started として MQTT チャネルを使ったデータの Publish をする方法を紹介します
This page shows how to publish the data with MQTT channel as Getting Started.
アプリ自体のダウンロードは以下の URL からお願いします
App download of thank you from the following URL.
http://apple.co/1Ytn48L
Equipment (環境)
- IoT Gateway for BLE v1.4
- Cloud MQTT (Plan: Cute Cat)
- BLESerial2
Registration CloudMQTT and making MQTT broker (CloudMQTT の登録とブローカーの作成)
CloudMQTT にアカウントを作成します
Please create an account in CloudMQTT.
アカウント登録にはメールアドレスが必要です
To regist an account is required e-mail address.
アカウントを作成したらブローカーを作成してください
After you created an account, you have to make a broker.
以下のようにブローカーの情報が取得できれば OK です
It is OK if you can get information of the broker in CloudMQTT following as:
あとはブローカーにアクセスするユーザと ACL の設定をしてください
You also have to add a user who can access topics of your broker.
To register a broker info into the app (アプリに MQTT チャネルを登録する)
作成した MQTT の情報をアプリに登録します
Next, you have to regist you created MQTT broker into the app.
アプリを起動して Channels を選択してください
Launch the “IoT Gateway for BLE” app and tap the “Channels” button.
MQTT チャネルを選択します
Tap the MQTT channel in a list.
一番下の New を選択します
And tap a “New” button in the bottom.
すると MQTT のブローカー情報を入力する画面になるので先ほど作成したブローカー情報とユーザ情報を入力していきます
This will give you the chance to screen for entering the MQTT broker info. Input your broker info and the user info that you just created.
以下のように入力できれば OK です
It is OK if you can input your broker data following as:
接続テストができるので試してみてください
Please try the “Connect Test”.
“Success Connect” になれば問題なく MQTT ブローカーに接続できています
If you can get the message of “Success Connect”, it has been able to connect to the MQTT broker without problems.
最後に Add を選択して MQTT チャネルの作成を完了してください
Finally you tap the “Add” button, you have completed adding the new broker in your MQTT channel.
作成が完了すると MQTT チャネルの一覧に戻ります
To return to the list of MQTT channel then completed adding the new broker.
Linking a Bluetooth device (Bluetooth デバイスと紐付ける)
作成したチャネルと Bluetooth デバイスを紐付けます
Your bluetooth device is going to be linked to the MQTT channel that you created.
今回 Bluetooth デバイスは自作の BLESerial2 を使用します
In this time, we chose one BLE device of “BLESerial2” made by ourself.
SensorTag など GATT Profile をサポートしている Bluetooth デバイスであれば何でも OK です
Anything is OK if a BLE device that supports the GATT Profile such as SensorTag.
Gateway Home から “New” を選択します
Tap a “New” button in the Home.
デバイスモードの選択で “BLE” を選択します
And, tap a “BLE” button in the Device Mode.
またこのときスマートフォンの Bluetooth の機能を ON にしてください
Also, please turn ON the Bluetooth function on your smartphone.
BLESerial2 の電源を ON にしてください
To turn on the power of BLESerial2 device.
すると Device List の中に BLESerial2 が見つかるはずです
Then you should find a BLESerial2 in the “Device List”.
デバイスを選択したら次に Service を選択します
Next, you should select a Service of you have selected the device.
Service を選択したら Characteristic を選択しましょう
And next, you should select a Characteristic of you have selected the service.
今回 “IoT Gateway for BLE” では Notify タイプの Characteristic のみをサポートしています
Only supports “IoT Gateway for BLE” app in Notify type of Characteristic.
これは BLE デバイスからの通知情報をアプリ側で受け取る必要があるためです
Because, it is necessary to receive the notification data from the BLE device in the app side.
Read タイプの Characteristic だとアプリから定期的に値を読み込む必要があり、その場合だとデータが不要なときでも値を取得し続けてしまうため Notify タイプのみをサポートしています
To need to read on a regular basis the value from the application that it is Characteristic of the Read type.
Supports only Notify type for data that it is the case would continue to get the value even when not needed.
Notify タイプの Characteristic を選択したら “Notify Test” をタップして本当に問題ないか確認してください
You have selected the Notify type of Characteristic, please make sure not really a problem to tap the “Notify Test” button.
テストが問題なければ “Add” を選択して BLE デバイスを追加してください
Add your BLE device tapping the “Add” button if there is no problem.
するとチャネルと紐付ける画面になります
This will give you the chance to screen to link a channel.
今回は先ほど作成した MQTT チャネルと紐付けるので “MQTT” を選択します
This time select the “MQTT” in a list, so you should link a BLE device to you just created MQTT channel.
そして作成した CloudMQTT のブローカーを選択し OK をタップします
And select the CloudMQTT broker that you created and then tap OK.
これで MQTT チャネルと BLE デバイスの紐付けが完了しました
To linking the MQTT channel and the BLE device is now completed.
この操作が Gateway を作成するという操作になります
This operation will be the operation called as “Creating a Gateway”.
作成が完了すると Gateway の一覧に戻るので作成された Gateway を確認してください
Please check your gateway which has created in the list of Gateways.
Test (動作確認)
それでは最後に動作確認してみます
So the last to try to test your gateway.
作成した Gateway を選択してください
Please select the Gateway you created.
すると Gateway を起動する画面になるので Start をタップしてください
Tap the “Start” button then it will be shown the screen to start the Gateway.
このとき BLE デバイスの電源は ON にしておいてください
Power on your BLE device.
Gateway を起動すると自動的に登録した BLE デバイスを検索し接続してくれます
Search for BLE devices registered to start the Gateway, and has automatically connected to them.
BLE デバイスとの接続が完了すると紐付けした MQTT チャネルとの接続が始まります
It will start connection with MQTT cahnnel when the connection is completed with the BLE device.
MQTT チャネルとの接続も完了すると Gateway の準備が完了しました
And also completed the connection to the MQTT channel, the Gateway is ready !
これで BLE デバイスから Notify の情報を送信するとそのデータがそのまま MQTT に Publish することができます
When you send the data of Notify from BLE device, it will be published to the MQTT broker.
mosquitto_sub コマンドを使った動作確認だと以下のように表示されます
For instance, it is a test that uses a mosquitto_sub command appears as follows:
0 件のコメント:
コメントを投稿