Bluetooth: Peripheral Running Speed and Cadence Service (RSCS)

The peripheral RSCS sample demonstrates how to use the Running Speed and Cadence Service (RSCS).

Overview

This sample demonstrates the use of Running Speed and Cadence Service. It simulates a sensor and sends measurements to the connected device, such as a phone or a tablet.

The mobile application on the device can configure sensor parameters using the SC Control Point characteristic.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuapp_ns

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52833 DK

PCA10100

nrf52833dk_nrf52833

nrf52833dk_nrf52833

The sample also requires a phone or tablet running a compatible application, for example nRF Connect for Mobile or nRF Toolbox.

User interface

LED 1:

Blinks every two seconds with the duty cycle set to 50% when the main loop is running and the device is advertising.

LED 2:

On when connected.

Building and running

This sample can be found under samples/bluetooth/peripheral_rscs in the nRF Connect SDK folder structure.

See Building and programming an application for information about how to build and program the application.

Testing

This testing procedure assumes that you are using nRF Connect for Mobile. After programming the sample to your development kit, test it by performing the following steps:

  1. Power on your development kit.

  2. Connect to the device through nRF Connect for Mobile (the device is advertising as “Nordic_RSCS”).

  3. Observe that the services of the connected device are shown.

  4. In Running Speed and Cadence Service, tap the Notify button for the “RSC Measurement” characteristic.

  5. Observe that notifications with the measurement values are received.

  6. In RSC Feature, tap the Read button to get the supported features.

  7. In Sensor Location, tap the Read button to read the location of the sensor.

  8. In SC Control Point, tap the Indicate button to control the sensor.

  9. The following Op Codes (with data if required) can be written into SC Control Point:

    • 01 xx xx xx xx to set the Total Distance Value to the entered value in meters. (if the server supports the Total Distance Measurement feature).

    • 02 to start the sensor calibration process (if the server supports the Sensor Calibration feature).

    • 03 xx to update the sensor location (if the server supports the Multiple Sensor Locations feature).

    • 04 to get a list of supported localizations (if the server supports the Multiple Sensor Locations feature).

  10. The answer consists of the following fields:

    • 10 Response Code.

    • xx Required Op Code.

    • xx Status: 01 Success, 02 Op Code not supported, 03 Invalid Operand, 04 Operation Failed.

    • data Optional, response data.

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries:

  • include/zephyr/types.h

  • lib/libc/minimal/include/errno.h

  • include/sys/printk.h

  • include/random/rand32.h

  • Bluetooth:

    • include/bluetooth/bluetooth.h

    • include/bluetooth/conn.h

    • include/bluetooth/uuid.h

    • include/bluetooth/gatt.h