nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Heart Rate Application

The Heart Rate Application is an example that implements the Heart Rate profile using the hardware delivered in the nRF51 Development Kit.

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

When the application starts, the Board Support Package is initialized. Next, three timers are started. These timers control the generation of various parts of the Heart Rate Measurement characteristic value:

  • Heart Rate
  • RR Interval
  • Sensor Contact Detected

Also, a timer for generating battery measurements is started.

The sensor measurements are simulated the following way:

When notification of Heart Rate Measurement characteristic is enabled, the Heart Rate Measurement, containing the current value for all the components of the Heart Rate Measurement characteristic, is notified each time the Heart Rate measurement timer expires. When notification of Battery Level characteristic is enabled, the Battery Level is notified each time the Battery Level measurement timer expires.

Note
This application is not power optimized!
The application will stop advertising after 3 minutes and go to system-off mode. Push the button 1 to restart advertising.

Setup

The name of the example for PCA10028 is ble_app_hrs_s110_pca10028, and for PCA10031 it is ble_app_hrs_s110_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_peripheral\ble_app_hrs

Button assignments:

  • Button 1: Wake up from system-off and restart advertising.
  • Button 2: Wake up, erase all bonds, and restart advertising.

Testing

Test the Heart Rate Application with the nRF Toolbox app, which is available on both iOS (Apple Store) and Android (Google Play).

You can also test the application with the Master Control Panel by performing the following steps:

  1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_HRM'), then perform service discovery. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  3. Click the 'Enable services' button on the Master Control Panel. Observe that Heart Rate notifications are received every second, and Battery Level notifications are received every two seconds.