Acc data explained
This page describes the values of the raw accelerometer data (Acc) of the CardioWatch 287-2B and how to derive a movement indicator from them.
Getting the data
The bracelet records the raw accelerometer data in a file of its own. To receive it:
| Step | How |
|---|---|
| Use a 287-2B | The SDK downloads the accelerometer file from a 287-2B only. |
| Switch the accelerometer on | Set isAccEnabled = true in the InitializationConfig, see Bracelet Initialization. Some plans record it for 2 minutes every 30 minutes. |
| Have it in your licence | The automatic download fetches the file (FileOnWatch.ACC_FILE) only when your licence includes the accelerometer, see The licence and raw data. |
| Parse the files | AccWiffParser gives you the samples as AccWiffSlotModel, see Parsing raw files. |
One AccWiffSlotModel is one sample:
| Field | Type | Description |
|---|---|---|
valueX, valueY, valueZ | Int? | The acceleration on each axis, see below |
timestamp | Double | Time of the sample in milliseconds. The samples are 32 per second, so 31.25 ms apart. |
bodyPose | Int? | Body position reported by the bracelet |
The values
- Unit
The unit of the Acc is 1/512 g. For example, if we read a value of 1024 on one axis, it means we have 2 g acceleration on that axis.
- Acc X/Y/Z
We have 3 axes of accelerometer data: acc_x, acc_y and acc_z (valueX, valueY and valueZ in the SDK).
Each axis is scaled to be between -8 g and 8 g. Each variable acc_x, acc_y and acc_z is a 16 bit signed integer, ranging between -32,768 and 32,767.
Movement indicator
To see how much the bracelet moves, compare each sample with the previous one:
(1) The difference of the acceleration on each axis:
d_accX = acc_x[i] - acc_x[i-1];
d_accY = acc_y[i] - acc_y[i-1];
d_accZ = acc_z[i] - acc_z[i-1];
(2) The norm of the vector of these differences:
Norm_of_d_acc = sqrt(d_accX * d_accX + d_accY * d_accY + d_accZ * d_accZ);
Norm_of_d_acc indicates movement. If the bracelet is physically fixed, this norm goes towards zero. If it is in intense movement, this metric shows a big value.
In Kotlin, with two consecutive samples of the parser:
import com.corsano.sdk.ble.data.AccWiffSlotModel
import kotlin.math.sqrt
/** The movement between two consecutive samples, in units of 1/512 g. Null when an axis is missing. */
fun movementNorm(previous: AccWiffSlotModel, current: AccWiffSlotModel): Double? {
val dX = ((current.valueX ?: return null) - (previous.valueX ?: return null)).toDouble()
val dY = ((current.valueY ?: return null) - (previous.valueY ?: return null)).toDouble()
val dZ = ((current.valueZ ?: return null) - (previous.valueZ ?: return null)).toDouble()
return sqrt(dX * dX + dY * dY + dZ * dZ)
}
Other accelerometer values in the SDK
Two raw metrics also carry accelerometer fields. They are not the samples of the accelerometer file and have their own scale:
| Model | Fields | Value |
|---|---|---|
MetricPpg | accX, accY, accZ (Int?) | A signed byte from the bracelet, multiplied by 4 |
MetricTemperatureRaw | accX, accY, accZ (Float?) | A signed byte from the bracelet, divided by 50 |
Both models are described in Raw data models.