nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
BLE Heart Rate Collector Example

Functionality

The BLE Heart Rate Collector application implements the Heart Rate Collector Role using the S120 SoftDevice.

GAP role implemented is the Central role. GATT role implemented is the Client role.

The Heart Rate Collector application implements Collector role for Heart Rate Profile. It scans peripheral devices, connects to device advertising with Heart Rate Service UUID in its advertisement report, discovers and configures Heart Rate Service to start sending Notifications of Heart Rate Measurement. The Heart Rate Measurement received is displayed on the nRF6350 Display unit as well as logged on UART interface. This application will also discover and configure Battery Service at the peer.

The source code and project file for this application can be found in the following folder:
<InstallFolder>\Nordic\nrf51822\Board\nrf6310\S120\experimental\ble_app_hrs_c

Note
The application currently does not support connecting to multiple peripherals. Handling Connection Parameters Update and Pairing/Bonding are not implemented. Once connected, the application does not initiate disconnection but is capable of handling disconnection event initiated by peer or triggered unexpectedly.

LED Assignments

  • LED 0: Scanning.
  • LED 1: Connected.
  • LED 7: Asserted.
Note
Display Unit is used to display the Heart Rate values and Battery Level values received from peer (heart rate sensor).

Instructions on how to set up the nRFgo Motherboard and the nRF6350 Display unit: nRFgo Motherboard Setup (nRF6310).

Warning
If you do not have the display unit, the definition of the macro APPL_LCD_PRINT_ENABLE in main.c of this application must be commented out. If this is not done, the application will not run as expected.

Additionally trace messages are logged on UART. UART configuration used is:

  • Baud rate 38400 bps
  • No flow control

Testing

This application can be tested as follows:

Two boards are needed to perform this test.

  • Collector Board: nRF6310 nRFgo Motherboard mounted with nRF51822 containing S120 SoftDevice.
  • Sensor Board: nRF6310 nRFgo Motherboard mounted with nRF51822 chip Board containing S110 SoftDevice and the Heart Rate Application provided with the nRF51 SDK. OR PCA10001 Evaluation board containing S110 SoftDevice and the Heart Rate Application for Eval Board provided with the nRF51 SDK.

The application running on the Sensor Board is intended to serve as a peer (i.e. Heart Rate Sensor role) to this Heart Rate Collector application.

Test procedure:

  1. Compile and program the heart rate collector application onto an nRF51822 on the Collector Board.
    Note
    Ensure the S120 SoftDevice is used for this application.
  2. On the Collector board, observe LED 0 is lit. This indicates application is scanning for Heart Rate Sensors. The Display Unit will display 'Scanning'.
    Note
    If there are bonded devices in bonded device list, whitelist scanning is used for first 30 seconds. If no heart rate device is found during this time, non-whitelisted (general) scanning is used.
  3. Compile and program the Heart Rate Sensor application on to the nRF51822 on the Sensor Board. This application can be either the Heart Rate Application when using nRFgo Motherboard or the Heart Rate Application for Eval Board when using the PCA10001 as the sensor board.
    Note
    Ensure the S110 SoftDevice is used for this application.
  4. Observe that the Heart Rate Sensor is advertising.
    Note
    If using the PCA10001 evaluation board, refer Heart Rate Application for Eval Board to learn about how to make the sensor application start advertising.
  5. Once connection is established, LED 1 is lit on the Collector Board. The Display Unit will display 'Connected'.
    Note
    The sensor application may just have advertised for a very short while before the Collector application had connected. So it is possible that the tester has missed to note that the Sensor application was advertising.
  6. After a few seconds, observe Heart Rate measurements displayed on the Display Unit. The Display Unit will display Heart Rate on the upper line and the Battery Level of the peer value on the lower line. If a Terminal emulator running on the PC is connected to the nRFgo Motherboard's RS232 port, then the received heart rate measurements and Battery Measurements can be seen on the emulator as well.