Arduino IMU - Calll For Help

Hey Guys,

For a project, we're looking into feeding "Yaw and Pitch" values to a two-axis servo setup. (

The idea is: we put a sensor on the head of a person. And a robot, thanks to this servo setup, folows the head movements of that person in real time. (yaw and pitch).

So we have the servos are another matter all together. We tought we could get away with just a two axis accelerometer / or maybe a two axis gyroscope (like the wii motion plus).

It turns out to be way more difficult then that. So now I'm starting to believe we might need a 9DOF sensor package, and some really confusing code to boot. (Kallman Filters?)

So this: seems like a solution now:

There's working code written for that one, but it's way to expensive for our budget.

So - Yaw and Pitch from somebody's head. That's what we need. A small sensor would be ideal. But it seems to be difficult and expensive.

Anyone among you who has built something like this? Care to send some wisdom my way? Thanks!



it seems to be difficult and expensive

These terms are relative.

Yaw almost certainly requires a gyro, I think. Pitch could probably be done with an accelerometer. How about a 6DOF board from the same people? Less than half the price of the 9DOF. (Please don't bump after less than a day.)

Pleas don't bump at all!

Allright, Sorry for that bump. Thanks for the answers.

So far i figured out:

  • I need an accelerometer on one axis to read the "pitch". On the Z-axis, right?

(Altough probably the lowest cost solution would be to tape a bend sensor under the chin of the subject.)

  • Then I would need an Gyroscope in the XY plane to read my "yaw".

Gyroscopes "drift" however, so they need to be corrected.

This is in the price range ->

However, I can't find any Arduino examples to "extract" any usefull values out of it... Also, this board has no way to correct for the single yaw gyroscope, i think? Or does it?

The alternative would be an electronic compass. However, since we'll be mounting this thing on somebody's head, it would have to be a "tilt compensated" one. And those are again too expensive.

Could a Three-Axis magnetometer be of any use in my scenario? Could that provide yaw data in a very "difficult" enviroment? (It's a theater, lots of speakers, metal and the likes)

The Pitch is not a big problem. I could get accurate readings from a two-axis accelerometer, I assume.

The big problem is yaw, since gravity can't help me out there.

Gyroscopes "drift" however, so they need to be corrected.

Well, there are some obvious constraints and sanity checks you could apply. If you find your head yaw exceeding about pi radians, time for a reset!

This is just a thought. how about a compass module? like this one: I never used one, so no experience here, but I think this could be used as the head turning sensor if the 'victem' holds it's torso still.

Hey Guys, Thanks for the input so far.

I used a WiiMotionPlus (3 axis gyro) and Knuckles awesome work and

To get things going. Drift is not so much a problem, because we plan to use it more as a sensor then a (rc airplane) imu. A reset button turns everything back to zero when pressed so all the drift gets canceled out.

Here's my sloppy code ->

Thanks for helping me out again!

Now, I have another request. Using the code I just posted.

Whenever I plug in the power (or usb) to a Arduino and let it "cold boot", the Wii Motion Plus does not return any useful data.

I have to reset the Arduino first, after that everything runs like a charm.

I don't get this. Cold boot or not, shouldn't the Atmega be doing the exact same thing?

I tought that maybe the WM+ had some sort of start up delay after the power came on. But even when I inserted a 10 second delay as the first line in my setup code, the same thing happened.

Anyone got any explanation for that?

Cheers, Jim