we use the ADXL345 to measure the angle

Hi, Everyone

I have a 3 questions.

1. How do we do a hardware reset or software reset of the ADXL345 at initial state? 2. Does ADXL345 need calibration?
3. What settings are appropriate for the device to be used by humans?
4. If you have any example programs, please let me know.

Best regards,

  • 0
    •  Analog Employees 
    on Dec 11, 2019 5:34 PM over 1 year ago

    Hello whwang203, 

    Thank you for your question and for choosing to use our ADXL345. 

    Regarding to your questions: 

    1. The ADXL345 registers are set to their default values when powered on. You can find useful information about power sequencing on page 13 of the product datasheet Rev.E, as well as its register reset values on table 19, page 23. 

    2. This device can be calibrate if necessary. Explanation of how to perform offset calibration is describe in detail on page 30 of the datasheet. 

    3. Can you please explain in what way will the device be used by humans? 

    4. Software and drives to have a quick interacting with this device can be found in the "software and system requirements" section of the product website, https://www.analog.com/en/products/adxl345.html

    As you plan to use the ADXL345 to measure inclination, I strongly recommend you to take a look to the application note AN-1075: Using an accelerometer for inclination sensing. https://www.analog.com/media/en/technical-documentation/application-notes/AN-1057.pdf

    Please do not hesitate to reach out if you have further inquires 

  • Hi, PdelCorro

    We're making a device that holds the hands and measures the strength of the material.
    The strength sensor uses your ADXL377.

    I have two questions.
    1) ADXL345
    The main processor uses STM32F405
    Communication method is I2C and speed is 100k.
    I put the device on my desk and tested it.

    The settings of ADXL345 are as follows:
    write_bytes(0x2D,1,(uint8_t *)0x00); //standby mode
    write_bytes(0x2c,1,&buf[1]);//rate=25hz bandwith=12.5hz
    write_bytes(0x2d,1,&buf[2]);//power mode,measure enable
    write_bytes(0x2e,1,&buf[3]);//DATA_READY enable

    The data read from adxl345
     accel->x= 0, accel->y = 7924, accel->z = 8373
     accel->x= 0, accel->y = 8096, accel->z = 9414

    Each time the power is turned on, the x-axis value is read as zero.
    - Y-axis and z-axis values ​​are also read inconsistently

    2) ADXL377
    Which reference should be taken when measuring the strength of an object?
    (e.g. waveform length, amplitude, etc.)

    Best regards,

  • 0
    •  Analog Employees 
    on Dec 13, 2019 9:40 PM over 1 year ago in reply to whwang203

    Hi Hwang, 

    1) The problem could be in the I2C read function. If you wish, you can send me that part of your code to take a look at it.

    2) Are you trying the obtain the impact force between two surfaces when they touch by using the acceleration? I am trying to picture your application. 

    Thank you, 


  • Hi PdelCorro,

    1) I send I2C read & write code

    uint8_t buf[6];
    printf("buf = %d %d %d %d %d %d \r\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
    raw[0]=(buf[1]<<8)+buf[0];//physical x
    raw[1]=(buf[3]<<8)+buf[2];//physical y
    raw[2]=(buf[5]<<8)+buf[4];//physical z

    buf = 251 7 0 0 225 7

    buf = 253 7 0 0 223 7

    buf = 250 7 0 0 222 7


    void write_bytes(uint16_t DevAddr,uint8_t size,uint8_t *pData)
    HAL_I2C_Master_Transmit(&hi2c1, DevAddr, pData, size, 100);
    void read_bytes(uint16_t DevAddr,uint8_t Size,uint8_t *pData)
    HAL_I2C_Master_Receive(&hi2c1, DevAddr, pData, Size, 100);

    2) We use the ADXL345 to measure the angle and the ADXL377 to measure the strength of the object.

      Which reference at ADXL377 should be taken when measuring the strength of an object?
    (e.g. waveform length, amplitude, etc.)

    Thank you,


  • 0
    •  Analog Employees 
    on Dec 16, 2019 3:17 PM over 1 year ago in reply to whwang203

    Hi Hwang, 

    1 - I think that you have an issue defining the ADXL345 address for I2C communication.  From the code you provided (read_bytes(0x32,6,buf)), you defined DevAddr = 0x32. This value should be 0x3B for the read function if the ALT ADDRESS pin is high and 0xA7 if is low. Please check the I2C section of the datasheet for more information, on page 18.  

    2 - Can you clarify what do you mean with "measuring strength of an object"?