ADXL345 data smoothening

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.

Just to add a little more into your pot of misery I think I can also see some of the 'spikes' in amongst the normal noisiness that can be expected. See http://forum.arduino.cc/index.php?topic=183407.0

After removing the spike in my code I then smooth the data by replacing the raw value with one calculated using

f = (f*0.50) + (f0*0.3) + (f1*0.2);

where f is the raw, f0 the previous reading (smoothed) and f1 the previous previous (smoothed) reading. Its a very glib smoothing filter and I'm playing with it all the time and watching the responsiveness on a plot like you have been. It will do for my project but maybe not for yours.