I'm trying to detect deceleration when braking using the Arduino UNO and the ADXL345 accelerometer. I use the following formula to calculate the acceleration on all axes.
totalAccel = sqrt( sq(x) +sq(y) + sq(z) - sq(9.81) );
It seems to be working right, since I get 0m/s^2 when the sensor is still. The thing is how am I going to detect that the object the sesnor is on deccelerates, since the above formula returns non negative numbers.
Thanks in advance, Jim