...

Dependencies:   X_NUCLEO_IKS01A2

Committer:
jim_lsj
Date:
Wed Apr 29 16:18:37 2020 +0000
Revision:
1:b12ac7b02a21
Parent:
0:9c0e0ac79e75
...;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jim_lsj 0:9c0e0ac79e75 1 # BLE Heart Rate Monitor
jim_lsj 0:9c0e0ac79e75 2
jim_lsj 0:9c0e0ac79e75 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.
jim_lsj 0:9c0e0ac79e75 4
jim_lsj 0:9c0e0ac79e75 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/).
jim_lsj 0:9c0e0ac79e75 6
jim_lsj 0:9c0e0ac79e75 7 # Running the application
jim_lsj 0:9c0e0ac79e75 8
jim_lsj 0:9c0e0ac79e75 9 ## Requirements
jim_lsj 0:9c0e0ac79e75 10
jim_lsj 0:9c0e0ac79e75 11 To see the heart rate information on your phone, use the BLE Profiles App by ST:
jim_lsj 0:9c0e0ac79e75 12
jim_lsj 0:9c0e0ac79e75 13 - [ST BLE Profile](https://play.google.com/store/apps/details?id=com.stm.bluetoothlevalidation) for Android.
jim_lsj 0:9c0e0ac79e75 14
jim_lsj 0:9c0e0ac79e75 15 Alternatively, use a BLE scanner:
jim_lsj 0:9c0e0ac79e75 16
jim_lsj 0:9c0e0ac79e75 17 - [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android.
jim_lsj 0:9c0e0ac79e75 18
jim_lsj 0:9c0e0ac79e75 19 - [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone.
jim_lsj 0:9c0e0ac79e75 20
jim_lsj 0:9c0e0ac79e75 21 Hardware requirements are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
jim_lsj 0:9c0e0ac79e75 22
jim_lsj 0:9c0e0ac79e75 23 ## Building instructions
jim_lsj 0:9c0e0ac79e75 24
jim_lsj 0:9c0e0ac79e75 25 Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/mbed-os-example-ble/blob/master/README.md).
jim_lsj 0:9c0e0ac79e75 26
jim_lsj 0:9c0e0ac79e75 27 ## Checking for success
jim_lsj 0:9c0e0ac79e75 28
jim_lsj 0:9c0e0ac79e75 29 **Note:** Screens captures depicted below show what is expected from this example if the scanner used is *ST BLE Profile* version 2.0.0 or *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.
jim_lsj 0:9c0e0ac79e75 30
jim_lsj 0:9c0e0ac79e75 31 1. Build the application and install it on your board as explained in the building instructions.
jim_lsj 0:9c0e0ac79e75 32 1. Open the BLE scanner on your phone.
jim_lsj 0:9c0e0ac79e75 33 1. Start a scan.
jim_lsj 0:9c0e0ac79e75 34
jim_lsj 0:9c0e0ac79e75 35 ![](img/start_scan_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 36
jim_lsj 0:9c0e0ac79e75 37 **figure 1.a** How to start scan using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 38
jim_lsj 0:9c0e0ac79e75 39 ![](img/start_scan.png)
jim_lsj 0:9c0e0ac79e75 40
jim_lsj 0:9c0e0ac79e75 41 **figure 1.b** How to start scan using nRF Master Control Panel 4.0.5
jim_lsj 0:9c0e0ac79e75 42
jim_lsj 0:9c0e0ac79e75 43 1. Find your device; it should be named `HRM`.
jim_lsj 0:9c0e0ac79e75 44
jim_lsj 0:9c0e0ac79e75 45 ![](img/scan_result_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 46
jim_lsj 0:9c0e0ac79e75 47 **figure 2.a** Scan results using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 48
jim_lsj 0:9c0e0ac79e75 49 ![](img/scan_result.png)
jim_lsj 0:9c0e0ac79e75 50
jim_lsj 0:9c0e0ac79e75 51 **figure 2.b** Scan results using nRF Master Control Panel 4.0.5
jim_lsj 0:9c0e0ac79e75 52
jim_lsj 0:9c0e0ac79e75 53 1. Establish a connection with your device.
jim_lsj 0:9c0e0ac79e75 54
jim_lsj 0:9c0e0ac79e75 55 ![](img/connection_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 56
jim_lsj 0:9c0e0ac79e75 57 **figure 3.a** How to establish a connection using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 58
jim_lsj 0:9c0e0ac79e75 59 ![](img/connection.png)
jim_lsj 0:9c0e0ac79e75 60
jim_lsj 0:9c0e0ac79e75 61 **figure 3.b** How to establish a connection using Master Control Panel 4.0.5
jim_lsj 0:9c0e0ac79e75 62
jim_lsj 0:9c0e0ac79e75 63 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`.
jim_lsj 0:9c0e0ac79e75 64
jim_lsj 0:9c0e0ac79e75 65 ![](img/discovery_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 66
jim_lsj 0:9c0e0ac79e75 67 **figure 4.a** Representation of the Heart Rate service using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 68
jim_lsj 0:9c0e0ac79e75 69 ![](img/discovery.png)
jim_lsj 0:9c0e0ac79e75 70
jim_lsj 0:9c0e0ac79e75 71 **figure 4.b** Representation of the Heart Rate service using Master Control Panel 4.0.5
jim_lsj 0:9c0e0ac79e75 72
jim_lsj 0:9c0e0ac79e75 73 1. Register for the notifications sent by the *Heart Rate Measurement* characteristic.
jim_lsj 0:9c0e0ac79e75 74
jim_lsj 0:9c0e0ac79e75 75 ![](img/register_to_notifications_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 76
jim_lsj 0:9c0e0ac79e75 77 **figure 5.a** How to register to notifications using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 78
jim_lsj 0:9c0e0ac79e75 79 ![](img/register_to_notifications.png)
jim_lsj 0:9c0e0ac79e75 80
jim_lsj 0:9c0e0ac79e75 81 **figure 5.b** How to register to notifications using Master Control Panel 4.0.5
jim_lsj 0:9c0e0ac79e75 82
jim_lsj 0:9c0e0ac79e75 83
jim_lsj 0:9c0e0ac79e75 84 1. You should see the heart rate value change every half second.<br/>For ST BLE Profile, it begins at 60, goes up to 100 (in steps of 1), resets to 60 and so on.
jim_lsj 0:9c0e0ac79e75 85
jim_lsj 0:9c0e0ac79e75 86 ![](img/notifications_ble_profile.png)
jim_lsj 0:9c0e0ac79e75 87
jim_lsj 0:9c0e0ac79e75 88 **figure 6.a** Notifications view using ST BLE Profile 2.0.0
jim_lsj 0:9c0e0ac79e75 89
jim_lsj 0:9c0e0ac79e75 90 For Master Control Panel, it begins at 100, goes up to 175 (in steps of 1), resets to 100 and so on.
jim_lsj 0:9c0e0ac79e75 91
jim_lsj 0:9c0e0ac79e75 92 ![](img/notifications.png)
jim_lsj 0:9c0e0ac79e75 93
jim_lsj 0:9c0e0ac79e75 94 **figure 6.b** Notifications view using Master Control Panel 4.0.5