Arduino 3DOF Head Tracker

You may be interested in this paper http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-696.pdf which describes use of current MEMS devices for inertial navigation ("strap-down INS") and the negative impact that the relatively large errors of today's MEMS devices has on that application.

I came across this while looking for solutions to obtaining speed and distance from acceleration. My current code for this is:

       old_accel = xaccel;
       xaccel = xfilt * xg_per_unit * SPEEDUNITS;
       xdeltav += (xaccel - old_accel)/2;
       xspeed += xdeltav;
       xdistance += xspeed;

See my code submissions previously for the meaning of the variables.

The calculations seem to work out, but even very tiny amounts of tilt cause the appearance of acceleration due to gravity. I somehow need to factor this out, perhaps by using the pitch, roll, and vertical values calculated earlier to measure the amount of tilt and do some calculation to remove it from the acceleration xfilt. Or perhaps by simply ignoring small variables (+/- 2 or 3 degrees) of tilt.

lol sorry if i'm coming out of nowhere, but where did you stumble on those part's you showed in your first post? i'm looking for an inexpensive gyro or accelerometer... i'm on a budget lol

Big,

See this: RC Groups - View Single Post - DIY head tracker from cheap heli gyro (seems to work!)

Mike,

Thanks for the paper, interesting reading!

I had to use some high pass filter for my gyro because not only does it need to be calibrated at the start, it will drift slowly due to temperature, voltage changes. If you have a better quality gyro, it might not be a huge problem.

As far as the sampling is concerned, I think the number of samples is less important than how long you sample. So your method is probably better, I was lazy so I used a simple for loop!

Cheers,
-Z-

I think you are right about the gyro quality, I have used a different one in our FRC group and it does drift. In fact it also features a temperature output - which seems like a useless thing, but I suppose it could be used to calculate a temperature-compensation value.

There is another paper in the DIY Segway project about using gyro and accelerometer together to improve accuracy, without sacrificing speed or needing to compensate for drift. Both high-pass and low-pass filters are used, in something he calls a 'complementary filter'.

Go to http://web.mit.edu/first/segway/#misc, click on Technical Documentation, download the segspecs.zip file, open filters.pdf.

Here is my Visual Studio 2005 project which interfaces the Arduino to Flight Simulator X, to control the cockpit camera - pitch, roll, and rotation.

It communicates with FSX using SimConnect which is supplied on the FSX SDK - that is found on the FSX Deluxe CD.

http://www.sunsys.net/arduino_images/Cockpit Camera.zip

Zitron, If you want to help me put together a board ill Order 2 and send you one for free...

I thought about making an arduino shield, but the i would prefer to have it as small as possible and just run a wire since its going to be on top of your head or glasses.

We can use the LIS302DL - $12.95 sparkfun
and the LISY300AL Single axis Gyro - $11.95 sparkfun

that lisy300al should give you about 100x better capabilities of controlling drift.

Hi,

Thanks for the offer, but I have no prior experience in designing PCBs, so I'm not sure how I can help. You are free to use any code that's posted by me however you want though.

Cheers,
-Z-

I would just attach the gyro and accelerometer carrier boards together on some prototyping board, perhaps even to each other, and package them in a little box or inside the brim of a hat? Speaking of hats - use a Lilypad Arduino? Or an Arduino Mini?

I've had problems with static hanging my computer, particularly it happens while loading code into the Arduino but at other times also. Static buildup must be worse with a longer cable, make sure to use shielded wiring to the head part.

How about adding a Sparkfun bluetooth device and wirelessly sending the gyro/accel readings to the computer?

Documentation for the ones I use recommend positioning the devices as close as possible to the microcontroller - let us know what happens with longer wiring runs.

How about if i build it. ill send you one and you can code it?

any one building the head tracker and camera mount for sale? I would love to build something like this myself... but dont have much time to learn how to program and do the electronics necessary for this...

if you can private message me with a price... thanks.

Hi,

There are many FPV (First Person View, for flying RC planes) shops online that sells head tracker, cameras, wireless transmitter, goggles and everything else. The reason why I'm doing a DIY is because head trackers are very expensive ($150-200), if you just want to buy a whole setup, look here: What to buy for video piloting. Updated November 20th 2010. - RC Groups.

Good luck,
-Z-

zitron - Any chance I can get a copy of your plotter code. I'd like to incorporate it as a debug test form in a application of mine.

I like to extend it so it could take input from serial and my application at the same time.

Please let me know...

Danrens,

My laptop that had the old source code was stolen, but I was able to find a backed-up old version of the program that only allowed plotting of one input. My programs are written in Delphi 7.0, using someone else's plotting component that I don't have source code for. Would that work for you?

-Z-

...Wondering if you have any advice for me. I'm attempting to link the rotation of a physical object with a gyro/accelerometer in it, to a 3-d model in Processing. The trouble I'm having is that the rotation around the X and Z axies works when there is no rotation around Y, but when you rotate 90degrees around Y, the movement on the physical model now doesn't correspond anymore(reversed). Am I doing something wrong? Or is there a way to correct this?
Thanks!

you might be interested in my approach to track yaw.
i've made my own tilt compensated compass.

compare:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267295038

Arne

Did anyone else have problems with the code posted by MLuckman?

The code provided by MLuckman is supposed to read:
void PrintTerms( int t1, int t2, int t3, int t4 )
{
Serial.print(t1);
Serial.print(",");
Serial.print(t2);
Serial.print(",");
Serial.print(t3);
Serial.print(",");
Serial.print(t4);
}

When compiling the code I am getting the following error message:

In function 'void loop()':
error: too few arguments to function 'void PrintTerms(int, int, int, int)'

Unfortunately I am too new to this to understand how to fix it. Help?!

MLuckman code cited is here:

http://www.sunsys.net/arduino_images/LISY300AL_MMA7260QT_Filtered100Hz.pde

Dear Friends

I need to connect the arduino with FSX
some program you guys use? It is by FSUIPC?
My job is to receive information from FSX
and show the displays LCDS.
If you can help me, thank you.

Levi

Can you help me out how you wire the gyro on the arduino. I have the same gyro. i just want to experiment with it but i couldnt make it to initialize. Been googling for hours to find an answer. Im a newbie in arduino and electronics, but i do have some soldering skills and some basic electronics knowledge.