Procedure

RaspberryPiにおけるBLEの設定

この記事は約2分で読めます。
スポンサーリンク

RaspberryPiでBLE(Bletooth Low Energy)を使ったビーコンを作る機会があり、設定の仕方をまとめたので記載

スポンサーリンク

必要なもの

  • RaspberryPi
  • BLEの機能があるBluetoothドングル (Bluetooth4.0以降なら可能) ※RaspberryPi3であればすでに内蔵しているため、購入する必要なし

 

インストール等々

$sudo apt-get update
$sudo apt-get upgrade
$sudo reboot
$sudo apt-get dist-upgrade
※これで勝手にBluezの一通りのセットアップはできている

 

pythonのインストールとライブラリのインストール

$sudo apt-get -y install python-pip
$sudo apt-get install python-dev libbluetooth-dev libboost-all-dev
$sudo pip install pybluez

 

使えそうなコマンド

Bluetooothドングルの情報出力

$hciconfig

 

BLEデバイスのスキャニング

$sudo hcitool -i hci0 lescan

 

Bluetoothドングルの再起動

$sudo hciconfig hci0 down 
$sudo hciconfig hci0 up

 

実際の使用の仕方は参考”2″のgitがオススメ

参考

  1. http://kakakikikeke.blogspot.jp/2015/10/raspberrypi-bluez-ble.html
  2. http://github.com/switchdoclabs/iBeacon-Scanner-

コメント

タイトルとURLをコピーしました