文章總列表

Holiday Bluetooth engineer, establish environment

Because of exercise, I became a fan of Bluetooth low energy (BLE). I bought the heart rate monitor to tract my heart rate, but I found it's not precise counting. I wanted to know why BLE is working. I used the recently bought toy "Raspberry Pi" as research platform. So... this thing is interesting & funny, or just torturing me, I will know soon...

---- 

Establish environment

Linux Bluetooth protocol stack is Bluez, which is a project sponsored by Qualcomm. Even more, Bluez is also formal Linux kernel Bluetooth driver. But the interesting thing is, bluedroid is replacing Bluez since Android 4.2 which is cooperated by Google and Broadcom. As a holiday Bluetooth engineer, I choose mature solution, Bluez.

The formal Bluez in Raspbian is very old in 2014/9/28. I followed the instruction to get the latest bluez. So I got version 5.23. Although RPi running gcc make me surprise, it is very slow when compiling something large (lol). Anyway, I let Bluez run, and prepare to do the experiment.

Command list of get bluez
    mkdir blue
    cd blue
    wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.23.tar.xz
    xz -d bluez-5.23.tar.xz
    tar xvf bluez-5.23.tar


Command list of compile & install bluez
    cd bluez-5.2.3
    ./configure --disable-systemd
    make
    make install

Install gatttool to the system
    cp bluez-5.23/attrib/gatttool /usr/local/bin/


----


Show Time

After some suffering, finally I set up the environment. The picture below showed that a Bluetooth device is running (hci0), and it had some RX/TX bytes. I ran "hcitool lescan" mode to search for my Bluetooth heart rate monitor. It worked, detecting the mac address :-)



Within Bluez package, it also contains a sniffer which is able to monitor Bluetooth packet. In the screen below, 0x180D stands for heart rate monitor. The transmission power was quite low, RSSI -71. This means that wearing the device all day long will not burn my heart.


It's really tough to make the Bluetooth work...


----


Coming soon:
  1. Use gatttool to interact with my Bluetooth heart monitor
  2. Understand how BLE communicates with Host
  3. Show the heart rate counter
  4. Been Bluetooth expert !!

留言

這個網誌中的熱門文章

幼犬書桌椅選擇心得 升降桌 兒童桌椅

STM32 UART + DMA,使用HAL實作TX/RX,以及不定長度接收

CANON G3000 廢墨瓶改裝