Simply speaking if the heart is compared to an engine, when in idle mode it does not maintain steady rpm; that means, intervals between heart beats at rest are not exactly the same, they have some pseudo-random variability. When the heart works with increased rate, these intervals becomes less stochastic and better maintain a steady rhythm. The meaning and nature of heart rate variability is currently a subject of multiple scientific researches. Here is an excerpt from a popular article on HRV I found at the blog of Bryn Farnthworth:

One of the first things to know when understanding heart rate is that the most informative metric relies not just on the heart rate, but how much the heart rate varies. What’s often at first glance counter-intuitive about this metric is that a higher heart rate variability (HRV) is associated with good health – the more your heart jumps around (to an extent, of course), the readier you are for action. On the other hand, a low HRV is associated with ill health – it is a significant predictor of mortality from several diseases.

One of the most common visualization methods of HRV is a graph called a Poincaré plot. Named after the illustrious French mathematician, the graph plots the RR intervals (the distance between each heartbeat), with the RR interval just prior. This is explained further below.

The Poincaré plot therefore shows how well each RR interval predicts the next – a greater spread of values would mean an increased HRV, while the closer they bunch together, the less HRV there is. Two examples of Poincaré plots are shown below – the left shows a high heart rate variability, while the right shows a limited heart rate variability.

I strongly recommend to read the whole article from this blog, it is quite professional and at the same time delivers in a very clear and simple words.

For this project I am using two 'flavors' of the same heart rate sensors. The sensor itself is a small clip attached to the earlobe. Kyto Fitness offers a wireless gadget that includes this clip and a small BLE transmitter with battery. They also offer some Android app capable of receiving and presenting the data transmitted by this gadget. Here is how sensor and BLE part looks:

Bluetooth Mobile Heart Rate HRV Monitor with Ear Clip Sensor - KYTO2935

The data is transmitted in accordance with official BlueTooth Low energy Generic Attribute Profile (GATT) documents and standards; these standards describe in every detail how different sensors (this is called 'server' in BLE world) must communicate with host device (this is called 'client', quite confusing I think).

I am not going into formal description of BLE protocol here, but for practical purpose here is the specs I was using in this application:

In order to connect with KYTO heart rate wireless sensor the host device must use following 'addresses' (these 16-byte HEX numbers are called 'Service' and 'Characteristic'):

• 0000180D-0000-1000-8000-00805F9B34FB - service
• 00002A37-0000-1000-8000-00805F9B34FB - characteristic

- these are official specifications for Heart Rate sensors.

All these addresses are different only in first 8 bytes, everything else is always the same and is called 'Base Universally Unique Identifier' (Base UUID)

Besides wireless device from KYTO I also used a combination of the same sensor with it's own controller, simple Arduino board and popular HM10 BLE transmitter.

Service and characteristic of HM10 breakout are

• 0000FFE0-0000-1000-8000-00805F9B34FB (Service)
• 0000FFE1-0000-1000-8000-00805F9B34FB (Characteristic)

After connection with sensor is established, sensor start transmitting data, data format is described in available documents.

The example data package looks like:

(hex) 0x10 0x4C 0x15 0x03

Here first 2 bytes 10 are a set of flags;

second word 4C is dec 76 and this is a pulse rate (bpm);

third and second words must be read in reverse order (little...