Inclination measurement
The calculation of an angle with higher resolution and accuracy should take place on a PC. The sensors used are capable of an accuracy of less than 0.1°.
Since the angle values are derived from the acceleration values, which are subject to certain noise, they have to be filtered via suitable algorithms.
In simple cases this could be a sliding average value, for example.
![Inclination measurement 1:](Images/png/3626484619__Web.png)
![Inclination measurement 2:](Images/png/3626487051__Web.png)
Color | Meaning |
---|---|
Red | Angle measured with 1024-step encoder / 4-way analysis for reference |
Green | Angle trigonometrically calculated on a PC, without noise suppression |
blue | Fast algorithm |
yellow | Arithmetic mean (1000 sliding values) |
Sample
Equation for calculating the angle α:
Implementation in TwinCAT:
alpha := ATAN(a_y1 / (SQRT(a_x1 * a_x1 + a_z1 * a_z1))) * 360/(2*3.14);
Sample Program
Note | |
Using the sample program This document contains sample applications of our products for certain areas of application. The application notices provided here are based on typical features of our products and only serve as samples. The notices contained in this document explicitly do not refer to specific applications. The customer is therefore responsible for assessing and deciding whether the product is suitable for a particular application. We accept no responsibility for the completeness and correctness of the source code contained in this document. We reserve the right to modify the content of this document at any time and accept no responsibility for errors and missing information. |
To download the sample program from this documentation please click on the following link: (sample file)