A web client for Bluetooth heart monitoring devices, built with the Web Bluetooth API.
Visit the project's live url with a supported browser. Then, connect a Bluetooth device with heart monitoring capabilities. If you don't have such a device, you can emulate one using your smartphone following the guide below.
This project has zero dependencies and is really easy to set up. A static file server like Python's http.server (shown below) can be used to server the assets.
Run the commands to get up and running:
git clone https://github.com/megaconfidence/bt-heart-monitor.git
cd bt-heart-monitor/
python3 -m http.server 3000
Then visit http://localhost:3000/ in a supported browser.
If you don't have a Bluetooth enabled device with heart monitoring capabilities (i.e a smartwatch or fitness tracker with a heart rate sensor), you can set up an emulator using a smartphone. This guide shows you how to do so.
-
Install the nRF Connect app. It is available for Android and iOS
-
Allow the required permissions such as device location and nearby devices
-
From the app menu, go to
Configure GATT server
, click on the dropdown at the top of the app and selectSample configuration
![](https://private-user-images.githubusercontent.com/17744578/295138916-96ef67e2-415f-460d-a00b-fda9351f1338.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDYzNjgsIm5iZiI6MTcxOTMwNjA2OCwicGF0aCI6Ii8xNzc0NDU3OC8yOTUxMzg5MTYtOTZlZjY3ZTItNDE1Zi00NjBkLWEwMGItZmRhOTM1MWYxMzM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI1VDA5MDEwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNjNDUxZGIzNDZhYjRkNmNmOWQxNDM2YTE5MjkxNTg1YzQzYTJmYzA4YjgxZDBkOWFlNWRkYjExMDI0NjQ1NGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.e5zSBllCrd_HAMZERG_0IoB8ixY6khKMnelHCaUGUvo)
- Using the app menu, head back to
Devices
, and then switch to theAdvertiser
tab - Click on the plus button to create a new advertising packet. Give it a
Display name
(i.e a packet name that's only used in app) - Then click on the
Add Record
dropdown, selectComplete Local Name
. This allows your device to be visible with its default Bluetooth name - Click on
Add Record
again and selectService UUID
. With the input, search and selectHeart Rate
- Back in the config modal, under
Options
, checkConnectable
. You'll noticeScannable
is auto checked as well
![](https://private-user-images.githubusercontent.com/17744578/295215392-1fb60c2e-713a-413b-ab84-2bc5e9e6ca1b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDYzNjgsIm5iZiI6MTcxOTMwNjA2OCwicGF0aCI6Ii8xNzc0NDU3OC8yOTUyMTUzOTItMWZiNjBjMmUtNzEzYS00MTNiLWFiODQtMmJjNWU5ZTZjYTFiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI1VDA5MDEwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNlZmY3ZWIwYjE5ZDBiNjIzMzE5NmJmMjNhODI1OGQ4OGY2MjVkYzY1MDRlNTA1N2UxODM3MzlkNWJhODFhYWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jH3gCiFJAVcoydJhBDu9dfrcL5m6_wF89T4bgu1GGo8)
- Click on
Ok
- Click on the switch beside the packet name to turn it ON. You may get a one-time popup to configure the advertisement duration.
The defaults are okay, and you can check the
Remember for this packet
box
![](https://private-user-images.githubusercontent.com/17744578/295217234-98e71143-9568-4651-9b4e-cafb8285f81f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDYzNjgsIm5iZiI6MTcxOTMwNjA2OCwicGF0aCI6Ii8xNzc0NDU3OC8yOTUyMTcyMzQtOThlNzExNDMtOTU2OC00NjUxLTliNGUtY2FmYjgyODVmODFmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI1VDA5MDEwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIyMjM0MzNjN2RiMTAyNTliMzkxNzQ0MDVjOTllODE5Y2EyM2Q0ZmZlODVjYzEzMmFhZjNjMTkwMTVlMjQ2NmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.oFga9qK5Ytd_gO_CRSQq6kS-dsVisDd96cSlCa_nXPQ)
- Click
Ok
and you are good to go. You can always turn OFF the emulator by turning OFF the packet and disabling the GATT server from step 3