Go Down

Topic: Problem with an ADXL345 Accelerometer with an Arduino Due (Read 137 times) previous topic - next topic

StellarJay

So I'm just running some tests on the functionality of an ADXL345 3-axis accelerometer with an Arduino Due and I'm running the test code posted on the same page (here) as the product details of what I have, I've wired the device just as in the diagram there as well and am using the test code there as well, the code compiles, uploads and seems to be running correctly, but my serial monitor sends scrolling outputs as follows:

The acceleration info of x, y, z are:0 0 0
Roll:0.00
Pitch:0.00

The acceleration info of x, y, z are:0 0 0
Roll:0.00
Pitch:0.00

And nothing changes even when I change the orientation of the breakout board. Any ideas. Is this because the wiring diagram is for an Uno not a Due?

Palliser

So I'm just running some tests on the functionality of an ADXL345 3-axis accelerometer with an Arduino Due and I'm running the test code posted on the same page (here) as the product details of what I have, I've wired the device just as in the diagram there as well and am using the test code there as well, the code compiles, uploads and seems to be running correctly, but my serial monitor sends scrolling outputs as follows:

The acceleration info of x, y, z are:0 0 0
Roll:0.00
Pitch:0.00

The acceleration info of x, y, z are:0 0 0
Roll:0.00
Pitch:0.00

And nothing changes even when I change the orientation of the breakout board. Any ideas. Is this because the wiring diagram is for an Uno not a Due?
Hello StellarJay,

The Wire (I2C) pins in UNO and DUE are different. The example that you mentioned only works with UNO that uses pins A4(SDA) and A5(SCL). For Due you have to use pins 20(SDA) and 21(SCL).
To make it easier, search in this forum (in the Arduino Due topics) for ADXL345 examples. Good luck!

EDIT: It is weird that your link states a Power voltage range between  3.3 and 6V for the ADXL345. According to the manufacturer, the voltage range is  between 2.0 to 3.6V, thus, be careful with that. Remember also that Arduino Due is not tolerant to 5V in the I/O.

-p

-p

StellarJay

Hello StellarJay,

The Wire (I2C) pins in UNO and DUE are different. The example that you mentioned only works with UNO that uses pins A4(SDA) and A5(SCL). For Due you have to use pins 20(SDA) and 21(SCL).
To make it easier, search in this forum (in the Arduino Due topics) for ADXL345 examples. Good luck!

EDIT: It is weird that your link states a Power voltage range between  3.3 and 6V for the ADXL345. According to the manufacturer, the voltage range is  between 2.0 to 3.6V, thus, be careful with that. Remember also that Arduino Due is not tolerant to 5V in the I/O.

-p

-p
That worked perfectly now I am getting values, however, using that code is giving me rest values of x:~65530, y: ~65530, z: ~270, with playing around with the orientation it appears the 65535 is wrapping to 0. So 65535 to ~65260 are representing negative numbers and 0 to ~270 are positive. Is that correct behavior?

EDIT: it also shows the working voltage draw is only 2.5v: 40uA, I think the working Voltage being listed that way means it'll tolerate and function by being attached to 3V or 5V connections

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy