nRF5 SDK v11.0.0
Bicycle Speed and Cadence
This example requires the following SoftDevice: S212

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

The combined Bicycle Speed and Cadence (BSC) example applications show the usage of the Bicycle Speed and Cadence profile.

Receiver

There are three BSC Receiver applications: Speed Receiver, Cadence Receiver, and Combined Speed and Cadence Receiver.

Each Receiver application connects to the nearest bicycle speed and/or cadence sensor in range and prints out incoming page data. The actual channel state is indicated by the ANT channel state indicator.

You can find the source code and project file of the example in the following folder: <InstallFolder>\examples\ant\ant_plus\ant_bsc\bsc_rx

Transmitter

There are three BSC Transmitter applications: Speed Transmitter, Cadence Transmitter, and Combined Speed and Cadence Transmitter.

Each Transmitter application simulates a bicycle speed and/or cadence sensor. The Speed Transmitter and the Cadence Transmitter transmit the speed or cadence information in the main data page (page 5). Device-specific information is transmitted at a slower rate in the background data pages (pages 1-4). The Combined Speed and Cadence Transmitter transmits the speed and cadence information in the main data page (combined speed and cadence data page 0). It does not transmit background pages.

The application prints outgoing page data. The actual channel state is indicated by the ANT channel state indicator.

The profile information is generated by the ANT BSC simulator.

There are two varieties of each Transmitter example:

Testing

You can test the Bicycle Speed and Cadence examples in different ways:

Testing the BSC Transmitter with the BSC Receiver

Note that UART is not available when you use the Dynastream N5 Starter Kit.

  1. Start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:
    • Baud rate: 115.200
    • 8 data bits
    • 1 stop bit
    • No parity
    • HW flow control: RTS/CTS
  2. Ensure that the UART tracing settings are configured in the Bicycle Speed and Cadence (see Compile time configuration options).
  3. Compile and program one of the BSC Receivers. Observe that the receiver board indicates states following CHANNEL_TYPE_SLAVE/CHANNEL_TYPE_SLAVE_RX_ONLY.
  4. Compile and program the corresponding BSC Transmitter. Observe that the transmitter board indicates states following CHANNEL_TYPE_MASTER.
  5. After a while, observe that the receiver board is connected.

The following information should be output on the console for the Transmitter:

ANT BSC channel 0 init
ANT BSC channel 0 open

The following information should be output on the console for the Receiver:

ANT BSC channel 0 init
ANT BSC channel 0 open

If you are testing the BSC Transmitter button version, observe that the computed values increase when pressing Button 1 and decrease when pressing Button 2.

If you are testing the BSC Transmitter auto version, observe that the computed values periodically rise and fall.

Testing the BSC Transmitter using AntWare II

  1. Compile and program one of the BSC Transmitters. Observe that the transmitter board indicates states following CHANNEL_TYPE_MASTER.
  2. Run AntWare II. Select your ANT PC dongle (for example, ANTUSB-m) from the available devices. Configure the device channel by loading the device profile configuration from the following files, where <Type> is the type of Receiver device (speed, cadence, or combined) that you want to simulate: <InstallFolder>\examples\ant\ant_plus\ant_bsc\bsc_tx\<Type>\bsc_<Type>_rx_device_profile.xml. Alternatively, you can configure the device channel manually:
    1. Set the channel assignment to slave.
    2. Set the channel ID to "0, 123, 0" for a speed receiver, "0, 122, 0" for a cadence receiver, or "0, 121, 0" for a combined receiver.
    3. On the Basic tab, set the radio frequency to 2457 MHz and the channel period to 8118 cycles (4,036 Hz) for a speed receiver, 8102 cycles (4,044 Hz) for a cadence receiver, or 8086 cycles (4,052 Hz) for a combined receiver.
    4. Keep the default for all other settings.
  3. Click the Auto-Open button. Observe that messages describing the received payload appear for each ANT message. These messages should look similar to the following fragment (the example shows data for a speed sensor):
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-84-FF-C8-22-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-84-FF-C8-22-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-84-FF-C8-22-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-84-FF-C8-22-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-05-01-FF-FF-43-5C-6A-09
    
    Each message can be decoded according to the ANT message protocol and the Bicycle Speed/Cadence Display ANT+ device profile.

Testing the BSC examples with the ANT+ Simulator tools

To use the ANT+ Simulator tools, you must set the ANT+ Network Key to a proper value.

You can then use the ANT+ Display Simulator to test the BSC Transmitter and the ANT+ Sensor Simulator to test the BSC Receiver. See the documentation of the ANT+ Simulator tools at thisisant.com for information about how to use these tools.

Note
The ANT+ Network Key and ANT+ Simulator tools are available for ANT+ Adopters. Go to thisisant.com to become an ANT+ Adopter and access the key.

Documentation feedback | Developer Zone | Updated