Skip to main content

Raw Files

The high-rate signals of the 287-2B (PPG2, accelerometer, BioZ) are not stored as rows in the SDK's database. The SDK writes the bytes it downloads from the bracelet, unchanged, to .wiff files on the phone.

This page describes the binary layout of those files, for when you read them outside the SDK, for example on your server.

What you want to doWhere to look
Get the files onto the phone and export themRaw File Transfer & Export
Decode PPG2 and accelerometer files into samples in your appParsing Raw Files: the SDK has the parsers Ppg2WiffParser and AccWiffParser
Decode the files yourselfThis page

The SDK has no parser for BioZ files. For those, use the layout below.

General header and PPG2​

Multi-color PPG file (PPG2)​

This file contains a header and a body section. Both are made of records. Every record starts with 3 bytes with the predefined values 0x4F, 0x48, 0x52.

All numbers of more than one byte are little-endian: the least significant byte comes first.

Record Format​

PartBytesContent
Sync pattern3[S0] [S1] [S2], fixed values [0x4F] [0x48] [0x52]: ASCII "OHR"
Length2[Llsb] [Lmsb]: the number of bytes that follow in this record, the ID included
ID1[ID]: the type of the record
PayloadLength − 1[P0] .. [PLength-2]: the data

A record has no checksum. To check that a record is complete, look for the next sync pattern, or the end of the file, directly after its payload. The SDK's parsers do the same: when the pattern is not there, they drop the record and search for the next "OHR".

The record IDs:

IDRecord
0x0ATime-size header
0x0BVersion header
0x0CHost version header
0x0FMeasurements

The header​

The header contains 3 records:

Time-size header:

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes. Normally it is 17 (0x0011).
  3. ID [ID] = 0x0A
  4. Payload : p0-p3 : 4 bytes: The size of the file.
  • p4-p11: 8 bytes reserved (normally zero).
  • p12-p15: start time of the measurement, in seconds since 1970-01-01 UTC (this is the start time of the PPG2 measurement).

Version Header:

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes. It is 26 (0x001A).
  3. ID [ID] = 0x0B
  4. Payload : p0-p7 : 8 bytes reserved (normally zero).
  • p8-p10: 3 bytes, FW version. something like 0, 3, 120
  • p11-p24: The name of the product (MMT287-2ph2) followed by 2 zeros at the end.

Host version header

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes. It is 32 (0x0020).
  3. ID [ID] = 0x0C
  4. Payload : p0-p30 : 31 bytes reserved

The SDK's parsers accept a time-size header at any position in a file, not only at its start, and take its start time as the time of the samples that follow.

The body​

The body of the file contains records of measurements. Their record ID is 0x0F.

The payload of a measurements record is a sequence of chunks. Each chunk holds the values of one metric:

PartBytesContent
Metric ID1The metric of the chunk, see the list below
Length2[Llsb] [Lmsb]: the number of bytes that follow in this chunk
DataLengthThe values, in the format of the metric

The metric IDs:

Metric IDMetric
0x7EPPG Green
0x7CPPG Red
0x7DPPG Red middle
0x7BPPG InfraRed
0x7FPPG Ambient
0x1ETime
0x2BAccelerometer, see Accelerometer

Ppg2WiffParser returns the green, red and infrared samples. It skips the chunks of the red middle and ambient metrics.

Time chunk​

A chunk with metric ID 0x1E gives the time of the samples that follow it.

PartBytesContent
Index1The packet index from 0 to 255
Quality1
Time4Seconds since 1970-01-01 UTC

Multicolor PPG record​

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes.
  3. ID [ID] = 0x0F
  4. Payload : The payload contains the actual measurements of the PPG channels. Since there are different channels (green, red, IR, ambient), one record may contain more than one chunk. The data of each channel has the format below.

PPG chunk format​

  1. The Metric ID:

    • PPG Green: 0x7E
    • PPG Red: 0x7C
    • PPG Red middle: 0x7D
    • PPG InfraRed: 0x7B
    • PPG Ambient: 0x7F
  2. For every metric we have the following data:

PartBytesContent
Length2[Llsb] [Lmsb]: length of the metric
index1The packet index from 0 to 255
quality14
BPI1Body position index
PF1PPG sample format: 0x60 for 32 Hz (the normal value), 0x61 for 64 Hz, 0x62 for 128 Hz, 0x63 for 256 Hz, 0x64 for 512 Hz
SI1Stream locations identifier. bit7 - bit4: Led, bit3 - bit0: Photodiode
OFS1PPG Offset. bit7 – bit0: Offset
exp10
Li4Relative LED power [%] for each quarter of samples (M/4). 0..100: power
Gi4Relative ADC gain used to obtain Pi for each quarter of samples (M/4). 0: gain factor 1x, 1: gain factor 2x, 2: gain factor 4x, 3: gain factor 8x
Pi2 × MThe PPG samples, 16 bit unsigned each

A chunk holds one second of samples: M is the sample rate given by PF (32 samples at 32 Hz).

The value of a sample. The SDK's parser, like Corsano's reference parser, computes the PPG value of a sample as:

value = Pi + Gi * 32768 - 16384

where Gi is the gain byte of the quarter of the chunk the sample is in (the first quarter of the samples uses the first byte, and so on). It then corrects a rollover: when the value is about 32768 higher or lower than the previous value of the same channel (a difference between 31768 and 33768), it subtracts or adds 32768. A channel is one metric ID on one SI value.

The time of a sample. A chunk has no time of its own. Start from the start time of the time-size header, or from the last time chunk. Each chunk of a channel then covers the next second, and the samples of a chunk are evenly spaced over it (1000 / M milliseconds apart). The SDK's parser sets the clock of a channel to the time of a time chunk or time-size header only when the two differ by more than 6 seconds.

Accelerometer​

Accelerometer File​

The accelerometer records have the format of the multi-color PPG records. Only the metric ID and the data of the chunk are different.

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes.
  3. ID [ID] = 0x0F
  4. Payload : one chunk with the measurements of the 3-axis accelerometer:
PartBytesContent
Metric ID10x2B
Length2[Llsb] [Lmsb]: length of the payload
index1The packet index from 0 to 255
quality14
BPI1Body position index
AF1Acceleration sample format, set to 6E for 32 Hz
Samples6 × M<X0,L> <X0,H> <Y0,L> <Y0,H> <Z0,L> <Z0,H>…<XM-1,L> <XM-1,H> <YM-1,L> <YM-1,H> <ZM-1,L> <ZM-1,H>

where:

  • Xi : Acceleration along X axis
  • Yi : Acceleration along Y axis
  • Zi : Acceleration along Z axis

Each value is a signed 16-bit number. A chunk holds one second: 32 samples, 31.25 ms apart. The file also holds time chunks (metric ID 0x1E, see Time chunk), which give the time of the samples.

See Accelerometer data for the unit of the values.

BioZ​

BioZ File​

The BioZ file contains the skin conductance data of the user.

The format of the BioZ records is exactly like the one of the multi-color PPG records; only the metric ID is different, as mentioned below.

  1. The 3 bytes Sync pattern [0x4F] [0x48] [0x52] => ASCII “OHR”
  2. Length [Llsb] [Lmsb] Length of the record excluding the first 5 bytes.
  3. ID [ID] = 0x3E
  4. Payload : The payload contains the actual measurements of the skin conductance, as following:
PartBytesContent
Length2[Llsb] [Lmsb]: length of the payload
Index1An index counter from 0 to 255
quality1Set to 4
BPI1Body position index
BioZF1BioZ sample format: 01 for 25 Hz
Samples3 × 25<B0,0> <B0,1><B0,2> <B1,0> <B1,1><B1,2> …<B24,0> <B24,1><B24,2>

where:

  • Bx,0 : Bioz index x the least significant byte (of 24 bits)
  • Bx,1 : Bioz index x the byte in the middle (of 24 bits)
  • Bx,2 : Bioz index x the most significant byte (of 24 bits)

Script for parsing​

The exported files can be parsed using our sample code, available in Python or PHP.

Please request access via our contact page.