# UM7 accelerometer sensor data converting

Welcome to Redshift Labs › Forums › UM7 Product Support › UM7 accelerometer sensor data converting

- This topic has 5 replies, 2 voices, and was last updated 5 years, 2 months ago by Caleb Chamberlain.

- AuthorPosts
- 13 May 2016 at 8:41 am #1099peterGuest
Hello … I can read Accelerometer RAW X,Y,Z datas from UM7. But values like that :

X = -166

Y = 183

Z = 4230

X = -161

Y = 191

Z = 4204

X = -153

Y = 195

Z = 4233

X = -158

Y = 212

Z = 4216

X = -158

Y = 204

Z = 4227

X = -148

Y = 191

Z = 4194

X = -171

Y = 205

Z = 4211

X = -159

Y = 201

Z = 4224

X = -153

Y = 189

Z = 4225

X = -165

Y = 212

Z = 4214These values are in right scale ? and , How can I convert to g(m/sn2) data these values ?

14 May 2016 at 2:10 pm #1100Caleb ChamberlainMemberThe conversion is easier if you use processed data instead. The raw data is completely uncalibrated. If you want to use the raw data, orient it so that X and Y are zero. The z-axis measurement is gravity, so you can get the scale factor out of that.

14 May 2016 at 2:55 pm #1102peterGuestthank you. can you explain over my sample values with your conversion(processed) formule. so, can you write a sample calculation. sorry but I am so far on this issue.

14 May 2016 at 3:03 pm #1103Caleb ChamberlainMemberSure. Suppose, for example, you measured the following:

X = 10

Y = -15

Z = 4230You might not be able to get a measurement where X and Y are both exactly 0, something like the above would be close enough. In this case, you’d get

// This converts raw units to acceleration in m/s/s

float scale_factor = (float)1 / 4230 * 9.8;accel_x = X * scale_factor;

accel_y = Y * scale_factor;

accel_z = Z * scale_factor;This actually isn’t perfectly accurate, since there will also be biases on the acceleration measurements, and each axis will have different biases and scale factors. To distinguish between bias and scale factor, you’d want to orient the sensor so that the body frame z-axis points orthogonal to gravity (so, rotated exactly 90 degrees). The non-zero measurement on the z-axis is the bias. Let that bias be represented by the variable B_z. Then the scale factor can be computed with:

float scale_factor_z = (float)1 / (4230 – B_z) * 9.8;

accel_z = (Z – B_z)*scale_factor_z;

The scale factors and biases for the X and Y axes will be different from the Z axis, so you’d need to repeat the calibration for every axis. It’s actually easiest to get all this data of you mount the sensor on a perfect cube, sitting on perfectly level table. Then you can get measurements from each axis both aligned with and orthogonal to gravity, to extract biases and scale factors.

If you have a super-accurate gimbal, you can do something more sophisticated by collecting data from every axis along with truth from the gimbal. Then you can compute all the calibration, including cross-axis alignment, scale factors, and biases, in one batch process. That’s what we did with the GP9 while we were still selling it.

Note that the accelerometers on the UM7 are consumer-grade, and the biases and scale factors aren’t very repeatable. You can get kinda close, but you’ll always be a little off.

16 May 2016 at 1:22 am #1104peterGuestThank you so so much @Caleb … your calculation for 2g range, isnt it ?

İf I want to be it’s be 4g range how can I modify your calculation ?16 May 2016 at 5:54 am #1105Caleb ChamberlainMemberThe dynamic range of the accelerometers is a function of the sensor itself, not the calibration. What I described is correct regardless of the sensor’s dynamic range.

- AuthorPosts

- The forum ‘UM7 Product Support’ is closed to new topics and replies.