Looking around the cockpit in a flight simulator

There are better instructions for this project here. The performance I have out of this build is okay, but could be improved by getting LED's with a wider viewing angle. I'll probably rebuild mine at some point.

FreeTrack is a piece of software that allows you to look around the cockpit in a flight simulator, by tracking head motions using a webcam. The user typically wears a baseball cap with some infra-red (IR) LED's, and removes the IR filter from the webcam. It turns out the FreeTrack seems to have been abandoned, but there is a new project called OpenTrack. This software has a number of tracking methods. One of these methods is the IR tracking method which has been ported over from FreeTrack. It may be possible to get decent results with face tracking, but this is probably more CPU intensive and I've already built the hat.

The first thing to do is to work out the schematic you need to build. This is easy, because there is a wizard on the FreeTrack site. I got my IR LED's from here. They have a maximum forward current of 100mA, and a forward of voltage 1.2-1.6V. You also need to input the voltage of the power supply you'll be using. I'll be using USB, so that's 5V. These values are used to decide the resistor values that you need to use. I got the following schematic:

with a resistor value of 36Ω. The closest I had was 47Ω, so I used three of those. While testing on a breadboard, I realised that the resistors were getting a bit hot. That's because they are only rated for 0.25 watts of power. Instead of buying more resistors, I decided to combine them in parallel to share the load. A 220Ω, 100Ω, and 100Ω resistor in parallel gives 40Ω, which is closer to the original target value. These would be capable of 0.75 watts, which is more than enough for what we need. I had three happy LED's that seemed to be bright enough to work with FreeTrack:

I simply twisted the legs of the three resistors around each other to create essentially one resistor and then soldered one end to the positive leg of the LED. The other end was connected to the positive wire:

After this, I added some insulation tape to separate the positive and negative legs, and glued the LED's to the hat. Here is the rather stylish finished product:

Here is what the camera sees (the three bright dots on the hat):

I've ordered a PS3 eye to use as the webcam. It cost me about £9 from Amazon. This camera is ideal because it is used for motion tracking on the PS3, and therefore suitable for the task. According to the specs, it can do 120fps at 320x240, or 60fps at 640x480. The light from the LED's isn't really bright enough with the IR filter on the webcam still in place, and the IR filter is part of the lens on the PS3 camera. To solve this problem, I ordered an M12 lens mount, and lens without a filter built in. Here's the lens and mount:

The starting point with the original lens:

The new lens:

I then put everything back in the PS3 eye case and stuck the magnetic material from the inside of a floppy disk over the lens. This helps filter out visible light.

The finished product: