How Do You Calculate Angles from Acceleration Data in Different Motion States?

In summary: I am trying to find the formula fororientation when device is moving. My math is not great and I am just starting out.
  • #1
IMK
63
0
Hello,

I was wondering is someone can help me please with the mathematics of forces/vectors and acceleration. Now I realize that I have a good deal to learn on the subject but as I am starting out on this venture the challenge is find the right reference,. Hence I need more than just a little help; so to the problem.

I have an accelerometer that I can read the x, y, z g forces from, and I have record two sets of data that can be found below. The first set is the static, and the second set are reading taken when the device was accelerating. The device is tiled over at 45 degrees around the y-axis thus the orientation of the device is x=45, y=0, z=45 for both sets of measurements.

I can calculate the total g force from the device thus:
sqrt(x*x+y*y+z*z) and the angle of an axis thus by the cos-1 thus 0.7 g = 45 degrees.
Now this works for the static case, but does not work for the dynamic (accelerating) case. I have tried to scale the x, y, z g forces by the total g force but the cos-1 produces an incorrect result as the orientation of the device has not changed..

Can you help?

Many thanks in advance IMK

Static Data acceleromter at rest
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
0.7 | 0.0 | 0.7 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.0 (Scale=1/1=1)
------------------------
0.7*1 | 0.0*1 | 0.7*1 | Scale each g value thus
------------------------
0.7 | 0.0 | 0.7 | cos-1 eg acos( 0.7 ) = 45
------------------------
45 | 0 | 45 | Degress
------------------------

Dynamic Data acceleromter moved horizontally
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
1.2 | 0.0 | 0.45 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.28 (Scale=1/1=0.78)
------------------------
1.2*.78| 0*0.78|.45*.78| Scale each g value thus
------------------------
0.93 | 0.0 | 0.35 | cos-1 eg acos( n ) = are incorrect ?
------------------------
21 | 0 | 69 | Degress
------------------------
As the orientation of the device has not changed these angles should be:
------------------------
45 | 0 | 45 |
------------------------
 
Physics news on Phys.org
  • #2
Not sure I can be of any help, but if it is "moving" horizontally, is it accelerating in this direction? I first tared the static measurements off the dynamic ones.

Doing so, I noted that values were twice tha value along the other, suggesting the horizontal angle (arctan=2) with respect to the 2 axes affected. But I truly have no idea of what either one of us is doing.:confused:
 
  • #3
Oh well sorry to have confused the issue.
I have attached a simple txt file with two sets of test data,
set one is the device rotated around the y-axis at 45 degress,
the other is the device laying flat.
So if anyone can figure it out I would be most greatful.

The question is how do I calculate the orientation of the device when it is moving?

Have a good Easter all the best IMK
 

Attachments

  • data.txt
    2.7 KB · Views: 357
  • #4
when moving is it free to spin? Big difference in complexity and basically insoluble I believe w/o gyro that can measure angular acceleration, problem is degenerate.
 
Last edited:
  • #5
denverdoc, many thanks for your reply.

No the device will not be spinning just simply moving from its point of rest in a direction.

Again many thanks for your help, my maths is not great and I have spent a couple of days reading up on this and have not found a formula yet.

All the best IMK
 
Last edited:
  • #6
well if it is not free to rotate, you have already done that by using your static data, as the orientation should not change if movement purely translational. Now to get direction of movement, I believe what I suggested was correct, that you must first subtract effects of gravitational field registered with static data, and then look at relations between x,y,z as I did. It suggests acceleration occurred at angle of 60 degrees in x-z plane.
 
Last edited:
  • #7
denverdoc, again many thanks.
I must have mist somthing in your 1st post, I am just on my way out now so I will look at it again on my return.

Many thanks IMK
 
  • #8
no problem, I'll be around off and on most of the day.
 
  • #9
Hi,

Is anyone still around from this old post?
 

FAQ: How Do You Calculate Angles from Acceleration Data in Different Motion States?

What is an accelerometer and how does it measure g force?

An accelerometer is a device that measures the acceleration, or change in velocity, of an object. It does this by using sensors that detect changes in movement and convert them into electrical signals. These signals are then used to calculate the amount of g force, or the force due to gravity, acting on the object.

What are the different types of accelerometers and how do they work?

There are two main types of accelerometers: MEMS (microelectromechanical systems) and piezoelectric. MEMS accelerometers use tiny springs and beams that bend in response to acceleration, while piezoelectric accelerometers use crystals that generate an electric charge when they are subjected to force. Both types of accelerometers work by detecting the changes in movement and converting them into measurable signals.

What are the units used to measure g force?

G force is typically measured in units of acceleration, such as meters per second squared (m/s²) or gravitational units (g). One g is equal to the force of gravity acting on an object at rest on the Earth's surface.

How does an accelerometer measure the direction of acceleration?

An accelerometer can measure the direction of acceleration by using multiple sensors that are oriented in different directions. By comparing the signals from these sensors, the device can determine the direction of the acceleration vector. This information can be used to determine the orientation and movement of the object.

What are some common uses for accelerometers?

Accelerometers have a wide range of applications, including in smartphones and other mobile devices for screen rotation and motion detection, in vehicles for measuring speed and detecting impacts, and in industrial and scientific equipment for monitoring vibrations and conducting experiments. They are also used in sports and fitness devices to track movement and performance.

Back
Top