How to set the range of 9DOF sensor

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
not_the_foggiest
 
Posts: 7
Joined: Wed Nov 08, 2017 11:35 am

Re: How to set the range of 9DOF sensor

Post by not_the_foggiest »

Hi,

Thank you for your help. I had a duplicate .cpp file, which is why it wasn't initially working.

I noticed that the accelerometer is set to read at 100Hz but i've seen there is an option to run in a 'fast' mode at 400Hz. How would one go about setting it to read at 400Hz.

Many thanks

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How to set the range of 9DOF sensor

Post by adafruit_support_bill »

From the data sheet (table 18 on page 25) http://www.st.com/content/ccc/resource/ ... 027543.pdf
The data rate configuration bits are the upper 4 bits of CTRL_REG1_A.

From table 20 on the same page, the bit settings for 400KHz are 0111 (0x7).

The upper 4 bits in the existing code are 0x5 (0101) - which selects 100KHz operation as noted in the comments:

Code: Select all

  // Enable the accelerometer (100Hz)
  write8(LSM303_ADDRESS_ACCEL, LSM303_REGISTER_ACCEL_CTRL_REG1_A, 0x57);
So to change it to 400KHz, we need to replace the 0x5 with an 0x7:

Code: Select all

  // Enable the accelerometer (400Hz)
  write8(LSM303_ADDRESS_ACCEL, LSM303_REGISTER_ACCEL_CTRL_REG1_A, 0x77);

User avatar
not_the_foggiest
 
Posts: 7
Joined: Wed Nov 08, 2017 11:35 am

Re: How to set the range of 9DOF sensor

Post by not_the_foggiest »

Excellent, thank you very much!! The data is looking a lot better now. However, I do have a final question for now. With the accelerometer set to +-16g, I would expect the max reading to get to be +-156m/s^2. However, I seem to be reading a max of +-240m/s^2. Do you have any insights on this?

Many thanks

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: How to set the range of 9DOF sensor

Post by adafruit_support_bill »

Range specifications for MEMS accelerometers tend to be minimum ratings. The actual measurement range is often higher - although measurements beyond the stated range may not be as accurate. STI is vague on that point in the data sheet. They only list a 'typical' value with no minimum or maximum. But there is a footnote saying "Typical specifications are not guaranteed."

Looking at the sensitivity ratings on page 10, all of them leave considerable headroom above the stated range when multiplied by a full-scale 16 bit reading. As with any sensor, for critical applications, it is wise to calibrate: https://learn.adafruit.com/calibrating- ... -calibrate

User avatar
not_the_foggiest
 
Posts: 7
Joined: Wed Nov 08, 2017 11:35 am

Re: How to set the range of 9DOF sensor

Post by not_the_foggiest »

Thank you very much, you have been most helpful!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”