Electronic – calculating inclination using accelerometer

accelerometerinclination

i have an analogue devices ADXL203 accelerometer on a breadout board and was wanting to use this to measure the inclination of some equipment at a reasonably high frequency (20-30 Hz). i am hooking it up to a campbells cr3000 logger to do the sensing. Does anyone have directions on how to interpret the sensor outputs.
thanks

Best Answer

I have a number of things to say here, and some of them do involve agreeing with pingswept and some with penjuin.

cr3000

The cr3000 sampling at 16 bits and 100 Hz is going to be sampling a little slow for you to easily remove noise from your data but at a significantly higher precision then will be usable. I doubt you can get 13 or 14 bits of precision without some pretty good filtering algorithms. Accelerometers have taught me that vibration is the devil, blasted phonons.

Output Capacitor

You need to make sure you do as the datasheet says and signal theory dicates. To quote the datasheet:

The output of the ADXL103/ADXL203 has a typical bandwidth of 2.5 kHz. The user must filter the signal at this point to limit aliasing errors. The analog bandwidth must be no more than half the analog-to-digital sampling frequency to minimize aliasing. The analog bandwidth can be further decreased to reduce noise and improve resolution.

This means you need to pick a capacitor to keep your rate below 50Hz. If you place it above this you can get aliasing, and aliasing makes vibration noise a devil you signed a deal with. They state how to calculate the noise levels from the device, and at a 50Hz bandwidth a peak to peak noise of .006 * Gravity will not even be noticed if you have this on a device with vibrations.

Interpreting Data

This is probably what you are most interested in, and is relatively easy to do. You need to tag a time that the device is at neutral, this being when it is flat and you have it relatively still. Give it a second or two at this point, and then you can take the median of this data to determine the no-G voltage. Then you can use this as a point you compare the device to. Now, from this point, I can directly quote the data-sheet:

When the accelerometer is perpendicular to gravity, its output changes nearly 17.5 mg per degree of tilt.

So you can just simply use this approximation if you are not going to tilt very much, but you will need to use geometry if you plan to tilt in both direction and in angles that are not extremely small.

If you are going to be going larger, they even have the equations spelled out as:

PITCH = ASIN(AX/1 g)
ROLL = ASIN(AY/1 g)

As far as I can tel your device gives a 1V change per 1G of acceleration placed on it. If you have done the calibrate phase, then you should be able to take measurments, subtract the offset, and you have the number of Gs being experienced.

Stop Reading Here unless you run into issues or you would like more information to improve approach.

I added a decent bit more talking about other approaches and methods to improve your approach for fast changing systems or systems where you are going to program the device doing the samples.

Sampling Frequency

You need to be sampling significantly faster than the speed at which your device changes the directions in which it is accelerating, as you have to measure orientation 20-30 times per second. you need to be able to measure quickly enough to filter out vibration noise and acceleration due to other affects, which i have found to be quite large when working with an accelerometer.

3-axis accelerometer

Second, if you have a three axis accelerometer, then you can quite easily recognize when one axis is losing part of the acceleration due to gravity(ie. When the z axis has it's magnitude drop by 2m/s^2, you know that the gain you saw on the other axis is gravity). This will still be messy, but in general there will be an addition of acceleration which gives the velocity needed to change your orientation and then a change in acceleration due to orientation change, often allowing you to recognize orientation.

Problems with 2-axis

This is going to be, as penjuin said, almost impossible with a 2 axis accelerometer, and sketchy at best if you have a system that can have 20-30 different orientations a second, or if you need to have an exact measure of orientation at all times. I am sure a master's student could write a pretty nice thesis on this, or a Doctorate could write a dissertation on improving this algorithm.

Vibration Noise

To add more, if you can put your device on top of something that will keep it statically locked to the motion of your device, but dampens vibration, you will get much better numbers and not need as much software filtering. Some simple foam type padding can be placed between the accelerometer and your device, and if it is digital this should not increase electrical noise and help absorb some vibration noise. This should only be done if you see problems with the vibration noise.

Digital Accelerometer

I would suggest a digital accelerometer that you can use SPI to connect to. Data can be clocked out at a very very high rate and you can work in the back ground as your SPI does the constant work of loading the next set of values. You will need to have a nice microcontroller if it is going to be done digitally. If you can give me better specifics on what you are wanting to do I can give better feedback. If you want a warning based on tilt detection then it should be very easy to do with all analog, but if you want to measure the position and angle of equipment during operation, get ready for some work.

Please let me know if there is something I can add to make this answer more clear or applicable to what you were looking for.