nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
BLE Heart Rate Collector Example

The BLE Heart Rate Collector application implements the Heart Rate Collector Role using the S120 SoftDevice.

GAP role implemented is the Central role. GATT role implemented is the Client role.

The Heart Rate Collector application implements the Collector role for the Heart Rate Profile. It scans peripheral devices, connects to the device advertising with Heart Rate Service UUID in its advertisement report, and discovers and configures the Heart Rate Service to start sending Notifications of Heart Rate Measurement. The Heart Rate Measurement received is displayed on the Display unit as well as logged on UART interface. This application will also discover and configure Battery Service at the peer.

The application includes the two services in the Heart Rate profile:

The application currently does not support connecting to multiple peripherals. Handling Connection Parameters Update and Pairing/Bonding are not implemented. Once connected, the application does not initiate disconnection but is capable of handling disconnection event initiated by peer or triggered unexpectedly.


The name of the example for PCA10028 is ble_app_hrs_c_s120_pca10028, and for PCA10031 it is ble_app_hrs_c_s120_pca10031. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\Nordic\nrf51\examples\ble_central\ble_app_hrs_c

Display Unit is used to display the Heart Rate values and Battery Level values received from peer (heart rate sensor).
If you do not have the display unit, the definition of the macro APPL_LCD_PRINT_ENABLE in main.c of this application must be commented out. If this is not done, the application will not run as expected.


Two boards are needed to perform this test:

  • Collector Board: nRF51 Development board mounted with nRF51822 containing S120 SoftDevice.
  • Sensor Board: nRF51 Development board mounted with nRF51822 chip Board containing S110 SoftDevice and the Heart Rate Application provided with the nRF51 SDK.

The application running on the Sensor Board is intended to serve as a peer (i.e. Heart Rate Sensor role) to this Heart Rate Collector application.

Test the BLE Heart Rate Collector Example application by performing the following steps:

  1. Compile and program the BLE Heart Rate Collector Example application on the Collector Board. Ensure that the S120 SoftDevice is used for this application.
  2. On the Collector board, observe that the BSP_INDICATE_ADVERTISING state is indicated. This shows that the application is scanning for Heart Rate Sensors. The Display Unit will display 'Scanning'.
    If there are bonded devices in the bonded device list, whitelist scanning is used for the first 30 seconds. If no heart rate device is found during this time, non-whitelisted (general) scanning is used.
  3. Compile and program the Heart Rate Sensor application on the Sensor Board. Ensure the S110 SoftDevice is used for this application.
  4. Observe that the Heart Rate Sensor is advertising.
  5. Once the connection is established, the BSP_INDICATE_CONNECTED state is indicated on the Collector Board. The Display Unit will display 'Connected'.
    The sensor application may just have advertised for a very short while before the Collector application had connected. So it is possible that the tester has missed to note that the Sensor application was advertising.
  6. After a few seconds, observe Heart Rate measurements displayed on the Display Unit. The Display Unit will display Heart Rate on the upper line and the Battery Level of the peer value on the lower line.