nRF5 SDK v17.1.0
ANT+ Stride Based Speed and Distance
This example requires the following SoftDevice: S212

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

The Stride Based Speed and Distance example applications show the usage of the Stride Based Speed and Distance Monitor profile.

Receiver

The Receiver application connects to the nearest stride based speed and distance monitor (SDM) 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 the project file of the example in the following folder: <InstallFolder>\examples\ant\ant_plus\ant_sdm\sdm_rx

User interface

Page data requests can be sent by pressing the following buttons:

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).

Transmitter

The Transmitter application is a Stride Based Speed and Distance (SDM) transmitter simulator. It transmits ANT_SDM_PAGE_1 and ANT_SDM_PAGE_2 as supplementary data pages. Pages ANT_SDM_PAGE_80 and ANT_SDM_PAGE_81 are transmitted at a slower rate.

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

This example automatically answers to the page data requests.

The profile information is generated by the ANT SDM simulator.

There are two ways to modify the profile information (speed and distance):

You can select how the profile information is modified by using the "MODIFICATION_TYPE" field 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_sdm\sdm_tx

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 SDM measurement example in different ways:

Testing the SDM Transmitter with the SDM 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 Stride Based Speed and Distance Monitor (see Compile time configuration options).
  3. Compile and program the SDM Receiver. Observe that the receiver board indicates states following CHANNEL_TYPE_SLAVE/CHANNEL_TYPE_SLAVE_RX_ONLY.
  4. Compile and program the SDM 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 SDM channel 0 init
ANT SDM channel 0 open
SDM Page number   1
Update latency    0.000 s
Time              0.000 s
Distance          0.0m
Strides           0
Speed             0.00 m/s

SDM Page number   1
Update latency    0.250 s
Time              0.250 s
Distance          0.0m
Strides           0
Speed             0.76 m/s

SDM Page number   2
Status:           state:    Active
                  health:   OK
                  battery:  Good
                  location: Ankle
Cadence           62.0 strides/min
Speed             0.77 m/s

SDM Page number   2
Status:           state:    Active
                  health:   OK
                  battery:  Good
                  location: Ankle
Cadence           63.0 strides/min
Speed             0.79 m/s

SDM Page number   1
Update latency    0.031 s
Time              0.995 s
Distance          0.8m
Strides           1
Speed             0.80 m/s

SDM Page number   1
Update latency    0.281 s
Time              1.240 s
Distance          0.8m
Strides           1
Speed             0.81 m/s

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

ANT SDM channel 0 init
ANT SDM channel 0 open
SDM Page number   1
Update latency    0.500 s
Time              3.225 s
Distance          2.3m
Strides           3
Speed             0.91 m/s

Page was updated

SDM Page number   2
Status:           state:    Active
                  health:   OK
                  battery:  Good
                  location: Ankle
Cadence           74.0 strides/min
Speed             0.93 m/s

Page was updated

SDM Page number   2
Status:           state:    Active
                  health:   OK
                  battery:  Good
                  location: Ankle
Cadence           75.0 strides/min
Speed             0.94 m/s

Page was updated

SDM Page number   1
Update latency    0.406 s
Time              3.970 s
Distance          3.0m
Strides           4
Speed             0.95 m/s

Page was updated

SDM Page number   1
Update latency    0.656 s
Time              4.220 s
Distance          3.0m
Strides           4
Speed             0.96 m/s

Page was updated

SDM Page number   2
Status:           state:    Active
                  health:   OK
                  battery:  Good
                  location: Ankle
Cadence           78.0 strides/min
Speed             0.98 m/s

Page was updated

If you are testing the SDM Transmitter button version, observe that the cadence value increases when pressing Button 1 and decreases when pressing Button 2.

If you are testing the SDM Transmitter auto version, observe that the ccadence value periodically rises and falls.

Testing the SDM Transmitter using AntWare II

  1. Compile and program the SDM Transmitter. 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>\sdk\nrf5\examples\ant\ant_plus\ant_sdm\sdm_tx\sdm_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, 124, 0".
    3. On the Basic tab, set the channel period to 8134 cycles (4,029 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:
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-50-01-00-FF-D1
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-4F-00-FD-FF-D1
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-01-15-37-3F-00-FA-54-06
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-01-47-37-3F-00-F6-54-0E
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-4C-00-F3-FF-D1
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-4B-00-F0-FF-D1
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-01-14-38-3F-C0-ED-55-0D
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-01-46-38-3F-C0-EA-55-15
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-48-00-E6-FF-D1
    Received BROADCAST_DATA_0x4E
      :: 4e, 00-02-FF-FF-47-00-E3-FF-D1
    
    Each message can be decoded according to the ANT message protocol and the Stride Based Speed and Distance ANT+ device profile.

Testing the SDM 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 SDM Transmitter and the ANT+ Sensor Simulator to test the SDM 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