Not a day without sports: reprogramming a Chinese heart rate monitor

“Listen, what kind of heart rate should you have while jogging?”
- Well, I don’t know - 150 hits.
- Yes? Why do I have 840?
- 840 per minute ?!
- And what, it was necessary to consider in a minute or what?
“What did you think?”
“Well, I just counted until I got lost ... So, okay, I went to recount.”
(film "Election Day")

Almost exactly about the Chinese heart rate monitor. As the saying goes, if you want to do something well, then do it yourself. And if the device does not work as it is required from, then maybe it will be possible to improve it?


Many people who are interested in sports monitor their heart rate during exercise. For this, heart rate monitors are used. It is not the task of this article to consider all their types, but one of the most reliable and proven ones is chest pulse sensors that receive electrical signals from the heart.

In connection with my greatly increased physical activity, the Kyto 2809 heart rate monitor was also acquired . The pulse is good, but there was a need for accurate measurement of RR intervals. The heart rate monitor supports two protocols: ANT + and BLE. According to the specifications, both of them, in addition to directly heart rate, transmit the duration of RR intervals.

What are RR intervals
RR – R .


RR , . . , (. « RR » « »). .

To record data from both channels, an Android application was written to fit your needs with a data log to text files. An analogue heart rate monitor was sent as a more or less adequate standard, sending a signal at a frequency of 5.3 kHz, connected directly to a PC via an arduino.

The first comparison was slightly saddened.


The “device” for one real heart beat showed 4-5 nonexistent (on the blue graph you can see an abundance of points). The pulse, even taking into account the possible averaging, does not shine with accuracy. About measuring RR intervals of speech does not go at all.

Communication with the manufacturer did not bring results. In addition to several videos, attempts to convince me that everything is fine, and phrases: "KYTO2809 heart rate datas are accurate!", I did not get anything from them. Then his gaze fell on the box with screwdrivers. Opening the case, I discovered the nRF51422 chip.


Knowing that there is an SDK for these MKs, I decided to try to reflash it. The simplest program is needed there: from the electric signal amplifier of the heart (a black drop in the photo), the signal goes to the MK input, and then it’s a technical matter, we catch the pulses through interrupts, measure the time between them and output all this through BLE and ANT +. Everything is simple, but apparently something went wrong with the Chinese programmers.

These chips are programmed via SWD. Native firmware was protected from reading. Therefore, without hesitation, the command “format c:” “--eraseall” was executed. The board even displays the corresponding contacts. Input from the amplifier of electric signals of the heart P0.07. The pinout of the BLE module itself is (top to bottom):
  1. GND
  2. Vdd
  3. P0.30
  4. P0.00
  5. P0.01
  6. P0.02
  7. P0.03
  8. P0.04
  9. P0.05
  10. P0.06
  11. P0.07
  12. P0.08

The SDK contains many examples sufficient to write your own firmware. The chip is quite old and the SDK for it is also outdated, version 10. Using them, the BLE services were raised on the heart rate monitor: Device Information, Battery Service, Heart Rate. A HeartRate profile has been added for ANT +. We measure RR intervals with a timer, send data to the BLE and ANT + profiles. To save charge in the absence of external stimuli (within 5 seconds), the heart rate monitor is put into sleep mode. When a pulse appears (interruptions at the input), the MK wakes up. In the firmware from the manufacturer, Kyto2809 constantly transmitted advertising packets via BLE, i.e. when using only the ANT + channel, BLE continued to send packets and drain the battery. I limited the advertising time to 5 minutes, which should have a positive effect on profitability.
Tests showed that for the Calculated Heart Rate parameter, it is better to introduce filtering (discard deliberately inaccurate data, i.e., a pulse below 30 and above 240) and averaging with a moving average. The final comparison with the analog heart rate monitor below. Differences in measurements of RR intervals of 0-2 ms, which is quite acceptable.


Of useful functions, the ability to update OTA firmware (original name DFU OTA) has been added. Now, having sewn up the OTA-bootloader, you can easily update the firmware if you want to change something in the code. The firmware is done from the smartphone through the proprietary utility nRFConnect. Also, if I'm not mistaken, you can make OTA support in your Android application, there are libraries for this. Unfortunately, to fill the bootloader in memory, you need to connect via SWD, because OTA was not originally provided by the manufacturer.

Firmware order:

  1. we sew SoftDevice310 , it is BLE and ANT + a stack from Nordic;
  2. we sew Kyto_DFU_bootloader.hex (the case can be assembled);
  3. through nRFConnect fill the finished package kyto_hr_dfu.zip

The last two files are here . There is also firmware without OTA (KytoHR.hex).

All Articles