The Bluetooth Special Interest Group has a standardized GATT (Generitt ATTribute Profile) for cycling speed and cadence sensors called the Cycling Speed and Cadence (CSC) profile. (You can see a list of all the GATT services here.)
This defines the commands and data that can be exchanged between bike sensor devices and the client device such as a phone, tablet, or BLE capable microcontroller (like we'll use in our project).
If you want to see how the Bluetooth SIG defines a GATT, such as the Cycling Speed and Cadence Profile, you can look at the official XML file here.
Even better, run that URL through a code beautifier, such as codebeautify.org for a more human-readable version.
The CSC service defines characteristics that can be served from the sensors to a connected device.
The most important for most needs is the CSC Measurement characteristic which serves up the following information:
- Wheel revolutions - used to calculate speed of a known wheel diameter
- Last wheel event time
- Crank revolutions -- used to indicate pedaling cadence
- Last crank event time
CSC sensors will also include a characteristic for the intended location of the cadence sensor, typically the right crank. This is built into the sensor firmware, not something that the device is determining on the fly!
SC Control Point
The speed/cadence (SC) control point characteristic is used to allow the client device to write control points to the CSC in order to initiate sensor calibration.
We can use the nRF Connect app from Nordic on iOS and Android to connect to a CSC sensor and look at the service, characteristics, and data.
Here we see data advertised including the device name, available services, connection parameters, and more.
In this image, we can see the CSC device (WAHOO BLUESC) has been connected, and the Cycling Speed and Cadence characteristic is reporting its data.
By requesting a read of the CSD Feature, we can see that both Wheel Revolution Data and Crank Revolution Data are supported.
If we request a read of the Sensor Location characteristic, we receive it as shown here, indicating "Right Crank":