# Quaternion values from Arduino 9-axis motion shield seem very wrong

I am currently usinga BNO055 sensor fitted on the Arduino Nine-axis motion shield to measure ocean wave heights and periods. To do this, I'd like to use the quaternions provided, however I have a slight issue. A quaternion should be <cos(theta/2), Xsin(theta/2), Ysin(theta/2), Z*sin(theta/2)>, with X, Y and Z the coordinates of a unit vector and theta the angle of rotation around that vector. Therefore, I expect all three to be inferior to one.

However, when I run a simple code to see the raw data, the W given by my sensor when on the table is 16 375, and X, Y and Z values are in the high hundreds range...

This gives me a wave height of hundreds of thousands of kilometers :slightly_smiling_face:

Does anyone know why this happens? Do I need to divide the quaternion by it's norm to get the correct result? Or maybe I am misunderstanding the use of a quaternion?

Oh, and I have calibrated the sensor beforehand

I am not familiar with this sensor, so I am just guessing.

The sensor is likely giving you fixed-point numbers. Judging from the real part, there are most likely 14 bits right of the implicit radix point. If that is the case, the actual quaternion can be computed as:

``````float w = raw_w / 16384.0;
float x = raw_x / 16384.0;
float y = raw_y / 16384.0;
float z = raw_z / 16384.0;
``````

You can check whether this is reasonable by computing the norm, which should be very close to one.

• Thank you so much, I didn't understand the explanation but your solution worked! Jun 16 at 14:58