Dialog Semiconductor customer support - Synchronization https://support.dialog-semiconductor.com/resource-keywords/synchronization en Synchronization problem for accelerometer and gyroscope when using Evothing framework https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/synchronization-problem-accelerometer

Experimental Setup: I use Huawei smartphone for Central and DA14583 IoT sensor as peripheral. The software running on the smartphone is an app using Evothing framework. I would like to read acceleration and angular velocity at the same time to do the motion capture.
Sensor's firmaware: IoT raw project.
Sample rate for accelerometer and gyroscope: 50Hz.
The code on the central device using Evothing is as follows:
//Received data
app.handleSensorAccelerometer = function (data) {
data["time"] = Date.now();
data["type"] = "Accelerometer";
app.data.Accelerometer.push(data);
document.getElementById("sensor-accelerometer-count").innerHTML = app.data.Accelerometer.length;
}

app.handleSensorGyroscope = function (data) {
data["time"] = Date.now();
data["type"] = "Gyroscope";
app.data.Gyroscope.push(data);
document.getElementById("sensor-gyroscope-count").innerHTML = app.data.Gyroscope.length;
}

Problems: The accelerometer and gyroscope can not be synchronized. Usually, the data from gyroscope is less than the data from accelerometer.
Questions: Till now, I find that Evothing only provide two callback interface function, app.handleSensorAccelerometer() and handleSensorGyroscope(). The method I currently use for synchronization is to keep posting the data from accelerometer and gyroscope to two arrays respectively . As a result, the data are not strictly synchronized, just by random. Usually, the gyroscope's data is less than acclerometer 's data when sampling a period. My question is that how can I synchronize two sensors or eliminate my former errors?

Best Regards,
Elvis

Device: 
Wed, 26 Jul 2017 04:19:16 +0000 Elvis1991 72179 at https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/synchronization-problem-accelerometer#comments