Article ADXL345 user-selectable g range and data rate

Q 

1. The accelerometer comes with user-selectable g ranges, e.g. +/- 2g, +/- 4g.
How do I go about changing from the default range, +/- 2g to say +/- 16g?

2. How do I change the output data rate from the default 100Hz?

 

A 

1. How to set the different ranges of ADXL345 is described in page 27 of the
datasheet rev c. In Table 21 "g Range Setting" you find the settings.

Proposal:
You’ve found the definitions in the .h file. You can follow the format of the
other register writes to write this one as well.

  buffer[0] = XL345_DATA_FORMAT;       /* Set register address */
  buffer[1] = XL345_RANGE_2G;          /* Set value */
  xl345Write(2,buffer);                /* Write register */

put these 3 lines where you want this configured; a good place to start is just
before the Tap Configuration section.

2. The datarate is changed when changing the value of BW_RATE. In table 7 and 8
date code vs. output datarate is listed. More details regard register BW_RATE
are shown in table 19 of datasheet.

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.