Hi!

I have some trouble using the ADXL202E accelerometer. Has anyone got some code to decode the signals from the accelerometer (I use it as a digital accelerometer)?

I tried using the code from the Memsic2125 example, but the numbers I get are weird.

, but the numbers I get are weird.

This isn't very helpful.
Can you post your code, and some of the values you're getting?
They both look pretty straightforward devices.

I get unsteady numbers which aren't really changing when I accelerate the chip.

This was the code I used:

int xpin = 2;
int ypin = 3;

void setup()
{
Serial.begin(9600);
pinMode(xpin, INPUT);
pinMode(ypin, INPUT);
}

void loop()
{
int pulseX, pulseY;
int accX, accY;

// read pulse from x- and y-axes
pulseX = pulseIn(xpin,HIGH);
pulseY = pulseIn(ypin,HIGH);

// convert the pulse width into acceleration
// accX and accY are in milli-g's: earth's gravity is 1000.
accX = ((pulseX / 10) - 500) * 8;
accY = ((pulseY / 10) - 500) * 8;

// print the acceleration
Serial.print(accX);
Serial.print(" ");
Serial.print(accY);
Serial.println();

delay(100);
}

Do you mean accelerate the chip or just “move the chip”?
An accelerometer doesn’t return anything at constant velocity.
I doubt you’ve got long enough wires to accelerate it very far.

The simplest test for an accelerometer is to sit it still on a desk.
You should get nice steady values, maybe changing by a few counts.
Now tip it so one axis points straight downwards.
You should see a larger change on that axis - the difference between the reading and the horizontal steady state should be 1g.
Now tip it so that the other direction of the same axis points down.
Check the values agree; if you got +1g before, you should now have -1g, and vice versa.
Repeat for all axes.

I will try to do so.

But I don't suppose the code would work "just like that" when it's actually for another accelerometer (it's for the 2125)...? The PWM signal from the ADXL202E is adjustable (T2 by Rset).

Edit: Oh and of course I meant accelerate the chip... That's what I said, and I know the difference.

HI !

any suggestion, Where i can find a reference about interfacing Adxl202e with arduino ? cuz this is my first time using this sensor.

Any body would teach me to read the timing diagram ? so it will be really help me to make sketch program. THX 