How to use ADXL335 to detect motion or not motion.


I have ADXL335 accelerometer and I just want to know if it's moving or not moving.

For rotation i got lost of code on web but could you please suggest me how can use it for motion sensor.

I need such type of code where it just show if ADXL is moving or not.

Please suggest me some guideline.


The ADXL3xx is designed to detect acceleration, not steady state movement.


it depends on what exactly you want to do with the sensor, but in general it should be possible. The accelerometer measures acceleration (as the name suggests). So if the accelerometer is laying on a flatt surface, you'll get the reading x = 0; y = 0; z =1. Now you can assume that any derivation from those values (as long as it is parallel to the ground) means that the sensor is moving. However, if the accelerometer is not parallel to the ground at all times, you first need to calculate the current angle and estimate the values for x, y and z (you'll need additional sensors). Subsequently, you can compare your estimations with the actual values and the difference should be the acceleration.