Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Prop Shield Accelerometer Sensitivity

  1. #1

    Prop Shield Accelerometer Sensitivity

    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.

  2. #2
    Hi just bumping this, anyone know how to stop my accelerometer axis from maxing out?

  3. #3
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,196
    in the NXP library, NXPMotionSense::FXOS8700_begin() has
    if (!write_reg(i2c_addr, FXOS8700_XYZ_DATA_CFG, 0x01)) return false; // 4G range

    you need to check the data sheet, but i think setting it to 0x02 would get you 8G

    https://www.nxp.com/files-static/sen...FXOS8700CQ.pdf

  4. #4
    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

  5. #5
    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.

  6. #6
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,196
    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.

  7. #7
    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

  8. #8
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,196
    Quote Originally Posted by Waterme11on View Post
    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 by manitou; 07-04-2018 at 07:15 PM.

  9. #9
    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.

  10. #10
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,196
    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 by manitou; 07-05-2018 at 04:35 PM.

  11. #11
    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/85...comment-855163

  12. #12
    Senior Member
    Join Date
    Nov 2012
    Location
    Chipping Norton, UK
    Posts
    273
    Quote Originally Posted by manitou View Post
    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?

  13. #13
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,196
    Quote Originally Posted by Experimentalist View Post
    @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?
    run the CalibrateSensors example from the NXPMotionSense lib. it prints out raw values from the IMU sensors.

    also look at https://github.com/kriswiner/Teensy_Prop_Shield
    or https://github.com/mlwarner/fxos8700cq-arduino

  14. #14
    Senior Member
    Join Date
    Nov 2012
    Location
    Chipping Norton, UK
    Posts
    273
    Quote Originally Posted by manitou View Post
    run the CalibrateSensors example from the NXPMotionSense lib. it prints out raw values from the IMU sensors.

    also look at https://github.com/kriswiner/Teensy_Prop_Shield
    or https://github.com/mlwarner/fxos8700cq-arduino
    Thanks for the tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •