I've looked around but can't find the answer, to what I hope is a simple question. I'm working with a TI-SensorTag, and I want to be able measure the rotation around the unit's Z-axis. Basically I want to attach the tag to a clock pendulum, lie the clock on a table so the tag and clock face point up, and to measure the angular displacement of the pendulum as it swings back and forth. I'm hoping the mental image translated well!

My understanding is that I can solve for displacement by multiplying my gyroscope readings by my sampling period, but I'm not sure how to compensate for drift. So my questions are: is my approach sound, and is the answer to drift to use the changing x and y accelerations? Or would I need to somehow incorporate the magnetometer readings?


  • $\begingroup$ I don't know if I'm having an issue visualizing this or you have a faulty plan. Is the clock going to be laying on its back, so the clock face is pointing up? That's the way I read your statement. If so, the pendulum will not swing because gravity doesn't pull horizontally. $\endgroup$
    – Chuck
    May 30 '15 at 15:04

For your application the magnetometer data are the best to use.

The accelerometer data are completely useless. The gyro data have the drift problem, but the magnetometer data are the best.

The earth's magnetic field can be seen like some kind of vector field. Any place on the earth is a specific field, which you can calculate on this webpage:
So basically the vertical component is useless for you application. In addition, you see, that east component is way smaller than the north component. So you can neglect the east component. The rest is applying a simple trigonometric operator on the measurement and you are done.

  • $\begingroup$ Like @TobiasK, I've also found that the accelerometer is pretty useless. $\endgroup$ Jun 2 '15 at 19:37
  • $\begingroup$ This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. $\endgroup$
    – Mark Omo
    Jun 3 '15 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.