Inclinometer using a three axis accelerometer

Thread Starter

loooooooooser

Joined Oct 29, 2020
2
Hey, i've built an inclinometer using an MMA8452 accelerometer. And it works.
But, i would now like to add the ability to zero out the device and measure the difference in tilt from that point.
I first read the values of roll and pitch from the desired position and then subtract that from any new measurement.
As expected this creates issues when the zeroing point is close to the 180 degree mark. Is there a way to make something like this work with only one accelerometer?
attached are the equations i am using
thanks
 

Attachments

jpanhalt

Joined Jan 18, 2008
10,515
Welcome to AAC,

The Memsic MXD2020E was a 2-axis accelerometer (https://datasheet.octopart.com/MXD2020EL-Memsic-datasheet-11764527.pdf ) It was used in a Sears brand torpedo level about 15 years ago. Notice that the sensing element is a heated gas.

I gutted mine to get the part and study its SPI output. Here's the open unit (left); my PCB is shown next to it (right):
1603983382967.png 1603983692770.png

Sensor is upper left. MCU is the black rectangle. I only used one axis and found it to be quite sensitive. The Sears level used both axes, as one would usually do for a carpenter's level:

1603983551126.png

So, is it possible to just use one axis? Yes, but I would examine why you want to do that. Today, the sensors are smaller and even 2-axis sensors may not be made.

Regards,
 

jpanhalt

Joined Jan 18, 2008
10,515
Can you elaborate on what you mean by zeroing? The device I mention is quite sensitive. I made it approximately level and zeroed it with code.
 

jpanhalt

Joined Jan 18, 2008
10,515
Is there a way to make something like this work with only one accelerometer?
Re: Euler angles and gimbal lock: I sort of see what you are saying, but if you are headed straight down in an airplane, whether you use the rudder (yaw, z-axis) or elevator (pitch) makes a big difference. Been there. I don't quite see it.

Re: TS
Sorry, I interpreted "one accelerometer" as meaning each axis. Obviously, you were looking at the "accelerometer" as a 3-axis device, and I was looking at the accelerometer you are using as three, one-axis devices. If you are anywhere near level in one axis, I can't see why using what every carpenter uses to adjust his level (when carpenters were men and levels were adjustable :) ) can't be used. Your reference plate does not need to be level, only reproducible.
 
Last edited:

RobertPink

Joined Sep 25, 2020
6
Hey, i've built an inclinometer using an MMA8452 accelerometer. And it works.
But, i would now like to add the ability to zero out the device and measure the difference in tilt from that point.
I first read the values of roll and pitch from the desired position and then subtract that from any new measurement.
As expected this creates issues when the zeroing point is close to the 180 degree mark. Is there a way to make something like this work with only one accelerometer?
attached are the equations i am using
thanks
Take a look at this paper from Analog Devices. It seems to sum up just about everything you need to know, though it may not have an easy solution for you.
https://www.analog.com/media/en/technical-documentation/application-notes/AN-1057.pdf
 
Top