Languages

Menu
Sites
Language
Samsung Gear S3 - can the sample rate of SENSOR_HRM_LED_GREEN be increased above 20 Hz?

I am trying to write an app to record raw data from the green HRM (heart rate monitor) sensor on the Samsung Gear S3, using the following code extract:

unsigned int sensor_interval_ms = 25;

sensor_type_e type = SENSOR_HRM_LED_GREEN;
sensor_h sensor;
sensor_listener_h listener;

sensor_get_default_sensor(type, &sensor);
sensor_create_listener(sensor, &listener);
sensor_listener_set_option(listener, SENSOR_OPTION_ALWAYS_ON);

// set sensor interval to 10 ms
sensor_listener_set_interval(listener, 10);

sensor_listener_set_event_cb(listener, sensor_interval_ms, &on_sensor_event_cb, NULL);
sensor_listener_start(listener);

on_sensor_event_cb() is a function to write the sensor values to a text file, using:

sensor_event_s event;
sensor_listener_read_data(listener, &event);
int sensor_value = event.values[0];

The app writes a value to the file every 25 ms (or whatever I change sensor_interval_ms to). However, sensor_value only changes every 50 ms.

Does anyone know if there is a way to sample more often than once every 50 ms, or is 20 Hz (1/50 ms) the maximum sample rate of this sensor?

Responses

10 Replies
Armaan-Ul- Islam

I've checked the minInterval for HRM Raw Sensor as per API documentations.

Get Sensor Info API function

It show's 1 ms. So, One can read data at least interval of 1ms.

 

 

But, When It came to Coding I was able to set the interval at 10ms minimun on the setChangeListener() function parameter.

# The frequency seems quite large than the 20Hz you stated.

The true sample interval is much lesser than 50ms on my Gear S2, it's less than or equal 10ms.

 

 

Code Snippet :

var HRMrawsensor = tizen.sensorservice.getDefaultSensor("HRM_RAW");

function onGetSuccessCB(sensorData)
{
    var date = new Date(Date.now());
	var hours = date.getHours();
	var minutes = "0" + date.getMinutes();
	var seconds = "0" + date.getSeconds();   	
	var ms = "0" +date.getMilliseconds();
	var Time = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + ':' + ms.substr(-3);
	
	console.log("data:" + sensorData.lightIntensity + " timeStamp:"+ Time);
}

function onerrorCB(error)
{
   console.log("error occurred:" + error);
}

function onsuccessCB()
{
   console.log("HRMRaw sensor start");	   
   HRMrawsensor.getHRMRawSensorData(onGetSuccessCB, onerrorCB);
   HRMrawsensor.setChangeListener(onGetSuccessCB,10);
}

function onsuccessCBInfo(hardwareInfo)
{
   console.log("name: " + hardwareInfo.name);
   console.log("type: " + hardwareInfo.type);
   console.log("vendor: " + hardwareInfo.vendor);
   console.log("minValue: " + hardwareInfo.minValue);
   console.log("maxValue: " + hardwareInfo.maxValue);
   console.log("resolution: " + hardwareInfo.resolution);
   console.log("minInterval: " + hardwareInfo.minInterval);
}

HRMrawsensor.getSensorHardwareInfo(onsuccessCBX);	
HRMrawsensor.start(onsuccessCB);

 

Thank you so much for your detailed reply and code extract.

I have tried to reproduce your code, and I get the following:

Ignoring for now the fact that mine seems to fail after the first iteration, it looks like your Gear S2 and my Gear S3 Classic have different sensors, and I'm wondering if the performance of the sensor on the Gear S3 Classic has been limited to prolong battery life.

Which model of the Gear S2 are you using? If the Gear S2 sensor does indeed have a higher sample, that may be the device I need, and I want to make sure I get the correct model.

Armaan-Ul- Islam

Here you go,

 

Samsung Gear S2

Model: SM-R720

Tizen Version: 2.3.2.2     //(any 2.3.2.x should do)

Hyung Sun Lee

Did you find out what's causing the TypeError and exception?

I've been trying to access RAW PPG data on my Gear Sports using callback function, 

but it generates same exceptions as yours.

Armaan-Ul- Islam

The same Error is thrown whenever I tried to run HRM changeListener code on devices running on Tizen 3.0.

But for the case of Tizen 2.3.2 it worked fine.

You may report a bug on Tizen bug Tracker. Here's a guideline on how to report bugs. Please share the 'Reported bug' link here on this post to help the developers keep track.

Jan Gründling

Did you do a bug report? If yes, would you mind sharing the link to it?

Or did you find out, what this is caused by? If so, please share your solution with us, I got the same error and I'm wondering what this is about.

thanks

Hyung Sun Lee

No, I haven't submitted a bug report.

I found a Gear S2 that I can work on and used it for my experiment.

Sorry. :-)

Armaan-Ul- Islam

I've checked the Tizen bug Tracker seems there's no bug reported on this issue yet. Please go ahead and report If you want to and share the 'Reported bug' link.

Hart

Hi, I am interested in the possibility of extracting a Respiration/Breathing signal from the raw ppg signal. I assume you have plenty of these (csv?). Is it possible for you to let me have some, preferably recorded while the wearer was moving, so I could analyze them to see if it might be possible, before I buy a Tizen/Samsung watch

To clarify my previous question, please can you tell me the model of your Gear S2 - is it the Gear S2, Gear S2 Classic, or another version? Even better, if you could let me know the model number (e.g. SM-R770, SM-R732, SM-720), that would be really useful.

Many thanks again for your help.