2013-12-12

[.tested] TI CC2541 SensorTag Development Kit[debian Wheezy][AX3][A7]




先日、以下の記事で紹介した、TI CC2541 SensorTag Kitと、OpenBlocks Aシリーズとの接続評価を行いました。

TI CC2541 SensorTag Development Kit


OBDN技術ブログによる動作検証は、該当するデバイスの動作を保証およびサポートを行うものではありません。
内容に関するご指摘などありましたら、ブログ記事の担当までご連絡下さい。

<検証環境>
Debian 7.1 Wheezy
OpenBlocks AX3/4 kernel: 3.2.40
OpenBlocks A6/A7 kernel: 3.2.40

1. 事前準備


本装置は、Bluetooth LEにより通信を行うため、OpenBlocks本体に、USB Bluetoothアダプタを接続して使用します。
Bluetoothアダプタに関しては、以下の記事において、一部製品の接続検証を行っております。

 周辺機器接続テスト

上記の記事に、Bluetooth接続に関する説明を記述しておりますが、今回は、Bluetooth LEによる接続であるため、手順に関しては本記事にて説明します。

Bluez 5.12の導入

Debian Wheezyにて提供されるbluezパッケージでは、gatttoolによるデータのwriteが出来ず、Web検索したところ、以下のページを参考に、5.12をインストールしました。
また、下記ページでは今回使用したデバイスそのもののテストも行っています。

Michael Saunby: Raspberry Pi and TI CC2541 SensorTag:

導入に際しては、事前に開発環境のインストールを行ってください。
( すでに行っている場合は必要ありません)

# aptitude install build-essential

Bluez 5.12のビルドに必要なライブラリをインストールします。

# aptitude install libglib2.0-dev libdbus-1-dev libusb-dev libudev-dev libical-dev systemd libreadline-dev

Bluez 5.12を入手し、解凍します。

# wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.12.tar.xz
# tar -Jxvf bluez-5.12.tar.xz

INSTALLドキュメントに従い、インストールします。

# cd bluez-5.12/
# ./configure
# make
# make install

2. 接続方法


CC2541のデータハンドリングは、以下のTI Wikiに記述されています。

SensorTag User Guide - Texas Instruments Wiki:


今回は、wheezyのbluetoothサポートパッケージを導入していませんので、手動でデバイスの立ち上げからテストまでを行っています。

# hciconfig hci0 up

デバイスサイドにあるスイッチを押して、BLEデバイスのスキャンを行います。


# hcitool lescan
LE Scan ...
34:B1:F7:D5:59:2A (unknown)
34:B1:F7:D5:59:2A SensorTag
 :
 :

gatttoolにより、インタラクティブにセンサーデータを取得してみます。

# gatttool -i hci0 -b 34:B1:F7:D5:59:2A -I
[34:B1:F7:D5:59:2A][LE]> connect
Attempting to connect to 34:B1:F7:D5:59:2A
Connection successful
[34:B1:F7:D5:59:2A][LE]> primary
attr handle: 0x0001, end grp handle: 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0022 uuid: 0000180a-0000-1000-8000-00805f9b34fb
attr handle: 0x0023, end grp handle: 0x002a uuid: f000aa00-0451-4000-b000-000000000000
attr handle: 0x002b, end grp handle: 0x0035 uuid: f000aa10-0451-4000-b000-000000000000
attr handle: 0x0036, end grp handle: 0x003d uuid: f000aa20-0451-4000-b000-000000000000
attr handle: 0x003e, end grp handle: 0x0048 uuid: f000aa30-0451-4000-b000-000000000000
attr handle: 0x0049, end grp handle: 0x0054 uuid: f000aa40-0451-4000-b000-000000000000
attr handle: 0x0055, end grp handle: 0x005c uuid: f000aa50-0451-4000-b000-000000000000
attr handle: 0x005d, end grp handle: 0x0061 uuid: 0000ffe0-0000-1000-8000-00805f9b34fb
attr handle: 0x0062, end grp handle: 0x0068 uuid: f000aa60-0451-4000-b000-000000000000
attr handle: 0x0069, end grp handle: 0xffff uuid: f000ffc0-0451-4000-b000-000000000000
[34:B1:F7:D5:59:2A][LE]> char-read-hnd 38
Characteristic value/descriptor: 00 00 00 00
[34:B1:F7:D5:59:2A][LE]> char-write-req 3c 01
Characteristic value was written successfully
[34:B1:F7:D5:59:2A][LE]> char-read-hnd 38
Characteristic value/descriptor: 4c 6d 46 60
[34:B1:F7:D5:59:2A][LE]>


上記の手順により、センサーデータから数値を取得することが出来ます。


ただし、このデバイスは常時監視する用途には向きません。
USBに直結するタイプのインターフェースも配布されていますので、別途入手して評価する予定です。

0 件のコメント:

コメントを投稿