Bluetooth: Heart Rate Service Central

The Heart Rate Service Central sample demonstrates how you can implement the Heart Rate and Battery Level profiles as a client using nRF Connect SDK Bare Metal option.

Requirements

The sample supports the following development kits:

The following board variants do not have DFU capabilities:

S145:

Hardware platform

PCA

Board target

nRF54L15 DK

PCA10156

bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice

nRF54L15 DK (emulating nRF54L10)

PCA10156

bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice

nRF54L15 DK (emulating nRF54L05)

PCA10156

bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice

nRF54LM20 DK

PCA10184

bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice

nRF54LS05 DK

PCA10214

bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice

nRF54LV10 DK

PCA10188

bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice

Overview

This sample scans for devices that advertise with the Heart Rate Service (HRS) UUID (0x180D) and initiates a connection when a device is found. When a device is connected, the sample starts the service discovery procedure. If this succeeds, the sample subscribes to the Heart Rate Measurement characteristic to receive heart rate notifications and the Battery Level characteristic to receive battery level notifications.

User interface

Button 0:

Press to disable allow list.

Button 1:

Press to disconnect from the connected peer device.

Keep the button pressed while resetting the board to delete bonding information for all peers stored on the device.

LED 0:

Lit when the device is initialized.

LED 1:

Lit when a device is connected.

Building and running

This sample can be found under samples/bluetooth/ble_hrs_central/ in the Bare Metal folder structure.

For details on how to create, configure, and program a sample, see Getting Started with the samples.

Testing

This sample requires two devices to test, one running this sample and another one running the Bluetooth: Heart Rate Service sample.

Complete the following steps to test the sample:

  1. Compile and program the application.

  2. In the Serial Terminal, observe that the BLE HRS Central sample initialized message is printed.

  3. Program the other development kit with the Bluetooth: Heart Rate Service sample and reset it.

  4. Observe that the Scan filter match message is printed, followed by Connecting to target and Connected.

  5. Observe that the Heart rate service discovered. message is printed.

  6. Observe that the device starts receiving heart rate and battery level measurement notifications.