Hi,

I am collecting readings from an ADXL345 and in order to find the resultant displacement vector, however when i collect only the x (or y, or z) axis reading without even slightly moving my ADXL345, this is what my x axis reading looks like with noise due to its resonant frequency :~

To find a resultant displacement I am using the following equation : (though I should be using sqrt instead of log!)

```
int x,y,z;
adxl.readXYZ(&x, &y, &z); //read the accelerometer values and store them in variables x,y,z
Serial.println(log(pow(x,2)+pow(y,2)+pow(z,2)));
delay(0); default sampling frequency set by microcontroller
```

which gives me a graph like this:

If i take sqrt instead of log in the last line of the source code like this:

```
Serial.println(sqrt(pow(x,2)+pow(y,2)+pow(z,2)));
```

it gives me a graph like this:

If i now add a custom sampling frequency so that my code is now like this:

```
int x,y,z;
adxl.readXYZ(&x, &y, &z); //read the accelerometer values and store them in variables x,y,z
Serial.println(sqrt(pow(x,2)+pow(y,2)+pow(z,2)));
delay(500); take sensor reading every 500 ms now
```

i get a graph like this:

I need a minimum of 100 samples/second or more. I have been reading about Kalman filters and complementary filters that involved a gyro sensor, as such I could not figure out head or tail of the code given there. Can anyone help me out in smoothening my readings for the accelerometer only?

P.S I do need to keep my accelerometer reading sensitive to changes of +- 0.1g.