When you come to filtering the accelerometer values, you could do this on the Arduino or the server, you just need a low pass filter. That looks a bit like this:
// Adjust alpha for the level of smoothing.
#define alpha 0.8
void loop()
{
static double lastX = 0;
double newX = readAccelerometerX();
double smoothX = alpha * lastX + (1 - alpha) * newX;
lastX = newX;
// ditto for the other 2 axes
}
I would tell you that the algorithm is called lossy integration, but I've been told that's pretentious ![]()
Anyway, its nice and easy to code.