Getting started with the Heart Rate Sensor within STM32WB0 Bluetooth® Low Energy

Revision as of 17:33, 17 July 2024 by Registered User
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1. Heart Rate Profile

Heart Rate Profile (HRP) [1] is a generic attribute profile (GATT) based low-energy profile defined by the Bluetooth® Special Interest Group[2]
The HRP, widely used in fitness applications, defines the communication process between a GATT-server of a Heart Rate Sensor device, such as a wrist band, and a GATT-client Collector device, such as a smartphone or tablet.

  • The Heart Rate Sensor:
    • Measures the heart rate and exposes it via the Heart Rate Service[3].
    • Contains the Device Information Service that includes information, for example, about the manufacturer of the device.
    • Is the GATT server.
  • The Heart Rate Collector:
    • Accesses the information exposed by the heart rate sensor. It can display it to the end user, or store it on a nonvolatile memory for later analysis.
    • Is the GATT client.

The description of the Heart Rate Sensor project provided within the STM32CubeWB0 MCU Package[4] is the subject of this article.

Bluetooth® Low Energy Heart Rate Profile & STM32WB0
STM32WB0 Heart Rate Profile


The table below describes the structure of Heart Rate Sensor services:

Bluetooth® Low Energy Heart Rate Service specification
Service Characteristic Mode UUID size
Heart Rate Service 0x180D
Heart Rate Measurement Notify 0x2A37 23
Body Sensor Location Read 0x2A38 1
Heart Rate Control Point Write 0x2A39 1
Device Information Service 0x180A
Manufacturer Name String Read 0x2A29 32


The Heart Rate Profile is a combination of a Heart Rate Collector and a Heart Rate Sensor. The goal is to connect and exchange data in different applications.

The GAP - Generic Access Profile defines and manages advertising and connection.

Collector Central device and Sensor Peripheral device
Connectivity HR GAP Interaction.png


The GATT - generic attribute profile defines and manages in/out data exchange.

Collector GATT client device and Sensor GATT service device
Connectivity HR GATT Interaction.png


Example of flow diagram between STM32WB0 & STBLEToolbox
STM32WB0 HR Flow Diagram


1.1. Advertising Data

At startup, the Heart Rate Sensor application starts a fast advertising(80ms/100ms).
Data advertised are composed as follow:

Heart Rate Advertising packet
Description Length AD Type Value
Device Name 6 0x09 HR_XX (XX: last byte of BD address)
Service UUID 3 0x03 0x180D (HRS)
Manufacturer Data 15 0xFF See table below
Flags 2 0x01 0x06
(GeneralDiscoverable, BrEdrNotSupported)



The manufacturer data are encoded following STMicroelectronics BlueST-SDK v2 as described below:

STMicroelectronics Manufacturer Advertising data
Byte Index 0 1 2-3 4 5 6 7 8 9 10-15
Function Length Manufacturer ID Company BlueST-SDK Version Board ID Firmware ID Option 1 Option 2 Option 3 Device Address
Value 0x0F 0xFF 0x0030 STMicroelectronics 0x02 0x8D Nucleo-WB0 0x89 - HR Sensor 0x00 0x00 0x00 0x08E12Axxxx


Advertising is switched to Low Power advertising (1s/2.5s) after 60s.