Inconsistent Heart Rate Monitoring Values from Human Activity Monitor

Original Created Apr 12, 2016 | Regeneration Apr 22, 2026

I'm trying to retrieve heart rate data using the Human Activity Monitor's HRM functionality with the following code:

var HRUtils = {
    abc: function() {
        var count = 0;
        
        function onsuccessCB(heartInfo) {
            console.log("Rate: " + heartInfo.heartRate);
            
            count++;
            if(count >= 100) {
                tizen.humanactivitymonitor.stop("HRM");
            }
        }

        function onerrorCB(error) {
            alert("Error!");
        }

        function onchangedCB(heartData) {
            tizen.humanactivitymonitor.getHumanActivityData("HRM", onsuccessCB, onerrorCB);
        }

        tizen.humanactivitymonitor.start("HRM", onchangedCB);
    }
};

The code works intermittently - sometimes it returns correct values (75, 73, 74... 80) but other times it returns all zeros (0, 0, 0, 0...). I can't determine why this inconsistency occurs.

Problem Understanding

The issue appears to be related to the HRM sensor's initialization and stabilization period. The inconsistent readings (correct values vs. zeros) suggest:

  1. The sensor needs time to stabilize and get accurate readings
  2. The device (like Gear S2) needs to be properly fitted on the wrist
  3. There might be initialization timing issues in the code

Solution Methods

  1. Allow Sensor Stabilization Time:

    • Wait 5-10 seconds after starting the HRM before expecting accurate readings
    • Implement a delay mechanism or initial warm-up period
  2. Check Device Fit:

    • Ensure the wearable device is properly fitted on the wrist
    • Make sure the sensor area has good contact with skin
  3. Review Sample Code:

    • Examine the official HeartRateMonitor sample app in Tizen IDE
    • Consider using the TizenBeat open-source project as reference

Code Examples

Here's an improved version of the code with stabilization handling:

var HRUtils = {
    monitorHeartRate: function() {
        var count = 0;
        var isStabilized = false;
        var stabilizationTimer = null;

        function onsuccessCB(heartInfo) {
            if (isStabilized) {
                console.log("Rate: " + heartInfo.heartRate);
                count++;
                
                if(count >= 100) {
                    tizen.humanactivitymonitor.stop("HRM");
                    clearTimeout(stabilizationTimer);
                }
            }
        }

        function onerrorCB(error) {
            console.error("HRM Error: " + error.message);
        }

        function onchangedCB(heartData) {
            tizen.humanactivitymonitor.getHumanActivityData("HRM", onsuccessCB, onerrorCB);
        }

        tizen.humanactivitymonitor.start("HRM", onchangedCB);
        
        // Allow 5 seconds for sensor stabilization
        stabilizationTimer = setTimeout(function() {
            isStabilized = true;
            console.log("Sensor stabilized - beginning data collection");
        }, 5000);
    }
};

Additional Tips

  1. For reference implementations:

    • Access the HeartRateMonitor sample in Tizen IDE: File → New → Tizen Web Project → Online Sample → HeartRateMonitor
    • Check the TizenBeat project: https://github.com/alycecil/TizenBeat
  2. Remember that HRM sensors:

    • Work best when the user remains still during measurement
    • May require periodic recalibration
    • Performance can vary based on skin type and environmental conditions

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.