Comments: ADXL345 Hookup Guide


Comments 7 comments

  • I’m using an arduino MKR FOX 1200 and having trouble using the accelerometer. I was using using i2c on arduino uno. What pins should house on MAKE FOX 1200 to use the i2c?

  • I found that the gains in the library code were off by a factor of 0.1, i.e. 10% of their correct values. I changed them to the following to get approx 1g in the Z axis. So these numbers should give genuine g values for the accelerations.

    gains[0] = 0.0376390; gains[1] = 0.0376009; gains[2] = 0.0349265;

    These gains are located in SparkFun_ADXL345_Arduino_Library/src/SparkFun_ADXL345.cpp for anyone who needs to change them.

    This might help @Member #556651


  • How can i change the SPI pins to pins other then 11, 12 and 13?

    • The ATMega328 has hardware SPI on those pins so they can’t be changed. In theory you can probably write a software SPI library, but since you can run numerous devices on one SPI bus these are rare. If you are using a different microcontroller you will have to check the datasheet to find out where the SPI bus is.

  • Hi everything works fine! however i cant manage to measure free fall:( and what are these: adxl.setFreeFallThreshold(7);
    adxl.setFreeFallDuration(30); what does the digit represent? i dropped my accelerometer( ADXL345) from my table but the serial monitor did not display free fall Please help! i really need an answer i cant find anything on the web.

  • I hooked up the ADXL345 with I2C and am getting data using the example code that is provided with this tutorial. I also ran the calibration script that is provided. But I don’t see anything in the tutorial that says how to convert that calibrated data to actual g.

  • bboyho / last year * / 1

    ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    Connecting Two ADXL345s

    The ADXL345 has two I2C address (0x53 and 0x1D) as stated in the datasheet [pg 10 - ]. Try looking at this tutorial for more information => ].

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!