Important: Before you run this example, make sure to install the SoftDevice .
The Heard Rate Example applications show the usage of the Heart Rate Monitor Profile .
Receiver
The Receiver application connects to the nearest Heart Rate Monitor (HRM) in range and prints out incoming page data. The actual channel state is indicated by the ANT channel state indicator .
The name of the example is
ant_hrm_rx_s210_pca10028
. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder:
<InstallFolder>\examples\ant\ant_hrm\hrm_rx
Transmitter
The Transmitter application simulates a Heart Rate Monitor transmitter. It transmits the heart rate information in the main data page (page 4). Device-specific information is transmitted at a slower rate in the background data pages (pages 1-3). The application prints out outgoing page data. The actual channel state is indicated by the ANT channel state indicator .
The profile information is generated by the ANT pulse simulator .
There are two varieties of the transmitter example:
-
Automatic
, which means that the heart rate value changes automatically (thus rises and falls by itself).
The name of the example is ant_hrm_tx_auto_s210_pca10028 . If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder:<InstallFolder>\examples\ant\ant_hrm\hrm_tx\auto
-
Button controlled
, which means that the heart rate value can be modified by pressing the buttons. Pressing Button 1 increases the heart rate value by
HEART_RATE_VALUE_INCREMENT
. Pressing Button 2 decreases the heart rate value by
HEART_RATE_VALUE_DECREMENT
.
The name of the example is ant_hrm_tx_button_s210_pca10028 . If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder:<InstallFolder>\examples\ant\ant_hrm\hrm_tx\button
Testing
You can test the Heart Rate Example in different ways:
- Testing the HRM Transmitter with the HRM Receiver
- Testing the HRM transmitter using AntWare II
- Testing the HRM example applications with the ANT+ Simulator tools
Testing the HRM Transmitter with the HRM Receiver
-
Start a COM listener like PUTTY and connect to the used COM port with the following UART settings:
- Baud rate: 38.400
- 8 data bits
- 1 stop bit
- No parity
- HW flow control: RTS/CTS
- Ensure that the UART tracing settings are configured in the Heart Rate Monitor Profile (see Compile time configuration options ).
- Compile and program the HRM Receiver. Observe that the receiver board indicates states following CHANNEL_TYPE_SLAVE_RX_ONLY .
- Compile and program the HRM Transmitter. Observe that the transmitter board indicates states following CHANNEL_TYPE_MASTER .
- After a while, observe that the receiver board is connected.
The following information should be output on the console for the transmitter:
ANT HRM channel 0 init ANT HRM channel 0 open HRM TX Page number: 0 Heart beat count: 0 Computed heart rate: 0 Heart beat event time: 0.000s HRM TX Page number: 0 Heart beat count: 1 Computed heart rate: 150 Heart beat event time: 0.399s HRM TX Page number: 0 Heart beat count: 1 Computed heart rate: 150 Heart beat event time: 0.399s
The following information should be output on the console for the receiver:
ANT HRM channel 0 init ANT HRM channel 0 open HRM RX Page Number: 0 Heart beat count: 159 Computed heart rate: 154 Heart beat event time: 14.083s HRM RX Page Number: 0 Heart beat count: 160 Computed heart rate: 156 Heart beat event time: 14.467s HRM RX Page Number: 0 Heart beat count: 160 Computed heart rate: 156 Heart beat event time: 14.467s HRM RX Page Number: 2 Heart beat count: 161 Computed heart rate: 160 Heart beat event time: 14.842s Manufacturer ID: 2 Serial No (upper 16-bits): 0xABCD HRM RX Page Number: 0 Heart beat count: 162 Computed heart rate: 162 Heart beat event time: 15.212s
If you are testing the HRM transmitter button version, observe that the computed heart rate value increases when pressing Button 1 and decreases when pressing Button 2.
If you are testing the HRM transmitter auto version, observe that the computed heart rate value periodically rises and falls.
Testing the HRM transmitter using AntWare II
- Compile and program the HRM Transmitter. Observe that the transmitter board indicates states following CHANNEL_TYPE_MASTER .
-
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_hrm\hrm_tx\hrm_rx_device_profile.xml. If you are using Keil packs, this file is located at<KeilFolder>\ARM\Pack\NordicSemiconductor\nRF_Examples\<version>\ant\ant_hrm\hrm_tx\hrm_rx_device_profile.xml. Alternatively, you can configure the device channel manually:- Set the channel assignment to slave.
- Set the channel ID to "0, 120, 1".
- On the Basic tab, set the channel period to 8070 cycles (4,06 Hz) and the radio frequency to 2457 MHz.
- Keep the default for all other settings.
-
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-00-FF-FF-FF-09-60-F1-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-A2-61-F2-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-3B-63-F3-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-D4-64-F4-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-6D-66-F5-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-06-68-F6-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-9F-69-F7-96 Received BROADCAST_DATA_0x4E :: 4e, 00-80-FF-FF-FF-38-6B-F8-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-D1-6C-F9-96 Received BROADCAST_DATA_0x4E :: 4e, 00-00-FF-FF-FF-6A-6E-FA-96
Each message can be decoded according to the ANT message protocol and the Heart Rate Monitor ANT+ Device Profile.
Testing the HRM example applications 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 HRM Transmitter and the ANT+ Sensor Simulator to test the HRM Receiver. See the documentation of the ANT+ Simulator tools at http://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 http://thisisant.com to become an ANT+ Adopter and access the key.