user62210: I'm trying to make a wearable motion sensor using ESP32 board and ADXL335 Accelerometer. 
Presently when I'm serial printing the output I'm getting the tilt value as well, which have different values at different orientation (I'm printing average of the X,Y & Z). So when I try to light up an led by setting a threshold the average value is different in different orientation.
Is there way to get values only during vibration and be zero when there is no vibration/body movement.
Thanks in advance guys for the help.

user405: Acceleration is a vector quantity. Therefore, instead of looking at the average values of X,Y, and Z, you should probably look at the magnitude of the acceleration vector, that is (X^2+Y^2+Z^2)^0.5. Then, you can set an acceleration threshold below which you would send no data.
The benefit of using the magnitude of the acceleration vector is that it is independent of the orientation of the device. For example, if you placed the device on a table along the X-axis, the accelerometer would read something like X = -g, Y=0, Z=0, where g is the gravitational acceleration. Similarly, if you placed the device on a table at 45 degrees between X and Y axes, the accelerometer would read something like X = -g sqrt(2)/2, Y=-g sqrt(2)/2, Z=0. In both cases, the magnitude of the acceleration vector is just g. On the other hand, the average values would be -g/3 and -g sqrt(2)/3, respectively, as you observed in "...the average value is different in different orientation."

62210: <p>I'm trying to make a wearable motion sensor using ESP32 board and ADXL335 Accelerometer. </p>

<p>Presently when I'm serial printing the output I'm getting the tilt value as well, which have different values at different orientation (I'm printing average of the X,Y &amp; Z). So when I try to light up an led by setting a threshold the average value is different in different orientation.</p>

<p>Is there way to get values only during vibration and be zero when there is no vibration/body movement.</p>

<p>Thanks in advance guys for the help.</p>
 405: <p>Acceleration is a vector quantity. Therefore, instead of looking at the average values of X,Y, and Z, you should probably look at the magnitude of the acceleration vector, that is (X^2+Y^2+Z^2)^0.5. Then, you can set an acceleration threshold below which you would send no data.</p>

<p>The benefit of using the magnitude of the acceleration vector is that it is independent of the orientation of the device. For example, if you placed the device on a table along the X-axis, the accelerometer would read something like X = -g, Y=0, Z=0, where g is the gravitational acceleration. Similarly, if you placed the device on a table at 45 degrees between X and Y axes, the accelerometer would read something like X = -g sqrt(2)/2, Y=-g sqrt(2)/2, Z=0. In both cases, the magnitude of the acceleration vector is just g. On the other hand, the average values would be -g/3 and -g sqrt(2)/3, respectively, as you observed in "...the average value is different in different orientation."</p>
