This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ADXL362 Calibration

Hello,

We are planning to use the accelerometer in the Thingy91, we have some inconsistent results when configuring/reconfiguring, we have 2 questions:

 - When we, for example, want to change the thresholds while running, we write the values in the corresponding registers, is there anything else to do so the accel starts using the new values? Does the accel need to be reset somehow?

 - See attached a typical sequence of measurments when running the adxl362 sample included with zephyr. The z axis is measuring earths gravitation, but why the other two axis are consistently measuring values around -1.5 m/s^2? This is of course with the device motionless. Does the accel need to be calibrated somehow?

Thank you.

Xavier

Parents
  •  - When we, for example, want to change the thresholds while running, we write the values in the corresponding registers, is there anything else to do so the accel starts using the new values? Does the accel need to be reset somehow?

    The thresholds are configured in prj_thingy91_nrf9160ns.conf using:

    CONFIG_ADXL362_ACTIVITY_THRESHOLD=200
    CONFIG_ADXL362_INACTIVITY_THRESHOLD=200
    In order to configure these thresholds during runtime, you will need to use the Sensor API to send commands to the ADXL362. Have a look at the ADXL362 drivers, and especially adxl362_attr_set().
    Found under: zephyr\drivers\sensor\adxl362\
    You can also have a look at our Asset_Tracker sample (nrf\applications\asset_tracker\src\motion\motion.c) to see how they communicate with the sensor. 
    The device drivers are lacking some documentation, but is work in progress. Let me know if anything is unclear. 
    Kind regards,
    Øyvind
  • We have been looking at the codebases that you mention and as we understand it there is a hardcoded parameter in the driver. In particular when configuring the thresholds you can set the thresholds themselves but also what the documentation calls "time" which is the amount of events above the threshold that need to be measured for it to trigger. That value is hardocded in the driver to 1. We have been testing to change it with various degrees of success, we don't seem to be able to get consistent results. Is there a reason why that particular parameter is hardcoded or it's just as you said a work in progress?

  • My apologies, I see that I have referred to the wrong function to use. According to our apps team, you should be using sensor_attr_set(), which exposes adxl362_attr_set() here: https://github.com/nrfconnect/sdk-zephyr/blob/a3a6410b55fa97a9c6400c37d362c9137c5050b6/drivers/sensor/adxl362/adxl362.c#L624

    XavierN said:
    We have been testing to change it with various degrees of success, we don't seem to be able to get consistent results.

     Can you provide me with a code snippet of how you are changing? Are you getting an error?

    XavierN said:
    Is there a reason why that particular parameter is hardcoded or it's just as you said a work in progress?

     Can you please provide me with what particular parameter you are referring to? The sensor documentation in Zephyr is work in progress, adding a device driver index. Currently, the only documentation on device drivers is to read through the source code. Making this a little more complicated at the moment.

    But we will find the solution. 

    Kind regards,
    Øyvind

  • In particular I am referring to this change:

    https://github.com/nrfconnect/sdk-zephyr/compare/v2.3.0-rc1-ncs1-branch...parkme24:p24-branch

    We needed to add the time_act an time_inact parameters ourselves.

  • I'm not sure I follow. 

    The default value is 1000 for the the CONFIG_ADXL362_ACTIVITY_THRESHOLD according to our source code, which is the Scale Factor at Xout, Yout, Zout. This converts to 2g range (LSB/g), according to ADXL362 datasheet. The value is default at start up if not configured in application (prj.conf or dts), and you should be able to change this to what fits your application either via prj.conf/dts or via sensor API.

    CONFIG_ADXL362_ACTIVITY_THRESHOLD is the one that affects the driver and makes the accelerometer_poll() function kick in. From that you get the x,y,z acceleration values and can do processing on that.
    Øyvind said:

    The thresholds are configured in prj_thingy91_nrf9160ns.conf using:

    I referred to CONFIG_ADXL362_ACTIVITY_THRESHOLD=200 which converts to 0.2g. This is the default value for when using the Thingy:91. Then to change this value during runtime you will need to use sensor_attr_set() and the correct register setting in ADXL362. See zephyr\drivers\sensor\adxl362\adxl362.h for an overview of API calls. 

    For more details on how to communicate with the ADXL362, please read the ADXL362 datasheet..

    -Øyvind

Reply
  • I'm not sure I follow. 

    The default value is 1000 for the the CONFIG_ADXL362_ACTIVITY_THRESHOLD according to our source code, which is the Scale Factor at Xout, Yout, Zout. This converts to 2g range (LSB/g), according to ADXL362 datasheet. The value is default at start up if not configured in application (prj.conf or dts), and you should be able to change this to what fits your application either via prj.conf/dts or via sensor API.

    CONFIG_ADXL362_ACTIVITY_THRESHOLD is the one that affects the driver and makes the accelerometer_poll() function kick in. From that you get the x,y,z acceleration values and can do processing on that.
    Øyvind said:

    The thresholds are configured in prj_thingy91_nrf9160ns.conf using:

    I referred to CONFIG_ADXL362_ACTIVITY_THRESHOLD=200 which converts to 0.2g. This is the default value for when using the Thingy:91. Then to change this value during runtime you will need to use sensor_attr_set() and the correct register setting in ADXL362. See zephyr\drivers\sensor\adxl362\adxl362.h for an overview of API calls. 

    For more details on how to communicate with the ADXL362, please read the ADXL362 datasheet..

    -Øyvind

Children
Related