LoginSignup
94
101

More than 5 years have passed since last update.

Raspberry PiでUSB/Bluetoothアダプタを使う

Last updated at Posted at 2014-11-12

Raspberry PiでUSB接続のBluetoothアダプタ(ドングル)を使うためのメモ。

環境

以下の環境で構築しました。なお、インストールしているディストリビューションはRaspbianです。

pi$ uname -a
Linux raspberrypi 3.12.29+ #714 PREEMPT Wed Oct 1 23:11:38 BST 2014 armv6l GNU/Linux
pi$ cat /etc/debian_version
7.6

Bluetoothアダプタ

今回使用したBluetoothアダプタは以下の通りです。どちらも正しく認識できました。

bluezをインストールする

Bluetoothスタックであるbluezをインストールします。bluezはapt-getで簡単にインストールできます。今回インストールされたバージョンは4.99-2でした。

pi$ sudo apt-get update
pi$ sudo apt-get install bluez

Bluetoothアダプタを接続する

BluetoothアダプタをUSBポートに接続します。今回はRaspberry Pi Model B+のUSBポートに直接接続しました。

hciconfigコマンドを使って認識されていることを確認します。
(MACアドレスはマスクしています)

pi$ hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: XX:XX:XX:XX:XX:XX  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN
        RX bytes:1449 acl:0 sco:0 events:69 errors:0
        TX bytes:1328 acl:0 sco:0 commands:69 errors:0

おまけ: BLE(Bluetooth Low Energy)デバイスを検出する

hcitoolコマンドでBLEデバイスをスキャンできます。
(MACアドレスはマスクしています)

pi$ sudo hcitool lescan
LE Scan ...
XX:XX:XX:XX:XX:XX (unknown)
YY:YY:YY:YY:YY:YY (unknown)
94
101
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
94
101