LoginSignup
2
3

More than 5 years have passed since last update.

アルプスのセンサネットワークモジュールをラズパイ3と3GPIで使ってみる(其の3 Googleスプレッドシートへのセンサ情報の保存)

Last updated at Posted at 2016-09-19

前回に引き続き、メカトラックス株式会社様よりお借りしたアルプスのセンサネットワークモジュールで検出した温湿度、気圧情報を、3GPI(Raspberry Pi向け3G通信モジュール)を経由してIFTTTにアップロードし、GoogleドライブのGoogleスプレッドシートに情報を保存します。次の写真に示す構成で、メカトラックス株式会社様の3GPIをRaspberry Pi 3の上に載せ、アルプスのセンサネットワークモジュールからBluetooth Low Energy(BLE)インタフェースで取得した温湿度、気圧データをIFTTTにアップロードします。

アルプスのセンサネットワークモジュールは、Bluetooth Low Energy(BLE)を用いて、モーションデータと共に、気圧、温度・湿度などの環境データを取得でき、センサネットワークモジュールを、BLEを用いて、上記写真のようにRaspberry Pi 3と接続しました。

全体の構成

アルプスのセンサネットワークモジュールからBLEインタフェースを用いて取得した温湿度、気圧情報を、Raspberry Pi 3に搭載された3GPIを経由して、IFTTTにアップロードします。IFTTTでは、あらかじめ設定されたレシピに基づき、受け取った温湿度、気圧情報をGoogleドライブのGoogleスプレッドシートに保存します。ネットワークも含めた全体の構成図を次に示します。

3GPIは、Raspberry Pi専用に開発された3G通信モジュールで、携帯電話網で通信するため、国内のほぼ全域で使用できます。3GPIのSIMカードに、今回はIoT向きの従量課金のSORACOM Airを利用します。3GPIにSORACOM AirのSIMカードを挿入すると、自動的にPPP接続によりIPアドレスが割り当てられ、簡単にネットワークへの接続が可能となります。

アルプスのセンサネットワークモジュールは、モーションデータと共に、気圧、温湿度、照度などの環境データを取得できます。今回は、Raspberry Pi 3とセンサネットワークモジュールで、BLEインタフェースを用いて、気圧、温湿度を取得します。

IFTTTは、「レシピ」と呼ばれる個人作成もしくは公的に共有しているプロフィールを使って、数あるIoT機器や、TwitterやFacebook、SlackなどのWebサービスと連携できるWebサービスです。レシピの「this」の部分は「Facebookで写真をタグ付けした時」「Foursquareでチェックした時」といった「きっかけ」になり、今回は「3GPI+センサネットワークモジュール+Raspberry Pi 3によるセンサー情報の取得時」になります。「that」の部分は「テキストメッセージの送信」「Facebookでステータスメッセージを作成」といった「行動」になり、今回は、「GoogleドライブのGoogleスプレッドシートへの書き込み」になります。

3GPIの設定

3GPIとRaspberry Pi 3の接続は、40ピンのピンヘッダで接続され、3GPIからも同様のピンが出ており、3GPI上にスタックすることができます。また、電源は12VのACアダプタが同梱されており、このACアダプタからRaspberry Piの本体にも電源が供給されます。3GPI上のSIMソケットには、SORACOMのSIMカードを挿入します。同梱されている接続設定済Raspbian入microSDカードを、Raspberry Pi 3のSDカードスロットに挿入して、電源を投入すると、Raspbianが起動され、ログインのプロンプトが表示されるので、ユーザIDとパスワードを設定してログインします。この時3GPIは、SORACOMのデータ回線を使用してネットワークに接続します。詳細な手順は、「メカトラックス3GPIでSORACOM Airをつなぐ」に示します。

アルプスのセンサネットワークモジュールとのインタフェースプログラムの作成

アルプスのセンサネットワークモジュールとRaspberry Pi 3とのインタフェースプログラムは、前回作成したセンサネットワークモジュール用プログラム「alpsble」をベースとし、IFTTTへ接続するために、Socket通信ロジックによるHTTPプロトコルによる通信機能を追加します。

変数の定義部分を次に示します。変数「destination」はIFTTTのホストアドレスを指定します。変数「event 」と「secretkey 」は、IFTTTのレシピを作成したときのEventNameと、レシピのkeyをそれぞれ設定します。

/* IP アドレス、ポート番号、ソケット */
char destination[] = "maker.ifttt.com";
unsigned short port = 80;
int dstSocket;
int result; 

/* sockaddr_in 構造体 */
struct sockaddr_in dstAddr;

/* 各種パラメータ */
char toSendText[BUF_LEN] = "";
char buf[BUF_LEN]= "";
int read_size;

/* IFTTT設定パラメータ */
const char* host = "maker.ifttt.com";
const char* event = "3GPIRaspi3";
const char* secretkey = "(Key)";

ソケットの初期化関数「initIfttt」を次に示します。socket関数でソケットを生成して、connect関数でIFTTTに接続します。gethostbyname関数は、IFTTTホスト名をIPアドレスに変換します。

void initIfttt()
{
    /* sockaddr_in 構造体のセット */
    memset(&dstAddr, 0, sizeof(dstAddr));
    dstAddr.sin_port = htons(port);
    dstAddr.sin_family = AF_INET;
    dstAddr.sin_addr.s_addr = inet_addr(destination);
    if (dstAddr.sin_addr.s_addr == 0xffffffff) {
        struct hostent *he;
        he = gethostbyname(destination);
        if (he == NULL) {
             exit(1);
        }
        memcpy(&dstAddr.sin_addr, he->h_addr_list[0], he->h_length);
    } 
    /* ソケット生成 */
    dstSocket = socket(AF_INET, SOCK_STREAM, 0);
    if (dstSocket < 0){
        perror("socket");
        exit(1);
    }
     /* 接続 */
    result = connect(dstSocket, (struct sockaddr *) &dstAddr, sizeof(dstAddr));
    if (result < 0){
        perror("connect");
        exit(1);
    }
}

ソケットを用いたセンサー情報の送信関数「sendIfttt」を次に示します。パラメータに温度、湿度、気圧の各センサ情報を設定します。センサ情報をパラメータにして作成したURLを、send関数を用いて接続したIFTTTに送信します。recv関数を用いて、IFTTTからの応答データを受け取ります。

void sendIfttt(char* ascTemperature,char* ascHumidity,char* ascPressure)
{

 // We now create a URI for the request
    char url[256] =  "/trigger/";
    strcat( url, event );
    strcat( url,"/with/key/");
    strcat( url,secretkey);
    strcat( url,"?value1=");
    strcat( url,ascTemperature);
    strcat( url,"&value2=");
    strcat( url,ascHumidity);
    strcat( url,"&value3=");
    strcat( url,ascPressure); 

    printf("Requesting URL: ");
    printf("%s\n",url);

    // This will send the request to the server
    memset(toSendText, 0, sizeof(toSendText));
    strcat( toSendText,"GET ");
    strcat( toSendText, url );
    strcat( toSendText, " HTTP/1.1\r\n" );
    strcat( toSendText, "Host: " );
    strcat( toSendText, host );
    strcat( toSendText, "\r\n" );
    strcat( toSendText, "Connection: close\r\n" );
    strcat( toSendText, "\r\n" );

    result = send(dstSocket, toSendText, strlen( toSendText ), 0);
    if (result < 0){
        perror("send");
        exit(1);
    }

  // Read all the lines of the reply from server and print them to Serial
    while (1){
        memset(buf, 0, sizeof(buf));
        read_size = recv(dstSocket, buf, BUF_LEN, 0);
        if (read_size > 0){
            printf("%s",  buf);
        }
        else {
            break;
        }
    }
    close(dstSocket);  /* ソケットを閉鎖 */
}

IFTTTのレシピの作成

今回のIFTTTのレシピは、「this」の部分は、「3GPI+センサネットワークモジュール+Raspberry Pi 3によるセンサー情報の取得時」とし、「that」の部分は「GoogleドライブのGoogleスプレッドシートによるセンサー情報の取得時」とします。イベント名は「3GPIRaspi3」とし、Googleスプレッドシート名は「ALPSSensor」とします。

次の手順に従ってIFTTTレシピを作成します。
1.「IFTTT」でIFTTTアカウントを作成します。Topメニューの「My Recipes」をクリックし、次のように画面右下の「Create a Recipe」をクリックします。

2.次の画面が表示されるので、「this」をクリックします。

3.検索ボックスが次のように表示されるので、検索ボックスに「Maker」と入力し、検索された一覧から「Maker」を選択します。

4.「Receive a web request」が表示されるので選択します。

5.次の画面が表示されるので、Event Name(イベント名)を入力し、「Create Trigger」をクリックします。ここでは、イベント名を「3GPIRaspi3」にしました。センサネットワークモジュール用プログラム「alpsble」から、レシピをアクセスする時に必要となります。

6.次の画面が表示されるので、「that」をクリックします。

7.次の画面が表示されるので、検索ボックスに「google」と入力し、検索された一覧からGoogleドライブ「Google Drive」を選択します。Googleサービスへの接続の画面が表示されるので、「Connect」ボタンクリックし、画面の右下に表示された「許可」をクリックします。

※初回のみ、Googleドライブへの接続画面が表示されます



8.次のように何個か選択肢が表示されるので、Googleスプレッドシート「Add row to spreadsheet」を選択します。

9.次のように、Googleスプレッドシートの名称、カラムの形式、Googleドライブのパス名を設定して、「Create Action」をクリックします。今回はGoogleスプレッドシートの名称を「ALPSSensor」、その他は、デフォルトの設定を使用します。

10.「Create recipe」をクリックし、レシピの作成を完了します。

11.Topメニューの「My Recipes」をクリックして画面を確認すると、次のように今回作成したレシピが表示されます。

12.作成されたレシピをクリックすると、次のように作成されたレシピの詳細情報が表示されます。

13.ブラウザでMaker Channelを開き、「3GPI+センサネットワークモジュール+Raspberry Pi 3」のIoT機器から、センサネットワークモジュール用プログラム「alpsble」を用いて、IFTTTのレシピをアクセスする時に必要となるKeyを確認します。

センサー情報の取得と保存

作成したセンサネットワークモジュール用プログラム「alpsble」を、Raspberry Pi 3で実行します。実行経過が次のように表示されます。「Requesting URL:xxx」の部分が、定期的(1分間ごと)にIFTTTにセンサー情報がアップロードされているURLです。IFTTTからの応答が、「HTTP/1.1 200 OKxxxx」に表示されます。

Connection successful
charWriteReq[0][]=char-write-req 0x0018 200300
char_write_req_cb
Characteristic value was written successfully
st_state = 5
charWriteReq[1][]=char-write-req 0x0018 230301
char_write_req_cb
Characteristic value was written successfully
charWriteReq[2][]=char-write-req 0x0013 0100
char_write_req_cb
Characteristic value was written successfully
charWriteReq[3][]=char-write-req 0x0016 0100
Notification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
Notification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
char_write_req_cb
Characteristic value was written successfully
charWriteReq[4][]=char-write-req 0x0018 2F0303
char_write_req_cb
Characteristic value was written successfully
charWriteReq[5][]=char-write-req 0x0018 01031C
Notification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
Notification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 09 00 01 
char_write_req_cb
Characteristic value was written successfully
charWriteReq[6][]=char-write-req 0x0018 040300
Notification handle = 0x0012 value: f3 14 90 e1 de 13 27 0d 00 80 00 80 00 00 00 00 01 0a 0f 01 
Pressure:1007.76 Humidity:65.47 Temperature:25.42
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.42&value2=65.47&value3=1007.76
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:32 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
Notification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0a 00 02 
Notification handle = 0x0012 value: f3 14 8c e1 d5 13 26 0d 00 80 00 80 00 00 00 00 01 0a 0f 02 
Pressure:1007.71 Humidity:65.33 Temperature:25.40
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.40&value2=65.33&value3=1007.71
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:34 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventchar_write_req_cb
Characteristic value was written successfully
charWriteReq[7][]=char-write-req 0x0018 05043C00
Notification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0b 00 03 
Notification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
Notification handle = 0x0012 value: f3 14 8e e1 d9 13 22 0d 00 80 00 80 00 00 00 00 01 0a 0f 03 
Pressure:1007.73 Humidity:65.39 Temperature:25.32
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.32&value2=65.39&value3=1007.73
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:36 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0c 00 04 
Notification handle = 0x0012 value: f3 14 8e e1 d2 13 21 0d 00 80 00 80 00 00 00 00 01 0a 0f 04 
Pressure:1007.73 Humidity:65.28 Temperature:25.30
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.30&value2=65.28&value3=1007.73
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:39 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0d 00 05 
Notification handle = 0x0012 value: f3 14 8c e1 cc 13 1f 0d 00 80 00 80 00 00 00 00 01 0a 0f 05 
Pressure:1007.71 Humidity:65.19 Temperature:25.26
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.26&value2=65.19&value3=1007.71
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:41 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0e 00 06 
Notification handle = 0x0012 value: f3 14 86 e1 c8 13 1c 0d 00 80 00 80 00 00 00 00 01 0a 0f 06 
Pressure:1007.63 Humidity:65.12 Temperature:25.20
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.20&value2=65.12&value3=1007.63
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:43 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 0f 00 07 
Notification handle = 0x0012 value: f3 14 8a e1 bd 13 19 0d 00 80 00 80 00 00 00 00 01 0a 0f 07 
Pressure:1007.68 Humidity:64.95 Temperature:25.14
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.14&value2=64.95&value3=1007.68
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:44 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 10 00 08 
Notification handle = 0x0012 value: f3 14 81 e1 b8 13 17 0d 00 80 00 80 00 00 00 00 01 0a 0f 08 
Pressure:1007.56 Humidity:64.88 Temperature:25.10
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.10&value2=64.88&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:46 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 11 00 09 
Notification handle = 0x0012 value: f3 14 81 e1 b3 13 15 0d 00 80 00 80 00 00 00 00 01 0a 0f 09 
Pressure:1007.56 Humidity:64.80 Temperature:25.06
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.06&value2=64.80&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:48 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 12 00 0a 
Notification handle = 0x0012 value: f3 14 81 e1 ac 13 13 0d 00 80 00 80 00 00 00 00 01 0a 0f 0a 
Pressure:1007.56 Humidity:64.69 Temperature:25.02
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=25.02&value2=64.69&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:48 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 13 00 0b 
Notification handle = 0x0012 value: f3 14 81 e1 a2 13 11 0d 00 80 00 80 00 00 00 00 01 0a 0f 0b 
Pressure:1007.56 Humidity:64.53 Temperature:24.98
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.98&value2=64.53&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:50 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 14 00 0c 
Notification handle = 0x0012 value: f3 14 83 e1 a3 13 10 0d 00 80 00 80 00 00 00 00 01 0a 0f 0c 
Pressure:1007.59 Humidity:64.55 Temperature:24.96
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.96&value2=64.55&value3=1007.59
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:52 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 15 00 0d 
Notification handle = 0x0012 value: f3 14 83 e1 a0 13 0d 0d 00 80 00 80 00 00 00 00 01 0a 0f 0d 
Pressure:1007.59 Humidity:64.50 Temperature:24.90
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.90&value2=64.50&value3=1007.59
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:53 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 38 16 00 0e 
char_write_req_cb
Characteristic value was written successfully
charWriteReq[8][]=char-write-req 0x0018 200301
Notification handle = 0x0012 value: f3 14 84 e1 b2 13 0e 0d 00 80 00 80 00 00 00 00 01 0a 0f 0e 
Pressure:1007.60 Humidity:64.78 Temperature:24.92
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.92&value2=64.78&value3=1007.60
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:55 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: e0 14 00 00 00 00 da 68 0b 00 01 00 00 00 00 00 00 00 00 00 
char_write_req_cb
Characteristic value was written successfully
charWriteReq[9][]=char-write-req 0x0018 230300
Notification handle = 0x0012 value: e0 14 00 00 00 00 dd 6c 0b 00 01 00 00 00 00 00 00 00 00 00 
char_write_req_cb
Characteristic value was written successfully
Notification handle = 0x0012 value: e0 14 00 00 00 00 dd 6c 0b 00 01 00 00 00 00 00 00 00 00 00 
Notification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 18 00 00 
Notification handle = 0x0012 value: f3 14 81 e1 c4 13 0b 0d 00 80 00 80 00 00 00 00 01 0a 0f 00 
Pressure:1007.56 Humidity:65.06 Temperature:24.86
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.86&value2=65.06&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:05:59 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 19 00 01 
Notification handle = 0x0012 value: f3 14 7d e1 db 13 0b 0d 00 80 00 80 00 00 00 00 01 0a 0f 01 
Pressure:1007.51 Humidity:65.42 Temperature:24.86
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.86&value2=65.42&value3=1007.51
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:07:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1a 00 02 
Notification handle = 0x0012 value: f3 14 83 e1 e2 13 0c 0d 00 80 00 80 00 00 00 00 01 0a 0f 02 
Pressure:1007.59 Humidity:65.53 Temperature:24.88
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.88&value2=65.53&value3=1007.59
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:07:59 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1b 00 03 
Notification handle = 0x0012 value: f3 14 81 e1 eb 13 0c 0d 00 80 00 80 00 00 00 00 01 0a 0f 03 
Pressure:1007.56 Humidity:65.67 Temperature:24.88
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.88&value2=65.67&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:09:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1c 00 04 
Notification handle = 0x0012 value: f3 14 7f e1 ed 13 0c 0d 00 80 00 80 00 00 00 00 01 0a 0f 04 
Pressure:1007.54 Humidity:65.70 Temperature:24.88
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.88&value2=65.70&value3=1007.54
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:10:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1d 00 05 
Notification handle = 0x0012 value: f3 14 7f e1 ee 13 0b 0d 00 80 00 80 00 00 00 00 01 0a 0f 05 
Pressure:1007.54 Humidity:65.72 Temperature:24.86
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.86&value2=65.72&value3=1007.54
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:10:59 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1e 00 06 
Notification handle = 0x0012 value: f3 14 81 e1 ea 13 0a 0d 00 80 00 80 00 00 00 00 01 0a 0f 06 
Pressure:1007.56 Humidity:65.66 Temperature:24.84
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.84&value2=65.66&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:11:59 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 1f 00 07 
Notification handle = 0x0012 value: f3 14 84 e1 ea 13 09 0d 00 80 00 80 00 00 00 00 01 0a 0f 07 
Pressure:1007.60 Humidity:65.66 Temperature:24.82
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.82&value2=65.66&value3=1007.60
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:13:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 20 00 08 
Notification handle = 0x0012 value: f3 14 86 e1 ea 13 06 0d 00 80 00 80 00 00 00 00 01 0a 0f 08 
Pressure:1007.63 Humidity:65.66 Temperature:24.76
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.76&value2=65.66&value3=1007.63
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:14:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 21 00 09 
Notification handle = 0x0012 value: f3 14 83 e1 e0 13 03 0d 00 80 00 80 00 00 00 00 01 0a 0f 09 
Pressure:1007.59 Humidity:65.50 Temperature:24.70
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.70&value2=65.50&value3=1007.59
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:14:59 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 22 00 0a 
Notification handle = 0x0012 value: f3 14 84 e1 e5 13 02 0d 00 80 00 80 00 00 00 00 01 0a 0f 0a 
Pressure:1007.60 Humidity:65.58 Temperature:24.68
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.68&value2=65.58&value3=1007.60
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:16:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 23 00 0b 
Notification handle = 0x0012 value: f3 14 81 e1 e4 13 01 0d 00 80 00 80 00 00 00 00 01 0a 0f 0b 
Pressure:1007.56 Humidity:65.56 Temperature:24.66
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.66&value2=65.56&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:17:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 24 00 0c 
Notification handle = 0x0012 value: f3 14 81 e1 d9 13 01 0d 00 80 00 80 00 00 00 00 01 0a 0f 0c 
Pressure:1007.56 Humidity:65.39 Temperature:24.66
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.66&value2=65.39&value3=1007.56
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:18:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 25 00 0d 
Notification handle = 0x0012 value: f3 14 83 e1 da 13 00 0d 00 80 00 80 00 00 00 00 01 0a 0f 0d 
Pressure:1007.59 Humidity:65.41 Temperature:24.64
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.64&value2=65.41&value3=1007.59
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:19:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 26 00 0e 
Notification handle = 0x0012 value: f3 14 84 e1 e2 13 03 0d 00 80 00 80 00 00 00 00 01 0a 0f 0e 
Pressure:1007.60 Humidity:65.53 Temperature:24.70
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.70&value2=65.53&value3=1007.60
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:20:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 eventNotification handle = 0x0012 value: f2 14 00 80 00 80 00 80 00 80 00 80 00 80 00 00 11 27 00 0f 
Notification handle = 0x0012 value: f3 14 7f e1 d8 13 04 0d 00 80 00 80 00 00 00 00 01 0a 0f 0f 
Pressure:1007.54 Humidity:65.38 Temperature:24.72
 Requesting URL: /trigger/3GPIRaspi3/with/key/(Key)?value1=24.72&value2=65.38&value3=1007.54
HTTP/1.1 200 OK
Server: Cowboy
Connection: close
X-Powered-By: Sad Unicorns
X-Top-Secrettt: VG9vIGVhc3k/IElmIHlvdSBjYW4gcmVhZCB0aGlzLCBFrZXJzLg==
IHdhbnQgTWFrZXJzLg==
Content-Type: text/html; charset=utf-8
Content-Length: 50
Etag: W/"32-bb4a035d"
Date: Sat, 10 Sep 2016 04:21:00 GMT
Via: 1.1 vegur

Congratulations! You've fired the 3GPIRaspi3 event

Googleスプレッドシートには、次のように温度、湿度、気圧が記録されています。

 関連URL

  1. アルプスのセンサネットワークモジュールをラズパイ3と3GPIで使ってみる(其の1 BLEパケット構造解析)
  2. アルプスのセンサネットワークモジュールをラズパイ3と3GPIで使ってみる(其の2 C言語によるBLEソフト)
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3