# strider

Member Since: May 12, 2011

Country: United States

• I learned how to set the range and resolution (scale factor) of ADXL245. Let me report here for reference for those who might need different ranges for the accelerometers:

/* 0x09 = B00001001 --> fourth bit from right is D3 of DATA_FORMAT Register (0x31) and * when it is 1, it means full resolution. D1 and D0 are range bits (see page 17 Table 18 * of ADXL345 datasheet by Analog Devices). * (D1,D0) = (0,0) sets accelerometers to (+/-)2g range. * (D1,D0) = (0,1) sets accelerometers to (+/-)4g range. * (D1,D0) = (1,0) sets accelerometers to (+/-)8g range. * (D1,D0) = (1,1) sets accelerometers to (+/-)16g range. * When D3 is set to 1, independent of range accuracy (also called scale factor in Table 1) * remains approximately 4mg/LSB (typically it is (maxRange - minRange) / numberOfBits, e.g., * (2-(-2))/2^10 = 0.0039mg/LSB = 3.9g/LSB, e.g., (4-(-4))/2^10 = 7.8g/LSB so D3=1 enables * increment of usable bits from 10 to 11 hence the resolution maintains (4-(-4))/2^11 = 3.9g/LSB) * 0x08 means (+/-)2g and 10 bits (full resolution) used --> 3.9mg/LSB * 0x09 means (+/-)4g and 11 bits (full resolution) used --> 3.9mg/LSB * 0x0A means (+/-)8g and 12 bits (full resolution) used --> 3.9mg/LSB * 0x0B means (+/-)16g and 13 bits (full resolution) used --> 3.9mg/LSB * 0x00 means (+/-)2g and 10 bits (fixed resolution) used --> 3.9mg/LSB * 0x01 means (+/-)4g and 10 bits (fixed resolution) used --> 7.8mg/LSB * 0x02 means (+/-)8g and 10 bits (fixed resolution) used --> 15.6mg/LSB * 0x03 means (+/-)16g and 10 bits (fixed resolution) used --> 31.2mg/LSB */

• Does anybody know how to change the range of the ADXL345 accelerometers from 2g to 4g or to other values that are 8g and 16g? By using Peter's code, not by using ADXL345's library provided by Sparkfun. If we are able to change the range of accelerometers, do you think we need to do accelerometer calibration again?

• Thank you Jimb0! Your suggested solution fixed the problem.

• When I followed the hookup guide, and finished "Install Arduino SAMD Boards" section, first I tried to verify firmware code "_9DoF_Razor_M0_Firmware.ino" but Arduino displayed fatal error: sam.h: No such file or directory. Then I tried to verify and upload "MPU9250_Basic.ino" located at the SF MPU-9250 library. I obtained the same fatal error.. Did anybody face this problem when verifying and uploading code to Razor IMU?

• I just observed yaw angle after leaving the new razor imu on my table; what you say happens in my Razor as well. I think the angles we observe are estimated only from gyroscope and accelerometer data; if magnetometers are calibrated and included in the estimation, the heading values can be much better. It was better in the previous version of the Razor IMU, in the code written by Peter Bartz. In that code, Peter provided soft and hard iron calibration of magnetometers; the complementary filter used there was taking the magnetometer data into account in heading estimation.

No public wish lists :(

In 2003, CU student Nate Seidle fried a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado.

No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics. We're here to help you start something.