Skip to content

danielsousaoliveira/miband-HR-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heart rate monitor for Mi Band 6 and 7

This is a C implementation of the miband-6-heart-rate-monitor

Real time heart rate monitor for Mi Band 6 and 7 using c

Note: Currently Mi Band 7 is not working properly

Demonstration

Requirements

  1. Install dependencies:
sudo apt-get install libssl-dev
sudo apt install libbluetooth-dev libreadline-dev
  1. Clone this repository

  2. Clone gattlib

  3. Build Gattlib

cd <gattlib-src-root>
mkdir build && cd build
cmake ..
make
sudo make install
  1. Clone tiny-ECDH-c

  2. Add this code to a file named CMakeLists.txt, and put it into the tiny ECDH main folder:

cmake_minimum_required(VERSION 3.10)
project(tiny-ECDH-c C)

set(CMAKE_C_STANDARD 11)

add_library(tiny-ECDH-c STATIC ecdh.c)
target_include_directories(tiny-ECDH-c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

How to use

  1. Find your Mi Band's Authentication Key (Check Here)

  2. Go to the root folder of this repository (cd miband-HR-c)

  3. Put your authentication key to auth_key.txt file in the current directory.

  4. Turn off Bluetooth on your mobile device paired with the band

  5. Find out your band MAC address using bluetoothctl

sudo bluetoothctl
scan on
devices
  1. Go to root folder, create a build folder and navigate to it
mkdir build && cd build
  1. Run:
// For Mi Band 6
cmake -DMAC_ADDRESS="YOUR_MAC_ADDRESS" ..
make
./miband_c

// For Mi Band 7
cmake -DMAC_ADDRESS="YOUR_MAC_ADDRESS" -DBAND_TYPE "7" ..
make
./miband_c

Doxygen

This code is documented using Doxygen style.

  1. Install Doxygen
sudo apt install doxygen
  1. Generate Doxyfile
doxygen -g Doxyfile
  1. Make changed in the Doxyfile
INPUT = .
RECURSIVE = YES
  1. Run Doxygen
doxygen Doxyfile
  1. Open index.html inside the html folder

References

Libraries

TODO

  1. More robust memory allocation
  2. Develop Band 7 interface
  3. Implement Spo2 measurement

About

Heart Rate Monitor using Mi Band 6 or 7, in C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published