Prop Shield Accelerometer Sensitivity

Status
Not open for further replies.

Waterme11on

Active member
Hey there,
I was looking at the datasheet for the Prop Shield's accelerometer and it says you can measure +-2, +-4, and +-8g sensitivity ranges.

I'm currently reading the accelerometer values using nxpMotionSense Library: imu.readMotionSensor(ax, ay, az, gx, gy, gz, mx, my, mz);
However the accelerometer values (ax, ay, az) max out at 4 or -4, wondering if I can get anything higher than that.

Is there a way to change the sensitivity with the NXP library?

Cheers.
 
Changing that value didn't work,
looking through the documentation now to see if I can find out how to change it properly.

thanks for the link
 
I have no idea how to do this, Page 56 in the linked reference indicates you can change the sensitivity using XYZ_DATA_CFG through fs[1:0], However I have no idea where or what fs[1:0] is. Also the supplied table doesn't make any sense to me.

changing the value at the end of if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x01)) return false; // 4G range only screws up the output numbers from the accelerometer axis.
eg. changing it to 0x02 reduces the max value of the accelerometer from 4.0 to 2.51, and the sensitivity doesn't seem to actually change, just the values.
 
From page 56, fs[1:0] are the low-order 2 bits of XYZ_DATA_CFG register (address 0x0E) , or in the library, FXOS8700_XYZ_DATA_CFG. But changing from 4G to 8G will probably mess up other parts of the NXP library that assume accelerometer is configured for 4G, e.g. G_PER_COUNT. So you'll have to understand the details of the accelerometer and the NXP library ... that's above my pay grade.
 
Okay so how do i change fs[] to 8g? I might as well try regardless of messing up other parts of the library.

Is there any way to ping paul?
Maybe he would know if its possible to implement adjustable sensitivity as part of the library.

also thanks for your replies and help manitou, much appreciated :)
 
Okay so how do i change fs[] to 8g? I might as well try regardless of messing up other parts of the library.
Try
if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x02)) return false; // 8 G

and double the value in G_PER_COUNT in NXPMotionSense.h, so your earlier 2.51 measurement becomes 5.02

It's possible you'd need to recalibrate, but I don't think the accelerometer participates in the calibration. From PrintCalibration
Code:
Accelerometer Offsets
   0.000 g
   0.000 g
   0.000 g

Sanity check: confirm that az from imu.readMotionSensor() is still about 1.0
 
Last edited:
Okay so that worked as you expected, measuring ax it sits around 1 when held upright and maxes out at 5.02.
However I don't think the sensitivity is actually increased to 8g. The axis will still max out with the same amount of force applied. it seems only the numbers have been changed.
 
I can't explain your max force observation. And to correct the semantics, when you double the range to 8g, the sensitivity is halved to 0.976 mg/LSB (Table 61, page 56)..

FWIW, shaking my prop shield in 8g mode, the max acceleration I observe is 7.4 g
 
Last edited:
OKAY
I think I finally got it after searching through the nxp community forum.

Changes made to get it to work properly at 8g:
in NXPMotionSense.cpp:
if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x02)) return false; // 8g range
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG2, 0x02)) return false; // hires
if (!write_reg(i2c_addr, FXOS8700_CTRL_REG1, 0x09)) return false; // 100Hz A+M

In NXPMotionSense.h:
#define G_PER_COUNT 0.000244140625f // = 1/4096

Had to disable some of the built in noise reduction with CTRL_REG1 and 2 otherwise it would default to 4g.
Also had to half the G_PER_COUNT number.

I assume that if you want to change the range to +-2g then make XYZ_DATA_CFG to 0x00, and change G_PER_COUNT to double the default number. You also wouldn't need to change the CTRL_REG values as the noise reduction is enabled for 2g.

Thank you for the help manitou, hopefully this will help anyone else looking to change their accelerometer settings.

Edit: This is the thread on the nxp forum that held the answer: https://community.nxp.com/message/855163?commentID=855163#comment-855163
 
I can't explain your max force observation. And to correct the semantics, when you double the range to 8g, the sensitivity is halved to 0.976 mg/LSB (Table 61, page 56)..

FWIW, shaking my prop shield in 8g mode, the max acceleration I observe is 7.4 g

@manitou do you have some code you could share ref your observation above as I am just getting started with the library and want to get some data from the accelerometer?
 
Status
Not open for further replies.
Back
Top