ADXL326 Accelerometer Questions

by Blake81 on Mon Jan 07, 2013 5:50 am

I'm trying to get this accelerometer working. I'm going to be using it with the GPS logger in a high-altitude balloon. I have one problem and a question. When I run this code, I get values of 14, 15, and 16 for X Y and Z, respectively. Does it make sense to get those values? Also, the problem is that, when I run this code, the values don't change. Can you see why this is happening? Thanks.

Code: Select all
const int xInput = A0;
    const int yInput = A1;
    const int zInput = A2;
     
    void setup()
    {
    analogReference(EXTERNAL);
    Serial.begin(9600);
    }
     
    void loop()
    {
    int xRaw = xInput;
    int yRaw = yInput;
    int zRaw = zInput;
   
    Serial.print("X: ");
    Serial.print(xRaw);
    Serial.print(", Y: ");
    Serial.print(yRaw);
    Serial.print(", Z: ");
    Serial.print(zRaw);
String AccValues = ",Accel=";
AccValues = AccValues + xRaw + yRaw + zRaw;
Serial.print(AccValues);
    }
User avatar
Blake81
 
Posts: 14
Joined: Thu Jul 05, 2012 2:11 pm
Location: Carrollton, GA

Re: ADXL326 Accelerometer Questions

by adafruit_support_bill on Mon Jan 07, 2013 6:06 am

Your loop isn't reading from the sensor. You are just assigning x, y & z raw to some variables that never change.
Code: Select all
    int xRaw = xInput;
    int yRaw = yInput;
    int zRaw = zInput;


You need to read from the pins that your ADX326 is connected to. To minimize noise, use the "readAxis()" function from the calibration sketch in the tutorial for your readings. http://learn.adafruit.com/adafruit-anal ... rogramming

Code: Select all
int xRaw = ReadAxis(xInput);
int yRaw = ReadAxis(yInput);
int zRaw = ReadAxis(zInput);
User avatar
adafruit_support_bill
 
Posts: 25582
Joined: Sat Feb 07, 2009 9:11 am

Re: ADXL326 Accelerometer Questions

by vishpad on Thu Nov 21, 2013 10:00 am

Hello,

I uploaded the calibration code to my Arduino Uno and wired the circuit for the accelerometer as shown in the tutorial. However, when I observe the serial monitor, the x, y, and z ranges are all 512-512 and -1.00G. Even when I move the accelerometer the ranges don't change. I followed the calibration procedure, but after calibration the x, y, and z ranges all show 512-1023 and 1.00G. Those numbers also do not change at all when I move the accelerometer. How do I get the input ranges/Gs to change? Any help would be greatly appreciated.

Thanks
vishpad
 
Posts: 1
Joined: Thu Nov 21, 2013 9:56 am

Re: ADXL326 Accelerometer Questions

by adafruit_support_bill on Thu Nov 21, 2013 10:19 am

Post a photo showing your soldering and all your connections.
User avatar
adafruit_support_bill
 
Posts: 25582
Joined: Sat Feb 07, 2009 9:11 am