How To Get Head Tracking For Under $50

Created on Wednesday, February 23, 2011.
 

Head tracking is a method of monitoring the movements of your head and translating them into computer input. It’s an efficient and powerful tool, especially for video games, but it’s normally expensive. Here’s how you can get it for less than $50!

 

What is head tracking?

Head tracking is a method of monitoring the movements of your head and translating them into computer input. It’s an efficient and powerful tool, especially for video games, but it’s normally expensive; NaturalPoint sells their TrackIR Pro 4 bundle for $120, plus shipping.

There is a way to get this same functionality for $50 or less, though; I did mine for $20. It just takes a bit of effort, and a software suite called FreeTrack.

What are the uses of head tracking?

Head tracking is most immediately useful in video games. With head tracking you can have more control over your character, without complicating the keyboard and mouse controls further. In games that properly support freelook and/or head tracking, uses include:

  • Checking your flanks without moving the point of aim of your weapon.
  • Changing the height and angle of your posture to use cover as efficiently as possible.
  • Scanning the environment without traversing the turret you are manning.

Even in games that don’t support head tracking, you can still make FreeTrack send keystrokes or joystick movements:

  • Bind Q and E to FreeTrack so that you can lean around corners by tilting or moving your head.
  • Bind keys so that you can crouch or prone by moving your head directly downwards.
  • Jump by raising your head up as if you were doing a little jump in your chair.
  • If the game has freelook in a vehicle, bind freelook to a joystick or to keystrokes, and get FreeTrack to send those keystrokes or movements.

Here is a demonstrative video of headtracking in Battlefield 2. It has a pretty good soundtrack, too! Battlefield 2 doesn’t fully support headtracking like other games do (ArmA being the premier example), but it’s still an instructive example of its use. You’ll notice that the pilot is more aware of his surroundings, able to spot and keep track of enemy aircraft much more easily, and that flying is easier when you have the ground as a reference point.

What are ‘degrees of freedom’?

A degree of freedom describes an axis around which movement can be tracked. Here are the six degrees of freedom given by headtracking, as shown in the FreeTrack manual:

YAW: sideways rotation. PITCH: vertical rotation. ROLL: Tilting the head side to side. X, Y and Z: Moving the entire head horizontally, vertically, and closer or farther away.

FreeTrack has two different configurations which support two different schemes of DoF:

  1. Single-Point Tracking. The tracking camera monitors the position of a single point of infrared light (whether reflected IR light, or an IR LED). This model is very easy to make and gives you two degrees of freedom: Yaw and Pitch. It lacks freedom, but is sufficient for casual use in games and applications.
  2. Three-Point Tracking. There are three sources of infrared light to monitor, and the extra information allows for all six degrees of freedom shown above. It's a bit more difficult to make, but will easily serve any game or application you have, regardless of complexity.

Continue reading to find out what you’ll need to get started with head tracking.


What do you need for this project?

This article recommends that you use a Wiimote. FreeTrack does allow you to use a normal webcam, but the framerate is lower and the camera is not as sensitive to IR light as the Wiimote is, so you will (usually) get worse performance with a webcam than you will with a Wiimote (basically in terms of a slight lag, and more interference from non-IR light sources).

For the computer and receiver setup:

  1. A Wiimote. The kind of Wiimote you need depends on the precision and freedom of the tracking method you want.
    • If you want one-point tracking you can use a third-party, generic Wiimote (one made by a manufacturer other than Nintendo). They're cheaper than a genuine Wiimote, and will do fine for one-point tracking. I found one on eBay for less than $18.
    • If you want the full three-point tracking you MUST use a genuine Nintendo-made Wiimote. This is because third-party Wiimotes only track two points of light and therefore cannot read the three-point tracking model at all, whereas a genuine Wiimote can track up to four points. Cheapest I found was $30 on eBay.
  2. The FreeTrack software, which can be downloaded from the FreeTrack site.
  3. A Bluetooth receiver dongle. You can find these for peanuts on eBay. It doesn't matter if they come with Bluetooth driver software or not; we'll be using our own.
  4. The Toshiba Bluetooth Stack, which you can get from the Toshiba site. FreeTrack doesn't support the default Bluetooth Stack that comes with Windows, and BlueSoleil is a pain in the ass, but the Toshiba Stack is simple and works beautifully to receive the Wiimote. It's paid software, but you can probably find a friend who doesn't use it and ask for his key, if you look hard enough.

For a One-Point Tracking model:

  1. One 5mm infrared LED. You can buy them from your local electronics store or from eBay, and they're cheap. I bought a pack of ten for less than $5 from this eBay seller.
  2. One AAA battery holder, to fit a single AAA battery.
  3. Something to cover the wire joins, like electrical tape or (preferably), heat shrink tubing. You can also get these from your local store or online.
  4. Some styrofoam, a 1cm cube should be fine. </ol> ### For a Three-Point Tracking model: ###
    1. Three 5mm IR LEDs.
    2. One 9v battery holder/clip.
    3. One 110 ohm or 120 ohm resistor. The color code for 110 ohms is Brown-Brown-Black-Black-Any, and the color code for 120 ohms is Brown-Red-Black-Black-Any.
    4. Some plain old insulated wire for electronics, also called hook-up wire.
    5. Something to cover the wire joins. Again I recommend heat shrink tubing.
    6. A frame to attach the LEDs to. A wire coat hanger, or old cap, or some other headgear.
    7. Three cubes of styrofoam.
    Optionally, you might want to grab a USB-rechargeable battery pack for your Wiimote. You can leave it plugged into a USB socket while you're using the Wiimote, and never have to worry about batteries again. Continue reading to find out how to set up your computer for FreeTrack. *** ## Setting Up Your Computer ## ### Install the software ###
    1. Do not connect your Bluetooth dongle to your computer yet. It will make Windows install its own, non-compatible drivers. If you have connected it accidentally, you will need to delete the Microsoft Bluetooth Drivers in your Device Manager.
    2. Install the FreeTrack software.
    3. Install the Toshiba Bluetooth Stack. Sometime during the installation it will prompt you to connect your Bluetooth dongle. Do this now.
    ### Connect the Wiimote ###
    1. With the Toshiba Bluetooth tool running and your dongle connected, hold down the 1 and 2 buttons on the Wiimote.
    2. While keeping the 1 and 2 buttons held down, click the New Connection button in the Toshiba Bluetooth Settings window, or right-click the Bluetooth icon in the system tray and select, Add a new Connection.
    3. The tool may ask you if you want to connect the Wiimote as a Human Input Device (HID). Say yes.
    4. The Wiimote now appears in the connection list as Nintendo RVL-CNT-01, with a green 'link' icon showing it has been successfully connected.If you look at the lights on the Wiimote, they will still be blinking because no application is actually using the Wiimote.
    ### Test the connection ###
    1. Attach the Wiimote above your monitor, either with tape or with some sort of stand. You can get creative here; the better and more solid your stand, the more consistent the tracking will be.
    2. Start the FreeTrack software. The speakers on the Wiimote should make a sound, and the lights will stop blinking. The first LED on the Wiimote will remain lit to show that Freetrack has connected to it.
    3. Press the A button on the Wiimote, or click the Start button in the lower-right of the FreeTrack window. FreeTrack is now receiving the image from the Wiimote's camera, and the fourth LED on the Wiimote will be lit up.
    4. You can test that the Wiimote is receiving properly by grabbing a TV remote, holding down a button, and waving it in front of the Wiimote's camera. You should see a red dot moving in the right pane of the FreeTrack window; this is the Wiimote 'seeing' the infrared light the TV remote is emitting.
    ### Make a Wiimote holder ### You'll probably want to make some sort of holder to keep your Wiimote in the right place all the time. In a pinch you can use stick tape, or you can quite easily make one with cardboard. I made mine by finding a shape that would hook onto the top lip of my monitor while sitting on its rear vents, and then cutting that same shape ten times. The ten identical parts were layered and stuck together with craft glue (remember to alternate the corrugations for strength!), and a channel cut so that the Wiimote's rechargeable battery port could be used without removing the Wiimote from its mount. I then cut a slit through which a velcro strap passes to hold the Wiimote in place, and shimmed the back up with slips of cardboard until the dots of my point model were centered in the viewing area.

    Now that you've done that, you can learn how to make your point model. *** In this section: ## Making your point model ## The point model is the thing you wear on your head. It consists of a source of infrared light, whose movements are tracked by the Wiimote camera to determine the position and orientation of your head in space. There are three kinds of point model:
    1. Single-Point is just a single IR LED placed somewhere (anywhere) on your head. It gives two degrees of freedom.
    2. Three-Points Clip is a model meant to be attached to one side of your head, usually clipped to your headset. The IR LEDs are oriented in a vertical line. It gives six degrees of freedom. I recommend this one.
    3. Three-Points Cap is exactly the same as the Clip, but oriented horizontally for attachment to a cap or visor. It's bulkier because you need to wear headgear with it, and it's also a bit unreliable: If you tilt your head too far up, the LEDs will align horizontally and FreeTrack will return an NAN error because it can't clearly define your head's orientation.
    ## Making a Single-Point model ##
    1. Wire the IR LED to the positive and negative leads of the AAA battery holder. The Positive lead is connected to the Negative leg of the LED (typically it's the shorter leg, or else look for a flat bevel on the side of the LED's rim. The leg on that same side is the Negative leg).
    2. Take your cube of styrofoam and hollow out a shallow hole in it. Dab some clear glue into the hole and push your LED into it.
    3. Now you're done! You could also buy an LED headlamp and put this inside its casing.
    Here is my Single-Point model. I had the plastic battery case left over from something else, but no metal contacts on it, so I made them by twisting a piece of wire. The whole thing gets put inside the case of an old head lamp, and the reflector helps with sending more light towards the Wiimote too. I chose not to use the styrofoam in this LED because I had the reflector to help me out. You'll also notice that the LED is sanded flat to compensate for this, and increase the angle that the light can be seen from.


    ## How to make the frame for the Three-Points Clip model ## I made my frame out of a plain wire hanger. Most people make a frame that connects to (or is attached to) a headset, but I made a separate frame because sometimes it is too hot to game with a headset on here in Australia, and I use earbuds or speakers instead. This frame can be worn comfortably underneath a full headset, in any case.

    In the above diagram I show the measurements that you should take from a wire hanger. You cut only on the red lines, and what you end up with is a mostly intact hanger, with one 16cm length of wire cut out of it. Part (D) will become the ear loop, which you will bend so that it wraps around your right ear and anchors the frame to the right side of your head. Part (A) is the supporting arm that will hold the actual LED frame. Part (B) is the LED frame, which will be bent to the dimensions that are show in the Three-Points Clip configuration page. Finally, Part (C) is the headband. Curve it around the top of your head. You should end up with something like this:


    The easiest way to bend Part (B) to the proper dimensions is to grab a piece of graph paper and draw the dimensions below onto it. Then bend the wire and compare it to the drawing as you go. Once it is bent, attach the finished Part (B) to the supporting arm, Part (A) with tape and glue.

    ## How to make a Three-Points model ##
    1. Arrange your LEDs on your frame (in the above picture the LEDs are where the lumps of styrofoam are) and wire the LEDs together. Positive leg connects to Negative leg, and vice versa. Keep a fair amount of free wire at the ends of the chain of LEDs.
    2. Wire one leg of the Resistor to the Positive lead of the 9v battery holder.
    3. Wire the other leg of the Resistor to the Negative leg of the chain of LEDs.
    4. Wire the remaining Negative lead of the battery holder to the remaining Positive leg of the chain of LEDs.
    5. Secure all of the wires to the frame to prevent pulling and unravelling.
    6. Take your cubes of styrofoam and hollow out a shallow hole in each. Dab some clear glue into the hole and push a LED into it.
    7. You're done! Measure the positions of the LEDs according to the diagram, and if the measurements are different, update the values in the FreeTrack model screen.

    Read on for extra notes about making a point model, or to find out how to use the FreeTrack software with your new point model. ## Notes on making a point model ## These are some extra things you should probably know about making a point model. ### How to check if your LEDs are working ### Since IR LEDs emit light in the infrared spectrum, their light is invisible to humans. To check whether your IR LED is working properly, you can look at it directly from the top using the screen of a digital camera, which will show the infrared light as a purplish glow. You can also wave it around in front of your Wiimote, of course. ### How to wire components together ### I'm just mentioning this in case anyone needs clarification. Even if you're going to solder a connection, the wires still need to be joined with a mechanically durable connection. This is how to properly connect wires together: First, some insulation is stripped from the end of the hook-up wire. The exposed strands are twisted together, then tightly wound around the middle of the component's leg. The leg is then folded over to sandwich the wire strands and hold them.

    The connection is then tightly bound with heat shrink tubing, or with electrical tape. For a project like this, which won't really see any hard use, we can just do this and ignore soldering.

    ### Why did I say you needed styrofoam cubes? ### IR LEDs have a very narrow field of view, typically only 20° or so to the front. This means that if you turn your head even a bit, the chances are good that no IR light will hit the Wiimote camera, and FreeTrack will lose your head position. You can kind of fix this by sanding down the tip of the LED so that its top is low and flat, but this is a lot of work for no real payoff. The best solution I've found is to get a small cube of plain old styrofoam and bury the LED inside it. The LED lights it up entirely, creating a soft diffuse light that can be seen from any angle. It's the same idea as putting an LED inside a ping pong ball (we can't use ping pong balls on our point models because they're way too big!). ### My resistor is heating up quite a bit! ### That's quite normal, so don't worry too much about it. Continue reading to find out how to use the FreeTrack software with your new point model. *** ## Using FreeTrack with your point model ## This is just a quick run-through of the functionality of FreeTrack. Most of it is self-explanatory once you figure out what you're doing. ## Calibration ## Firstly, you'll want to make sure that your point model is lighting up properly, and that all of the LEDs are being read by FreeTrack.
    1. Start FreeTrack with your Wiimote connected and ready to receive.
    2. Power up your point model and wear it on your head. Make sure you have given FreeTrack the proper dimensions of your point model in the Model screen.
    3. Press the A button on the Wiimote, or click the Start button in FreeTrack to begin tracking. You should see one dot if you're using a Single-Point model, or three dots if you're using a Three-Points model.
    ### What if I see more dots than LEDs? ### In FreeTrack's Cam screen there is a slider labelled, Threshold. This changes the Wiimote's sensitivity to IR light; move it around until it shows the correct number of dots. ### What if some dots disappear when I move my head? ### It means the something is blocking the Wiimote from seeing it. Usually it's because you've turned your head too far, and your face is blocking it. In this case, you can try moving your face. Failing that, adjust the angle of the arms so that the LEDs have more distance between them, and try wearing the model a bit more forward. At some point the LEDs will either block each other or be blocked anyway, so we need to tweak the sensitivity to avoid this. ## I moved my chair and now my freelook is messed up. ## To fix this, click the Center button in the bottom-right of the FreeTrack GUI, or if you're in-game, press the Center shortcut keys. By default it is Ctrl+F12. ## Sensitivity and Smoothing ## In the Profile screen, create a new profile and name it whatever you want. You'll see a bunch of sliders labelled, Sensitivity, and some sliders labelled Smoothing. Let's fiddle with them. To test the effects of each, go back to the Cam screen and in the lower-right corner, open the drop-down list and select First Person. This changes the sample view to a first person view, like you'd be using in a game. If you turn all of the Sensitivity sliders up to max (3.0) and look around in First Person view, you'll notice that you look farther with smaller movements, but that each movement is rather jerky. By turning Smoothing up, we can get rid of this jerkiness. ## Dead Zones ## If you hold your head still, you may still find that your view moves around, and furthermore, that it's quite hard to come back to the original centered, neutral position. You can fix this by defining a dead zone. Go to the Curves screen. You'll see two tabs, Rotation and Translation, and three graphs in each tab. Each one controls the dead zone and scaling of a degree of movement. Right-click one of the graphs and you'll see a couple of options. Linear is the default behaviour. To define a dead zone, select one of the Deadzone options, and the graph will change accordingly. ## Output options ## Of course, all of this is for nothing if the game or application can't figure out what you want to do with your head movements. The Output screen shows you all of your options. Quite a few games support TrackIR and/or FreeTrack interfacing, which sends your heads movements directly to the game. This requires no setup and works quite well. For most games, though, which don't support either, the Keyboard tab will be your best bet. In it, you can tell FreeTrack to send a particular keystroke whenever your head reaches the vanishing point of an axis. This one bears some explanation. Notice in first person view, when you turn your head completely to the left or right (or up and down) you see the blue line disappear into the horizon. On certain sides there is a letter indicating the axis you're looking at.

    This is the vanishing point of that axis. Any key you bind to a yaw or pitch axis only gets sent if you yaw or pitch your head so that these points are centered in your view. Likewise, the green bounding box represents the boundaries of the X/Y/Z axes, and any keys you bind to these axes will only be triggered when your head 'touches' this bounding box. Of special note to users of Single-Point models is that since only yaw and pitch are supported by their models, only keys mapped to yaw and pitch will be triggered! Aside from these outputs there is also mouse emulation (which you probably won't be using in games), and joystick emulation via PPJoy. ## Setting up PPJoy ##
    1. In your Start Menu, go to FreeTrack -> PPJoy and start the installer.
    2. When installed, go back to your Start Menu and find Configure Joysticks in the Parallel Port Joystick folder. Start it.
    3. Select Add, then select Virtual Joystick in the first drop-down list. Number the controller as 16, just in case you have other controllers.
    4. Once your new virtual joystick appears in the Configured Joysticks list, select it and click the Mapping button. If it gives you an error, close the window, then start Configure Joysticks again, and try again.
    5. Click Next, then select the following:
      1. 6 axes, 0 buttons, 0 POV hats
      2. Axis 1: X Rotation
      3. Axis 2: Y Rotation
      4. Axis 3: Z Rotation
      5. Axis 4: X Axis
      6. Axis 5: Y Axis
      7. Axis 6: Z Axis
    6. Once your settings are saved, you can now leave the Configure Joysticks screen.
    7. Restart FreeTrack and go to the Output screen. There will be a checkbox for PPJoy, and a text box for controller number. Select the number of the PPJoy controller you want to use (in this case, 16).
    8. The checkbox will become active when you select a valid PPJoy joystick, and you'll be able to select it.
    9. To calibrate the PPJoy joystick, go to Control Panel -> Game Controllers and calibrate it there (while FreeTrack is outputting your head movements as joystick movements, of course). It will be listed as Parallel Port Joystick.
    ## Where do we go from here? ## For more information, and to learn about the things I didn't cover, check your FreeTrack documentation (Start Menu -> FreeTrack -> Handbooks). If you want more ideas of different point model designs, FreeTrack maintains a small gallery of submitted photos. I also mentioned earlier that aside from Wiimotes, FreeTrack also works with plain old webcams. There is a list of known-working webcams at the FreeTrack site too. Thanks for reading, and I hope this incredibly long article helped you out.

That's all there is, there isn't any more.
© Desi Quintans, 2002 – 2022.