Heart Rate Value sent by BLE

6 posts / 0 new
Last post
jamesleo-konka
Offline
Last seen:4 years 1 month ago
Joined:2017-01-22 02:42
Heart Rate Value sent by BLE

Hi Dialog,
I try to send user data by hrp_sensor project.
My data is 16bit or 32bit.
I modified the code like this:
hrs_meas.bpm =(uint16_t)temp_int32; // user data

When the data = 2400~2566, the App displays as 596xx,627xx,.....

I don't know what the following code will do:
//-------------------------------
/* RR-Interval will be sent every time but with different settings */
hrs_meas.rr_num = 1 + rand() % 2;
hrs_meas.rr[0] = 1000 + rand() % 21;
if (hrs_meas.rr_num > 1) {
hrs_meas.rr[1] = 1000 + rand() % 21;
}
//------------------------------
Any code need to be modified?

BTW, how to define/ transfer user data ? ( UUID ? .. regist sevice ...)

Thanks

Keywords:
Device:
MT_dialog
Offline
Last seen:3 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi jamesleo-konka,

Hi jamesleo-konka,

The heart rate sensor implementation is just an example that uses dummy data, so the code that you ve pasted is just code in order to produce some random data within a specified range. Also the project doens't send just raw values from the sensor, the specification of the HRP sensor from the SIG packs additional data in the notification sent (flag fields, RR-interval values, Energy expended values etc), please have a look at the HEART RATE PROFILE specification of the SIG. In order to change the heart rate you can just modify what you have allready modified (the heart rate measurements can be either 8 or 16 bit value as defined from the spec). Regarding how to transfer user data, the hrs_notify_measurement() function will automatically check if the notifications are enabled, pack your data (to the specified format as defined by the HRP sensor) and will send it to the central.

Thanks MT_dialog

jamesleo-konka
Offline
Last seen:4 years 1 month ago
Joined:2017-01-22 02:42
Hi Dialog,

Hi Dialog,
By check the demo code of hrp_sensor, you can see the capacity of 16bit sensor data:
//------------------------------------------
/* Check if trigger pin is set to low (GND) to send 16-bit value */
if (!hw_gpio_get_pin_status(CFG_SEND_16_BIT_VALUE_TRIGGER_GPIO_PORT,
CFG_SEND_16_BIT_VALUE_TRIGGER_GPIO_PIN)) {
/* BPM will be (80+/-5) + 200 to send 16-bit values */
hrs_meas.bpm += 200;
}
//---------------------------------
我改变了演示的人力资源价值,想要发送一个16 bit value:
//---------------------------------
hrs_meas.bpm =(uint16_t)temp_int32; // user data
//---------------------------------
the value now is in range of 16bit, but APP displays as a wrong value. (i.e. 25xx display as 63xx )
Where is the limitation else? rr_num ? rr? I don't find the code to adjust method to send hr data.

The following is graped from HRP protocol:
//------------------------------------------------------
For example, if the Heart Rate Measurement Value format of UINT8 is used with a 23-octet ATT_MTU, the maximum number of RR-Interval Values that can be notified if Energy Expended is present is 8 and the maximum number of RR-Interval Values that can be notified if Energy Expended is not present is 9.
If the Collector receives a Heart Rate Measurement characteristic with bits of the Flags field value that are designated as Reserved for Future Use (RFU), it shall ignore those bits and continue to process the Heart Rate Measurement characteristic normally.
//------------------------------------------------------
Should I modify the rr_num/rr value? How to?

Thanks

MT_dialog
Offline
Last seen:3 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi jamesleo-konka,

Hi jamesleo-konka,

I am not sure i follow, at least on my side if i place a large static value in the hrs_meas.bpm like 2454 for example, i can see the value properly presented on a generic application along with the other info that the application sends on a notification. So you dont have to change the rr or the rr_num, those are just additional information that declare that one or more values of the beat interval are located in the notification (rr_num) and the actual values of the interval (rr). If you would like to change that values you are able to do by replacing the code that populates that variable with random values. Try to use a generic application and use a static value for the bpm value and check if you can get it on the other side.

Thanks MT_dialog

herochua617
Offline
Last seen:3 years 12 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

Can i know where you get the demo code for hrp_sensor? Thanks.

MT_dialog
Offline
Last seen:3 months 1 week ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

There is no hrp demo for the 58x family, the demo referenced on this thread concerns the 68x family, please have a look at your other posthttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl....

Thanks MT_dialog