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がオススメ
コメント