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
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
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice
The following board variants have DFU capabilities:
S145:
Hardware platform
PCA
Board target
PCA10156
bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L10)
PCA10156
bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice/mcuboot
nRF54L15 DK (emulating nRF54L05)
PCA10156
bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice/mcuboot
PCA10184
bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice/mcuboot
PCA10214
bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice/mcuboot
PCA10188
bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice/mcuboot
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:
Compile and program the application.
In the Serial Terminal, observe that the
BLE HRS Central sample initializedmessage is printed.Program the other development kit with the Bluetooth: Heart Rate Service sample and reset it.
Observe that the
Scan filter matchmessage is printed, followed byConnecting to targetandConnected.Observe that the
Heart rate service discovered.message is printed.Observe that the device starts receiving heart rate and battery level measurement notifications.