nRF5 SDK v15.3.0
Experimental: BLE Heart Rate Collector Example with NFC Pairing
This example requires the following SoftDevice: S132

Important: Before you run this example, make sure to program the SoftDevice.

This example is based on the BLE Central BLE Heart Rate Collector Example example. It implements the Heart Rate Collector role and enables pairing with a BLE Peripheral device using the NFC interface. To do the pairing, it uses the Adafruit NFC Shield library to read the NFC tag with a Connection Handover NDEF message and the NFC Connection Handover Message Parser to parse this message.

After the BLE connection is established, the application performs the same role as the original BLE Heart Rate Collector Example example. See the documentation for that example for details. The following description presents only the differences from the original example.

When the application starts, it initializes the Adafruit PN532 NFC Shield, which is used for pairing. The application does not start scanning immediately, but only when the NFC tag with Connection Handover NDEF message is found.

After reading the tag, the device starts scanning for the peripheral with the same address as the one encoded in the NDEF message. After connecting, the example application behaves in the same way as the original HRS Collector example with one difference. It enables HRM notifications only if the security level 4 has been achieved for the connection after a proper pairing procedure.

This application is not power optimized!


Since the SoftDevice does not include the functionality required to calculate Elliptic Curve Cryptography (ECC) public keys and shared secrets, an external library is required for this purpose. Bindings and build files are provided for a well-known open source library, micro-ecc, although the library itself is not provided.

To use micro-ecc with this project, follow the steps described in Installing micro-ecc.

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\ble_central\experimental\ble_app_hrs_nfc_c


Test the Heart Rate Collector Application with BLE pairing using NFC with a BLE peripheral that supports NFC pairing, for instance with the complementary Experimental: Heart Rate Application with BLE Pairing Using NFC Pairing Library example. Perform the following steps:

  1. Set the proper Peer Manager security parameters in the SDK configuration header file.
  2. Compile and program the application.
  3. Press Button 4 to start the NFC tag reader.
  4. Touch the Adafruit PN532 NFC Shield antenna with the BLE peripheral NFC antenna.
  5. The device will automatically connect to the Peripheral device.
  6. Press Button 3 to disconnect from the Peripheral device.
  7. Press Button 3 when disconnected to erase Peer Manager bondings.
  8. Press Button 4 when connected - if NFC tag with Connection Handover NDEF message has been found, the current connection will be terminated.

Documentation feedback | Developer Zone | Subscribe | Updated