Would a kind soul help me with a little push in the right direction to solve my problem?

I have one of the new Mini IMU’s. I am going to mount it to a child’s play toy that looks like a tire rope swing where the tire/ring is suspend by a rope extending up through it’s center with it’s diameter parallel to the ground. The tire/ring can spin in the axis and move like a pendulum.

I would like to determine the lowest point on the tire/ring circumference from the data coming from the IMU. Lets say I have 100 equally spaced fixed points around the outside edge of the tire/ring. I would like to calculate that point while the IMU is spinning and moving in space.

If you already have working code to give you an idea of which way “down” is, and you know some vector math, you can calculate the lowest point pretty easily. On the other hand, if you do not know any vector math, you probably will not understand the explanation I am about to give, so I do not think it is too likely to be useful to you. But I will give it a try anyway!

Let’s call d a vector pointing down towards the ground, and say that x and y are two perpendicular unit vectors that define the plane of your ring. For example, you could let x be the direction the child faces and y pointing to his left. The projection of d onto that plane points in the direction of the lowest point. So, if you are looking for the angle a of the lowest point, you should use dot products:

tan a = y·d / x·d

Note that if you just try to solve this equation, you get two possible values of a with different signs. A super-useful standard function in C and other languages for computing a with the correct sign is atan2. That lets you find it as: