Using an Accelerometer & Trigonometry to Determine an Object’s Height | via @PublicLab
Cool project spotted over at Public Lab:
So now I can convert accelerometer output to tilt angle, and more importantly, so can the Arduino. When the Arduino knows the angle, it can use trigonometry to find dimensions of right triangles. Every different tilt angle creates a new triangle in which the arm is the hypotenuse and the other two sides are vertical or horizontal. The length of the hypotenuse (arm) is known, as is the height of the arm’s pivot point. So the Arduino can compute the length of each triangle’s adjacent side and derive the height of the arm’s end above the floor (Figure 4).
Figure 4. The Arduino can derive the height of the arm above the floor because it is told two of the other three dimensions and given a good hint about the angle. It computes the angle and then the adjacent side and then the height.