nRF51 SDK - S110 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Heart Rate Application
Sports-and-Fitness.jpg

Heart Rate Example

The Heart Rate Application is a firmware example that implements the Heart Rate profile using the hardware delivered in the nRF51822 Development Kit.

The source code and project file can be found in the <InstallFolder>\Nordic\nrf51822\Board\nrf6310\s110\ble_app_hrs folder.

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

In addition, use of the Battery Service is also demonstrated.

When the application starts, three timers are started which control 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:

  • Heart Rate: See ble_sdk_lib_sensorsim.
  • RR Interval: See ble_sdk_lib_sensorsim.
  • Sensor Contact: The state is toggled each time the timer expires.
  • Battery Level: See ble_sdk_lib_sensorsim.

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 optimised!
The application will stop advertising after 3 minutes and go to system-off mode. Push the button 0 restart advertising.

Setup

Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).

LED assignments:

  • LED 0: Advertising
  • LED 1: Connected
  • LED 7: Asserted (i.e. an assert check in the application has failed)

Buttons assignments:

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

Testing

The Heart Rate Application can be tested using the "nRF Toolbox" app, available on both iOS (Apple Store) and Android (Google Play).

It can also be tested using the Master Control Panel as follows:

  1. Compile and program the application. Observe that the Advertising LED is lit.
  2. Connect to the device from Master Control Panel (the device will be advertising as 'Nordic_HRM'), then perform service discovery. Observe that the Connected LED is lit, and the Advertising LED is off.
  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.