# Accelerometer Data

The accelerometer measures acceleration on a range from -2g to +2g on each of the X, Y, Z axis.

![](/files/ZEz7cvmODZStq0OfdqI7)Click here to expand...

The accelerometer values are encoded as two's complement, because they contain signed values.

Accelerometer itself outputs values in range (-2g,2g) for each axis, those values are divided by 16

to fit into range (-127,127) and into single byte of data.

For example, when original value is 0xC0, it is interpreted as -64, which when multiplied by 16 yields

value of -1024mg. Negative values are those larger than 0x7F (127).

The easiest way to convert such value is either to use specific language library to parse string as signed char

or to invert all bits and add 1.

Example data:

X Axis:

Raw data: "013020410002"\
Interpretation: X:1040 Y:0 Z:32

Y Axis:

Raw data: "01302003c3fe"\
Interpretation: X:48 Y:-976 Z:-16

Z Axis:

Raw data: "0130200400c0"\
Interpretation: X:64 Y:0 Z:-1024


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ask.simplehw.eu/kb/simple-api-6-generation/api-6-encoding_23396515/page-6.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
