Gyroscopic Head Tracking

Hey guys,

I'm currently building an RC plane and am going to use an on board FPV (First Person Video) camera. The camera will be controlled using three servos that rotate the camera in the up, down, and side tilt directions (x, y and z) based on the movement of the pilot's head.

The pilot will be wearing goggles with a MPU 6050 3 axis accelerometer and gyroscope that will collect rotational data, send it to the plane's Arduino, and the on board Arduino will change the position of the camera.

The code is currently working fine, but it's not optimized and I know it could work a little better.

I would really appreciate any tips or suggestions! (the code and schematic is attached below)

Thanks in advance!

HeadTracking_Gyro_TEST.ino (6.75 KB)

Does this tutorial help you? Tutorial · Razor-AHRS/razor-9dof-ahrs Wiki · GitHub

Without a clear problem description its kind of hard to find a way to fix things.

Thanks, but it doesn't help.

The code I'm using works, I just need it to be more efficient and a little more accurate (the servo positions don't change quite exactly as they should).

I know it's not a very clear problem; I would just like an extra pair of eyes to see if I could rewrite or delete some of the code to make it faster and more efficient.

To get a better idea of what I'm doing, check out my instructable: http://www.instructables.com/id/Gyroscopic-Arduino-Head-Tracking-Unit/