0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

POLAR OH1+ 心拍センサー Python読み方

0
Posted at

POLAR OH1+ 心拍センサーPython読み方

Polarは客向けの価格心拍センサーで、精度が高くで有名だ。以下のプログラムはWindows OSでテストしましたが、他のOSで実装は可能と思う。OH1+以外のPolar心拍センサーの対応も可能と思う。

前提条件のインストール

今回のプログラムはBLEデバイスと通信できるようなモジュールだけが必要で、bleakを利用した。PythonバージョンがPython > 3.7で設定する。

pip install bleak

本プログラムは以下のgithubリンクから取れる。
https://github.com/ikuzo-lab/Polar_OH1

プログラムの使いかた

デバイススキャン

get_polarhandler.pyコードを実行し、デバイス名、デバイスアドレス、デバイス通知用のUUIDをリストする。

python get_polarhandler.py

リストされたデバイスをターミナルで表示、またはscan_log.txtに発行する。
実行された結果は以下の例に表示する。

(py310) D:\PythonProj\PolarOH1>python get_polarhandler.py
[INFO] Scanning for Polar devices...
[INFO] Found 1 devices
[INFO] Scanning for Notification Handler from the Device...
[INFO] Listing all heart rate notification handler

Device Name          Device Address       Notification Handler
================================================================================
Polar OH1 0AD7****   24:AC:AC:**:**:**    00002a37-0000-1000-****-************

Polarに接続方法

特定なデバイスから心拍を読むため、デバイスアドレスとデバイス通知用のUUIDをpolar_notify.py or polar_plot.pyのコードにコピーする。
リストから選択し、デバイスアドレスはaddressに、デバイス通知用のUUIDはchar_uuidにコピーする。

...
if __name__ == "__main__":
    # Put the BLE device information to connect with
    address = "24:AC:AC:0A:D7:F2"  # BLE address
    char_uuid = "00002a37-0000-1000-8000-00805f9b34fb"  #  HRM_handler
...

トラブルシューティング

デバイススキャンステップにデバイスを見つけない場合は、Polarデバイスを再起動する。
本テストで、Bluetoothペアーなど実行されません。
プログラムは動かない場合ペアーを消し、ペアーせずもう一度実行する。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?