nRF5 SDK v17.1.0
ANT+ Bicycle Power
This example requires the following SoftDevice: S212

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

The Bicycle Power example applications show the usage of the Bicycle Power Monitor profile.

Receiver

The Receiver application connects to the nearest Bicycle Power Sensor in range. It starts printing out page data on UART when data is received from that device. The actual channel state is indicated by the ANT channel state indicator.

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

The Bicycle Power Receiver implementation covers all features that are required for the Receiver to be fully compliant with the ANT+ Bike Power profile, as defined by the ANT+ Bicycle Power profile specification. For details, see the Bicycle Power Monitor.

User interface

The simple user interface consists of Button 1, which allows the user to start a manual zero-offset calibration procedure. The actual channel state is indicated by the ANT channel state indicator.

If a time-out occurs during search (30 seconds by default), the ANT channel is closed and the device is put into sleep mode. To wake it up, press Button 4. You can also put the device in sleep mode by pressing Button 4 while it is searching (see BSP ANT Button Module).

Sensor

The Bicycle Power sensor implementation covers all features that are required for the Sensor to be compliant with the ANT+ Bike Power profile, as defined by the ANT+ Bicycle Power profile specification. For details, see the Bicycle Power Monitor. The example 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 BPWR simulator.

Several variants of the Sensor example are available:

You can select your setup by setting the "SENSOR_TYPE" and "MODIFICATION_TYPE" fields in the sdk_config.h file.

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

User interface

The simple user interface consists of Button 3, which allows the user to respond to the calibration procedure.

Testing

Note: You can use a custom channel or encryption when running any of the ANT examples. When adding a new channel or encryption, remember to update SoftDevice ANT event handler configuration.

You can test the Bicycle Power example in different ways:

Testing the Bicycle Power Sensor with the Bicycle Receiver

Note that UART is not available when you use the D52 Starter Kit from Garmin Canada.

  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: None
  2. Ensure that the UART tracing settings are configured in the Bicycle Power Monitor (see Compile time configuration options).
  3. Compile and program the Bicycle Power Receiver. Observe that the receiver board indicates states following CHANNEL_TYPE_SLAVE/CHANNEL_TYPE_SLAVE_RX_ONLY.
  4. Compile and program the Bicycle Power Sensor. 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:

B-PWR tx page: 16
event count:            0
pedal power:            23 %
instantaneous cadence:  42 rpm
accumulated power:      4568 W
instantaneous power:    72 W

B-PWR tx page: 16
event count:            0
pedal power:            23 %
instantaneous cadence:  42 rpm
accumulated power:      4568 W
instantaneous power:    72 W

B-PWR tx page: 80
hw revision:      127
manufacturer id:  43690
model number:     21845

B-PWR tx page: 81
sw revision:      170
serial number:    2857740885

B-PWR tx page: 16
event count:            0
pedal power:            23 %
instantaneous cadence:  42 rpm
accumulated power:      4568 W
instantaneous power:    72 W

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

B-PWR rx page: 16
event count:            114
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      32262 W
instantaneous power:    283 W

B-PWR rx page: 16
event count:            115
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      32545 W
instantaneous power:    283 W

B-PWR rx page: 81
sw revision:      1
serial number:    1234567890

B-PWR rx page: 16
event count:            116
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      32828 W
instantaneous power:    283 W

B-PWR rx page: 16
event count:            117
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      33111 W
instantaneous power:    283 W

If you are testing the Bicycle Power Sensor, observe that the computed instantaneous power value increases when pressing Button 1 and decreases when pressing Button 2. Pressing Button 3 answers to a calibration request.

If you are testing the Bicycle Power Receiver, observe that pressing Button 1 initializes a calibration transaction. The calibration log on the Receiver console should look like this:

B-PWR tx page: 1
calibration id:    170

Start calibration process
B-PWR rx page: 16
event count:            170
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      3310 W
instantaneous power:    283 W


B-PWR rx page: 16
event count:            170
pedal power:            50 %
instantaneous cadence:  90 rpm
accumulated power:      3310 W
instantaneous power:    283 W


B-PWR rx page: 1
calibration id:    172
auto zero status:  255
Calibration data: 478

Testing the Bicycle Power Sensor using AntWare II

  1. Compile and program the Bicycle Power Sensor. 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 file: <InstallFolder>\examples\ant\ant_plus\ant_bpwr\bpwr_rx\bpwr_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, 11, 0".
    3. On the Basic tab, set the channel period to 8182 cycles (4,005 Hz) and the radio frequency to 2457 MHz.
    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:
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-10-00-17-2A-D8-11-00-00
    
    Each message can be decoded according to the ANT message protocol and the Bicycle Power ANT+ device profile.

Testing the Bicycle Power 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 Bicycle Power Sensor and the ANT+ Sensor Simulator to test the Bicycle Power 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 | Subscribe | Updated