This application transmits a heart rate value using the Bluetooth SIG Heart Rate Profile. The heart rate value is provided by the application itself, not by a sensor, so that you don't have to get a sensor just to run the example. The canonical source for this example lives at https://github.com/ARMmbed/mbed-os-example-ble/tree/master/BLE_HeartRate

BLE Heart Rate Monitor

This application transmits a heart rate value using the Bluetooth SIG Heart Rate Profile. The heart rate value is provided by the application itself, not by a sensor, so that you don't have to get a sensor just to run the example.

Technical details are better presented in the mbed Classic equivalent of this example.

Running the application

Requirements

To see the heart rate information on your phone, download Panobike for iOS or Android.

You could also use a generic BLE scanners:

- nRF Master Control Panel for Android.

- LightBlue for iPhone.

Hardware requirements are in the main readme.

Building instructions

Building with mbed-cli

If you'd like to use mbed-cli to build this, then you should refer to the main readme. The instructions here relate to using the developer.mbed.org Online Compiler

In order to build this example in the mbed Online Compiler, first import the example using the ‘Import’ button on the right hand side.

Next, select a platform to build for. This must either be a platform that supports BLE, for example the NRF51-DK, or one of the following:

List of platforms supporting Bluetooth Low Energy

Or you must also add a piece of hardware and the supporting library that includes a Bluetooth Low Energy driver for that hardware, for example the K64F or NUCLEO_F401RE with the X-NUCLEO-IDB05A1

List of components supporting Bluetooth Low Energy.

Once you have selected your platform, compile the example and drag and drop the resulting binary onto your board.

For general instructions on using the mbed Online Compiler, please see the mbed Handbook

Checking for success

Note: Screens captures depicted below show what is expected from this example if the scanner used is nRF Master Control Panel version 4.0.5. If you encounter any difficulties consider trying another scanner or another version of nRF Master Control Panel. Alternative scanners may require reference to their manuals.

  • Build the application and install it on your board as explained in the building instructions.
  • Open the BLE scanner on your phone.
  • Start a scan.

/media/uploads/vcoubard/start_scan.png

figure 1 How to start scan using nRF Master Control Panel 4.0.5

  • Find your device; it should be named `HRM`.

/media/uploads/vcoubard/scan_result.png

figure 2 Scan results using nRF Master Control Panel 4.0.5

  • Establish a connection with your device.

/media/uploads/vcoubard/connection.png

figure 3 How to establish a connection using Master Control Panel 4.0.5

  • Discover the services and the characteristics on the device. The *Heart Rate* service has the UUID `0x180D` and includes the *Heart Rate Measurement* characteristic which has the UUID `0x2A37`.

/media/uploads/vcoubard/discovery.png

figure 4 Representation of the Heart Rate service using Master Control Panel 4.0.5

  • Register for the notifications sent by the Heart Rate Measurement characteristic.

/media/uploads/vcoubard/register_to_notifications.png

figure 5 How to register to notifications using Master Control Panel 4.0.5

  • You should see the heart rate value change every half second. It begins at 100, goes up to 175 (in steps of 1), resets to 100 and so on.

/media/uploads/vcoubard/notifications.png

figure 6 Notifications view using Master Control Panel 4.0.5

Committer:
Vincent Coubard
Date:
Tue Jul 26 14:45:32 2016 +0100
Revision:
0:fb66cae3e9a1
Child:
1:72c60abef7e7
Update example at tag mbed-os-5.0.1-rc1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 0:fb66cae3e9a1 1 # BLE Heart Rate Monitor
Vincent Coubard 0:fb66cae3e9a1 2
Vincent Coubard 0:fb66cae3e9a1 3 This application transmits a heart rate value using the [Bluetooth SIG Heart Rate Profile](https://developer.bluetooth.org/TechnologyOverview/Pages/HRP.aspx). The heart rate value is provided by the application itself, not by a sensor, so that you don't have to get a sensor just to run the example.
Vincent Coubard 0:fb66cae3e9a1 4
Vincent Coubard 0:fb66cae3e9a1 5 Technical details are better presented [in the mbed Classic equivalent of this example](https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_HeartRate/).
Vincent Coubard 0:fb66cae3e9a1 6
Vincent Coubard 0:fb66cae3e9a1 7 # Running the application
Vincent Coubard 0:fb66cae3e9a1 8
Vincent Coubard 0:fb66cae3e9a1 9 ## Requirements
Vincent Coubard 0:fb66cae3e9a1 10
Vincent Coubard 0:fb66cae3e9a1 11 To see the heart rate information on your phone, download Panobike for [iOS](https://itunes.apple.com/gb/app/panobike/id567403997?mt=8) or [Android](https://play.google.com/store/apps/details?id=com.topeak.panobike&hl=en).
Vincent Coubard 0:fb66cae3e9a1 12
Vincent Coubard 0:fb66cae3e9a1 13 You could also use a generic BLE scanners:
Vincent Coubard 0:fb66cae3e9a1 14
Vincent Coubard 0:fb66cae3e9a1 15 - [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android.
Vincent Coubard 0:fb66cae3e9a1 16
Vincent Coubard 0:fb66cae3e9a1 17 - [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone.
Vincent Coubard 0:fb66cae3e9a1 18
Vincent Coubard 0:fb66cae3e9a1 19 Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
Vincent Coubard 0:fb66cae3e9a1 20
Vincent Coubard 0:fb66cae3e9a1 21 ## Building instructions
Vincent Coubard 0:fb66cae3e9a1 22
Vincent Coubard 0:fb66cae3e9a1 23 Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
Vincent Coubard 0:fb66cae3e9a1 24
Vincent Coubard 0:fb66cae3e9a1 25 ## Checking for success
Vincent Coubard 0:fb66cae3e9a1 26
Vincent Coubard 0:fb66cae3e9a1 27 **Note:** Screens captures depicted below show what is expected from this example if the scanner used is *nRF Master Control Panel* version 4.0.5. If you encounter any difficulties consider trying another scanner or another version of nRF Master Control Panel. Alternative scanners may require reference to their manuals.
Vincent Coubard 0:fb66cae3e9a1 28
Vincent Coubard 0:fb66cae3e9a1 29 1. Build the application and install it on your board as explained in the building instructions.
Vincent Coubard 0:fb66cae3e9a1 30 1. Open the BLE scanner on your phone.
Vincent Coubard 0:fb66cae3e9a1 31 1. Start a scan.
Vincent Coubard 0:fb66cae3e9a1 32
Vincent Coubard 0:fb66cae3e9a1 33 ![](img/start_scan.png)
Vincent Coubard 0:fb66cae3e9a1 34
Vincent Coubard 0:fb66cae3e9a1 35 **figure 1** How to start scan using nRF Master Control Panel 4.0.5
Vincent Coubard 0:fb66cae3e9a1 36
Vincent Coubard 0:fb66cae3e9a1 37 1. Find your device; it should be named `HRM`.
Vincent Coubard 0:fb66cae3e9a1 38
Vincent Coubard 0:fb66cae3e9a1 39 ![](img/scan_result.png)
Vincent Coubard 0:fb66cae3e9a1 40
Vincent Coubard 0:fb66cae3e9a1 41 **figure 2** Scan results using nRF Master Control Panel 4.0.5
Vincent Coubard 0:fb66cae3e9a1 42
Vincent Coubard 0:fb66cae3e9a1 43 1. Establish a connection with your device.
Vincent Coubard 0:fb66cae3e9a1 44
Vincent Coubard 0:fb66cae3e9a1 45 ![](img/connection.png)
Vincent Coubard 0:fb66cae3e9a1 46
Vincent Coubard 0:fb66cae3e9a1 47 **figure 3** How to establish a connection using Master Control Panel 4.0.5
Vincent Coubard 0:fb66cae3e9a1 48
Vincent Coubard 0:fb66cae3e9a1 49 1. Discover the services and the characteristics on the device. The *Heart Rate* service has the UUID `0x180D` and includes the *Heart Rate Measurement* characteristic which has the UUID `0x2A37`.
Vincent Coubard 0:fb66cae3e9a1 50
Vincent Coubard 0:fb66cae3e9a1 51 ![](img/discovery.png)
Vincent Coubard 0:fb66cae3e9a1 52
Vincent Coubard 0:fb66cae3e9a1 53 **figure 4** Representation of the Heart Rate service using Master Control Panel 4.0.5
Vincent Coubard 0:fb66cae3e9a1 54
Vincent Coubard 0:fb66cae3e9a1 55 1. Register for the notifications sent by the *Heart Rate Measurement* characteristic.
Vincent Coubard 0:fb66cae3e9a1 56
Vincent Coubard 0:fb66cae3e9a1 57 ![](img/register_to_notifications.png)
Vincent Coubard 0:fb66cae3e9a1 58
Vincent Coubard 0:fb66cae3e9a1 59 **figure 5** How to register to notifications using Master Control Panel 4.0.5
Vincent Coubard 0:fb66cae3e9a1 60
Vincent Coubard 0:fb66cae3e9a1 61
Vincent Coubard 0:fb66cae3e9a1 62 1. You should see the heart rate value change every half second. It begins at 100, goes up to 175 (in steps of 1), resets to 100 and so on.
Vincent Coubard 0:fb66cae3e9a1 63
Vincent Coubard 0:fb66cae3e9a1 64 ![](img/notifications.png)
Vincent Coubard 0:fb66cae3e9a1 65
Vincent Coubard 0:fb66cae3e9a1 66 **figure 6** Notifications view using Master Control Panel 4.0.5