Hi there,
I would like to capture the ECG signals and then I want to convert them into heart rate which is in bpm and I want signal to be sent through the BLE to the smartphone. The smartphone will use BLE scanner to get the reading. I have modified the ble_app_peripheral example in the SDK folder so that I can be able to capture the data (see the attachment). I have realized that the problem is most probably due to the ADC function. Did I put at the wrong location and where should I put?
adc_init (GP_ADC_SE, GP_ADC_SIGN, GP_ADC_ATTN3X).....
....
Thank you very much.
Device:
Hi there,
Besides that, I do not know how to link the adc output to the custom profile and basically the output from the ADC is in ECG signal and I need to convert them into heart rate. Do I need to use the hrpc.c, hrpc_task.c ? Thanks
Hi herochua617,
没有祝福你任何实现values from the ECG and the ADC ? If yes then you can go to the next step and send the values through BLE. The heart rate profile files exist in order to send the hrp values using the SIG standard heart rate profile apart from that there is nothing else that tha profile will do for you, can can still send values from the sensor using your custom profile. Regarding the where you will have to place the reading ADC function you can do that right before sending the notification towards the stack. Regarding how to send the value, the sample variable that you have in the app_adcval1_timer_cb_handler() is the dummy value that it is send to the central every time the timer elapses, so you can replace that data with the value read from the ADC.
Thanks MT_dialog
Hi MT_dialog,
I would like to ask. If I want to run this profile from SPI, do I need to configure anything in the ble_peripheral_app? Since I can use smart snippets to straight away burn the coding inside the SPI and it will run automatically when I switch on the development kit when I run the development kit on coin cell battery supply? Am I right? Thanks
Hi there,
What i am getting from the custom profile is not the heart rate. Is actually the ECG signal value which is the value obtained from the ADC output. i know that I need to fix the interval of the QRS complex of the ECG signal in order to obtain the heart rate value. But do you have any example on how to configure that? Thanks
1.Enable ADC value notify
ADC_VAL_1_UUID_128(UUID 0x17, 0xB9, 0x67, 0x98, 0x4C, 0x66, 0x4C, 0x01, 0x96, 0x33, 0x31, 0xB1, 0x91, 0x59, 0x00, 0x15)
2. write 0x01 to CTRL_POINT
CTRL_POINT_UUID_128 (0x20, 0xEE, 0x8D, 0x0C, 0xE1, 0xF0, 0x4A, 0x0C, 0xB3, 0x25, 0xDC, 0x53, 0x6A, 0x68, 0x86, 0x2D)
ADC func location you put is not wrong.
Hi chey856,
Thank you very much!. I am able to see the value changing. Can I ask? What is the function of control point? Why I do need to turn on in order to obtain the value? Thanks
Hi herochua617,
The control point characteristic that chey856 kindly mentioned is a characteristic that when written it enables a kernel timer in the fw. When the kernel timer elapses it triggers the sending of a notification towards the stack and eventually at your phone and resets the timer. So as soon as you write to that characteristic the function user_custs1_ctrl_wr_ind_handler() is triggered and starts the timer, and when the timer elapses the app_adcval1_timer_cb_handler() gets triggered.
Thaks MT_dialog
that's correct! thank you very much Thaks
by the way can you tell the adc sample rate of DA14580
Hi chey856,
It is mentioned in the datasheet, "The Maximum sampling rate is 3.3 Msample/s".
Thanks MT_dialog
Hi there,
What if I wanna take the data and convert them into heart rate so that the adc value 1 will give the result as in heart rate. Will I able to do it using my existing code? Thanks
heart rate = ( adc_get_sample() * 1.2Volt * ADC_ATTN3X)/1023
if you did not set ADC_ATTN3X in adc_init(), set ADC_ATTN3X = 1 else set ADC_ATTN3X=3
1.2Volt is the reference voltage
10bit adc so it's resolution: 2^10 - 1 =1023
you should take a look at "projects\target_apps\peripheral_examples\adc\ batt_lvl" example
static uint16_t heart_rate, sample, sample2;
adc_init (GP_ADC_SE, 0, GP_ADC_ATTN3X);
adc_enable_channel (ADC_CHANNEL_P01);
sample = adc_get_sample ();
adc_init (GP_ADC_SE, GP_ADC_SIGN, GP_ADC_ATTN3X);
adc_enable_channel (ADC_CHANNEL_P01);
sample2 = adc_get_sample ();
heart_rate = (sample + sample2);
heart_rate = heart_rate/2;
heart_rate = (heart_rate*3.6)/1023;
req->conhdl = app_env->conhdl;
req->handle = CUST1_IDX_ADC_VAL_1_VAL;
req->length = DEF_CUST1_ADC_VAL_1_CHAR_LEN;
memcpy(req->value, &heart_rate, DEF_CUST1_ADC_VAL_1_CHAR_LEN);
ke_msg_send(req);
if (ke_state_get(TASK_APP) == APP_CONNECTED)
{
// Set it once again until Stop command is received in Control Characteristic
timer_used = app_easy_timer(100, app_adcval1_timer_cb_handler);
}
}
Here's my code. I got 0x01 from my ADC VAL 1 characteristics from the BLE Scanner app. Any advice?
Thanks
Sorry for late, It seems that your code is OK, can you tell me more details about your project?
My mailbox:cheyu856@gmail.com
I've already replied to your mailbaox. Thanks
Hi guys,
Can I use the HRPS profile to work with my heart rate device? Will that be easier since there will be algorithm right in the HRPS that will convert my data into readable heart rate and not in hexadecimal values?
Hi herochua617,
The hrps is just a SIG standard that it just formats the data of your sensor in a specific way in order to be read by other client devices, it has no algorithm implementation or anything extra, its just a standard way to express heart rate values in order for other devices to be able to interpret them.
Thanks MT_dialog
Hi MT_dialog,
谢谢。这解决了我的问题https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl.... Thanks. However, I am trying my own way of detecting the interval. I want to get the time between two peak thru thishttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl.... Thank you very much!