Head/canon Tracking

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


New Member
I found a few things that might be interesting to everyone its a head tracking unit using gyros that transmit to servos its 40 bucks but might need to be modded but would work great for cannon movements and tracking thats pretty high tech. the second link is for a pan/tilt camer housing you can mod for a canon set up with servos for 5 bucks. let me know if anyone buys this im curious how good it works http://www.hobbyking.com/hobbyking/store/__14628__X_Gyro_500_Single_Axis_Head_Tracking_system_.html


Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


New Member
The gyros are predominantly used in RC helicopters, I have a Telebee in mine. It used up a channel on the radio and controls tail rotor pitch to keep the helicopter from rotating when not signaled to. Apparently, they're using it for RC drift cars too.

Honus is a member here too, with the same screen name.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


New Member
asgaurd that set up is not just a adreno. he has to have a few gyros on it to work it thats what all the wires are for. here is a video of someone using it alote like your video but a easier set up without using adrenos http://youtu.be/GCd5sVdRa6k


New Member
I like the X gyro 1000, it can be set up wireless and gives you the same functions as the movie cannon for about 50.00 (y)


New Member
Just so you guys know, Honus is completing his work on an animatronic/ sound system for my new backpack and cannon. It will function the way it does in the movie, as shown in his You Tube video featured in asguard's post above.


New Member
Yeah- what Carl said! LOL...

The cheapo gyro setup is neat but it will not perform like what you see in the movie. It'll work fine as long as you don't walk around while using it or twist your body. Gyros only sense rate of change in angular motion- what you don't see in the video is the guy moving his whole body, he keeps his lower body still. If you had that gyro setup and you rotated your whole body as you were walking down the hall at a con the cannon would still rotate, but not relative to your head motion. Think about that for a minute.

To accomplish true accurate head tracking using a gyro you also need an accelerometer to form what is called an IMU ( inertia measurement unit. ) And you would need two multi axis IMUs ( pitch and yaw ) to make it work right. One IMU at the cannon base and another IMU to read head inputs with some complex code/algorithm to compare the two to get accurate head tracking vs. whole body movements. Things get really expensive and complex really quick. The cheapest setup would be to hack a Wii motion plus with a Nunchuck- good luck getting it to fit in a Bio as they have to be properly placed to work correctly. I have both on my workbench...

To this system you still need to integrate the cannon arm mechanism, laser sight and cannon firing LED and sound for a P1 setup. Getting a cannon to move is easy. Getting it to move like in the movie while walking around ( or at least create that illusion ) and having it easy to operate by a guy wearing a costume is a whole different ball of wax.


New Member
So what price range estimate would this entire system cost? Any ETA of completion and availability for Carls and other backpack/cannon combos? Thanks, looking forward to see this completed, it's far more complicated than the movie used.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


New Member
Hey guys, I have been using 2 spartial 3/3/3 usb boards from phidgets.com. One mounted on the cannon and the other one inside your helmet. They have a wide range of software examples for them and they give you all the gryro / acceleration / compass data you need, combine all this with a phidget 1061 - 8 x servo controller and a laptop and wham you have the system to track both the helmet and cannon position. Use the data from the helmet and compare it with the data from the cannon and you can set the center to 90 degrees left and pitch / roll of the helmet, hope that makes sense or at least helps?


New Member
Pricing for the P1 system has not yet been set as I haven't been able to install in Carl's backpack- there's always a lot of little things that come up ( wiring, connectors, etc. ) during the installation process. I can say the controller cost is $90 for the main controller board if you want to build your own system from scratch. Once it's installed I'll get into all the details about how it can be configured- it's a super versatile system.

The Phidgets set up is exactly what I was talking about using two IMUs. You're talking about $400 just for the basic electronics, not including any other hardware, batteries, servos or sound board.


New Member
Yeah Honus, I must say I have spent some money on this system, plus having to ship it in from the US doesn't come cheap either! I do like your system though, good stuff!!


New Member
Yeah Honus, I must say I have spent some money on this system, plus having to ship it in from the US doesn't come cheap either! I do like your system though, good stuff!!
With modern electronics it's pretty amazing what you can do. A system like what you have would have cost a fortune ten years ago. Is it run using a netbook or a micro?

One idea that is pretty neat is face tracking- http://www.sparkfun.com/tutorials/304

It would require a netbook (or a fairly powerful processor- maybe an Android phone using the IOIO board could do it) but I think it would tough to implement in terms of practical use. Realistically I would get the same visual effect just by writing code that has the cannon move in a couple of pre programmed patterns, which is one of the options I'm doing for people that want something simpler than head tracking. Just push a button and the laser sight will turn on, the cannon will unfold and move around, fire and then fold back down.


New Member
Sorry for bumping an older post, but I thought that I'd re-spark interest in this thread in the hope of updates/progress regarding this topic...

I'm very interested in tinkering with a Raspberry Pi, Arduino, etc. setup and this seems like an ideal project! My idea was to integrate a touch-screen GUI (perhaps mounted into a gauntlet?) with a motion tracking turret system, sporting a concealed camera unit.

Preferably, the whole system would draw power from batteries (4~5 hours+) that would be small and light-weight. Communication between the gauntlet and turret unit would be wireless, or at least connected via a small, single cable that could be concealed.

The system would feature different modes, controlled from the gauntlet interface (or integrated with a control panel that mimics something more screen accurate):
  • Head-Tracking - The caster follows the motion of the user's head (I.E. bio-mounted motion tracker, also wireless?).
  • Face-Tracking - The caster follows faces seen within the field of view.
  • Manual Control - The caster responds to direct interface control.
  • Manual Face-Tracking - The user manually selects faces from the GUI screen to track automatically.
I guess this could be combined with lights and sound for additional effect.

My initial research shows that a wireless setup could be built using an Android device in the gaunlet (with RF module or built-in Wifi) and a receiver system at the caster end, built into the shoulder unit. Wired would be less power-hungry though. There are all sorts of tracking/control systems out there too (OpenCV, etc.) that could be installed on a slimmed down system.

I guess the real task is in bringing it all together and putting some sort of graphical app' on the android device, then prettying it all up for a costume!

Any ideas? Has anyone got anything like this up-and-running? Am I over-complicating things?...

Intergested on people's thoughts. :)

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


New Member
I have not posted in a while. I have been in school getting my Electronics Engineering Technology degree. But I have been working on this and a Predator costume in my spare time.
Well, I came up with the cheapest way I could think of. I attached a video of what I have so far.

Here's the breakdown:
A cheap plastic squirtgun from Wal-Mart. Repainted....if you want paint plastic, I suggest using a Self-Etching primer then any spray paint will stick. I spent many hours trying to paint plastic (even using that paint for plastics) until I found this primer works the best. It is usually in the AutoBody section of department stores and dries within about a day.

Arduino Uno. I love this open sourced board. You get the compiler program free with tons of examples to understand how to program the arduino (RadioShack $30). You will need to buy the cable to reprogram and power it up until you get the design set up. $10

2 ea.  Hitec 322HD servos.($10 ea, eBay)

Wii NunChuck controller ($5 to $20...cheapest on eBay). For the price you can't beat getting a built in accelerometer, Joystick and buttons.

With my current code (which is not perfect but works for now) the x axis and y axis servos respond to the Nunchuck's internal Accelerometers tilt when powered up (Auto Mode). If the Nunchuck's Z button is pressed and held, then Nunchuck's Joystick commands the servos (Manual Mode). When the C button is pressed I have two interesting things happen; I slowly ramp up a bright LED (you can't see in the video) and quickly power a laser pointer for a short time. I did this to simulate the shoulder cannon ramping up and firing. I'm just using a cheap Wal-Mart laser pointer and superbright red LED.

To power it, I'm currently using my computer via USB  but I plan on using 6 ea 1.5 vdc rechargable batteries. The batteries will put out 9vdc at 1250 or better mAh (milliamp hours) and the Arduino with servos and LEDs will draw about 60  mA per hour (rough estimate). But when the amperage is reduced about 25% it may shut down the Arduino (opertaing range is from 7.5 to 12 vdc) so 1250 / 60 =  20.83 x 0.25 ( or 25%) = about 5.2 hours until it drains enough to shut down. It could be more as these are rough estimates.

There are only two issues I'm trying to work out with the code: The jitter when the servos are waiting for movement when in Auto Mode (accelerometers) and the delays for the laser and LED stop servo commands. If I can work them out, it will be that much better.

Another thing to mention is you have to tilt your head to turn (somewhat naturally). The Wii Nunchuck has no yaw accelerometer. But I did recently learn the "Wii Remote Motion Plus" does have yaw (rotation CW / CCW) sensing so I may experiment with one to see if I can use it.

If anyone is interested, I do not mind sharing the code. If anyone wants it, just reply and I'll post it.  It took me a long time ot get the code this far but it may help others save some time. Plus I enjoy helping other prop builders. Just please keep me cited in the code. As soon as I can, I will create some schematics and post. Enjoy the brief video and any feedback is welcomed.

I tried to attach the video but it was loading too slow. So try and use this link for Youtube:  http://youtu.be/o10z1t4lcQA


New Member
Nice setup you got there ...  and i know all about the jitters  ... pain the the ass eh.

Ive been working on that same type of system for some time now and Ive been able to smooth it out so there is no jitters in the movement.. Took some time to figure out but now it works great.  Ive also put in click, double click , and click and hold on both c and z buttons to add more functionality.. i have no video of it yet as i'm still working out things

Its great to see more people working with Arduino   



New Member
DHB, Thanks. What helped me understand even getting the code to where it is was going to college. I'm currenlty getting my electronics engineering degree and had some C porgramming classes.
Below is the code I'm currently using:
I have made several changes to the switch cases to clean them up and created a single function for firing the laser, though I have not tested any of it yet.
When I do, I will repost the new code. Anyone, please feel free to use this code (just know it is not perfect).

Now, I believe the jitter issue is with the pulse width buffering (see "muovi" and "ray1" functions) or the pulse width itself. I plan on messing around with it. But the pulse refresh time must remain 20 as that is what is specified with the servos I'm using. Pulse width itself can be from 500 to 2100, and I have one set at 500 and the other at 1000.

If anyone has any pointers to help clean up the jitter, that would be greatly appreciated. Note: This will compile with no errors in the new Arduino 1.0 compiler.
// Not sure exactly where I got the original code from but if you know you worked
// on it , please cite yourself to the code below in comments.
// Here's what it does:
// Controls two servos (one for x axis and one y axis) using the Wii_Nunchuck's 
// accelerometers(Auto Mode) or Joystick (Manual Mode). When the "C" button is held, 
// the servos move via the Joystick only (Manual Mode). When the "Z" button is 
// pressed and released, a LED on pin 9 is faded up (off to max brightness) and then
// when at max it goes back off and simultaneously powers a laser pointer to ON for 
// a brief duration.
// I am doing this to simulate a Laser powering up and firing. The Laser fucntion can 
// be performed in both Auto and Manual Modes, but the "delay" stops the servos from 
// functioning (which I'm trying to currently fix).
// Everything works but the servos jerk a little when attached to the accelerometers for 
// movement and the NunChuck is not moving (servos are waiting for response from 
// accelerometers). When you move the servos by using the accelerometers or joystick, 
// it works great.
// In this version I changed the auto mode around so the the Y servo tracks the front
// of the wii_NunChuck like the buttons are a face looking left or right.
// Raymond Willis Jr. 2/7/2013 email: willisjr24@yahoo.com
// Title: Servo Turret Controls (Auto / Manual) with Laser fire using Wii_Nunchuck: v5. 

uint8_t outbuf[6];
int cnt = 0;
int ledPin1 = 9; // assign the LED pin
int laserPin = 11; // assign the laser pointer pin
int servoPin = 10;
int servoPin2 = 8;
int pulseWidth = 0;
int pulseWidth2 = 0;
long lastPulse = 0;
long lastPulse2 = 0;
int z_button = 0;
int c_button = 0;
int refreshTime = 20;
int minPulse = 1000;
int minPulse2 = 500;
int dtime=10;

int oneFlash = 1; // test only
#define pwbuffsize 10
long pwbuff[pwbuffsize];
long pwbuffpos = 0;
long pwbuff2[pwbuffsize];
long pwbuffpos2 = 0;
void setup()
    Serial.begin (9600);
    Wire.begin ();
    nunchuck_init ();
    pinMode(servoPin, OUTPUT);
    pinMode(servoPin2, OUTPUT);
    pinMode(ledPin1, OUTPUT);
    pinMode(laserPin, OUTPUT);
    pulseWidth = minPulse;
    pulseWidth2 = minPulse2;
    Serial.print ("Finished setupn");
void nunchuck_init()
    Wire.beginTransmission (0x52);
    Wire.write (0x40);
    Wire.write (0x00); 
    Wire.endTransmission ();
void send_zero()
    Wire.beginTransmission (0x52);
    Wire.write (0x00);
    Wire.endTransmission ();
int t = 0;
void loop()
    long last = millis();
    if( t == 1) {
        t = 0;
        Wire.requestFrom (0x52, 6);
        while (Wire.available ()) {
            outbuf[cnt] = nunchuk_decode_byte (Wire.read ());
        if (cnt >= 5) {
                     // printNunchuckData(); // Uncomment to print data to display- RW
            int z_button = 0;
            int c_button = 0;
            if ((outbuf[5] >> 0) & 1)
                z_button = 1;
            if ((outbuf[5] >> 1) & 1)
                c_button = 1;
            switch (c_button) {
            case 1:
                switch (z_button)  {
                case 0:
                                   if (oneFlash > 0) {
                                    for(int fadeValue = 0 ; fadeValue  0) {
                                   for(int fadeValue = 0 ; fadeValue = refreshTime) {
        digitalWrite(servoPin, HIGH);
        digitalWrite(servoPin, LOW);
        digitalWrite(servoPin2, HIGH);
        digitalWrite(servoPin2, LOW);
        lastPulse = millis();
int i=0;
void printNunchuckData()
    int joy_x_axis = outbuf[0];
    int joy_y_axis = outbuf[1];
    int accel_x_axis = outbuf[2]; // * 2 * 2;
    int accel_y_axis = outbuf[3]; // * 2 * 2;
    int accel_z_axis = outbuf[4]; // * 2 * 2;
    int z_button = 0;
    int c_button = 0;
    if ((outbuf[5] >> 0) & 1)
        z_button = 1;
    if ((outbuf[5] >> 1) & 1)
        c_button = 1;
    if ((outbuf[5] >> 2) & 1)
        accel_x_axis += 2;
    if ((outbuf[5] >> 3) & 1)
        accel_x_axis += 1;
    if ((outbuf[5] >> 4) & 1)
        accel_y_axis += 2;
    if ((outbuf[5] >> 5) & 1)
        accel_y_axis += 1;
    if ((outbuf[5] >> 6) & 1)
        accel_z_axis += 2;
    if ((outbuf[5] >> 7) & 1)
        accel_z_axis += 1;
    Serial.print (i,DEC);
    Serial.print ("t");
    Serial.print ("X: ");
    Serial.print (joy_x_axis, DEC);
    Serial.print ("t");
    Serial.print ("Y: ");
    Serial.print (joy_y_axis, DEC);
    Serial.print ("t");
    Serial.print ("AccX: ");
    Serial.print (accel_x_axis, DEC);
    Serial.print ("t");
    Serial.print ("AccY: ");
    Serial.print (accel_y_axis, DEC);
    Serial.print ("t");
    Serial.print ("AccZ: ");
    Serial.print (accel_z_axis, DEC);
    Serial.print ("t");
    Serial.print (z_button, DEC);
    Serial.print (" ");
    Serial.print (c_button, DEC);
    Serial.print ("rn");
char nunchuk_decode_byte (char x)
    x = (x ^ 0x17) + 0x17;
    return x;
void muovi (){  // This is the pre-existing auto mode that uses the x, y accelerometers to move servos
    float tilt = (700 - outbuf[3]*2*2);
    float tilt2 = (700 - outbuf[2]*2*2);
    tilt = (tilt);
    pulseWidth = (tilt * 5) + minPulse;
    tilt2 = (tilt2);
    pulseWidth2 = (tilt2 * 5) + minPulse2;
    pwbuff[pwbuffpos] = pulseWidth;
    pwbuff2[pwbuffpos2] = pulseWidth2;
    if( ++pwbuffpos == pwbuffsize ) pwbuffpos = 0;
    if( ++pwbuffpos2 == pwbuffsize ) pwbuffpos2 = 0;
    for( int p=0; p


This is good stuff!  I love my arduino, but am limited in my programming of it.  I really need to spend some more time getting comfortable with that side of it so I can do more with it.  I'll be following this one for sure!



New Member
I can discuss the coding in sections or if you have any questions, I'll try my best to explain what does what and why if you want. By really breaking the code apart, I learned alot. Another thing is to use the "Help" then "Reference" tab when you have the Arduino compiler open. The reference section describes functions and what key terms mean and do.

Even with the way it is now I have some things I want to check out.....like using a Wii Motion Plus for tilt as it does offer true Z axis (yaw or rotation CW/CCW). I found a video on YouTube that shows the person turning it and the turret turns pretty nicely.

Now supposedly I can clean up the turret jitter by using an "interrupt" to control the servos and anything else (delays and such) run along side but do not disrrupt the servos. And it is supposedly more precise with control. The way I undertand an "interrupt" is you make any additonal functions happen in between each pulse to the sevo (the low part of the pulse, where no information is sent). This is 20 ms. I need to do more investigation into this to really know how to implement it. But I will share anything I find and learn.

I love the Arduino Uno and extra stuff. I've seen people make crazy stuff using it. I even seen someone making a homemade segway using two of them. I believe there is no reason we can't use it to our advantage for props.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.