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