Back in 2013 I experimented with FaceTrackNoIR, a means of head-tracking using a webcam; alas the only decent webcam we had was not my own and so I used a cheap model camera… it would regularly lose track and require resetting, but the brief moments when it did work, it was an obvious improvement when playing games like Arma. But as the only real commercial option was well over £100 I put the idea to bed. Until I saw someone talking about using a little homebrew project on the Arma 3 forum, see this thread on the BI forum.

The assembly instructions are nearly identical to the EDTracker; with the exception of I have no reset button. But for the sake of making sure this information doesn’t disappear entirely… the hardware is as follows:

  • Pro Micro ATMega 32U4 5V/16MHz
  • MPU-6050 Six-Axis Gyro
  • Plenty of cable (optionally a breadboard)
  • Soldering will be required

When wiring it up, wire up the following:

  • Arduino GND  <–> MPU GND
  • Arduino GND <–> Arduino GND
  • Arduino GND <–> MPU ADO
  • Arduino VCC <–> MPU VCC
  • Arduino 7 <–> MPU INT
  • Arduino 2 <–> MPU SDA
  • Arduino 3 <–> MPU SCL

In terms of software you will require FaceTrackNoIR and the hatire plugin. At this point I haven’t talked about the actual sketch file for the Arduino; the original sketches can be found via this link, and a modified version of the same sketches which adds basic commands via this link. But, before you commit to downloading either of those I made my own modifications. This might not affect you, but in my case it was a substantial roadblock to having a smooth experience, constantly having to readjust the centre point.

Essentially the MPU was occasionally outputting (or at least according to the Arduino it was) a spike in acceleration, it roughly translated to anywhere between 20 and 40 degrees; now given that the electronics work in fractions of a second, to rotate your head that far in a micro-second would be a feat to behold I think. So, simple solution, you compare the current output with the previous output, if it goes above a margin of your choosing you ignore the output and use the last output. Yes, in theory this means there might be a moment where your view doesn’t go quite where you expect it (hopefully by using the last output it helps smooth things over). But I combined it with a recentering (or spring) sketch snippet to basically mean I should never have to touch the recenter key for FTNoIR again… and in my quick 4 lap test in Assetto Corsa, I never did (whereas before I would have had to wait till a straight to recenter my view every other if not every lap, not ideal when trying to concentrate).

Its worth noting that I use a maximum of about 8 degrees motion of my own head in either direction to translate to ingame (as far as the specific game at hand will go). So a margin of 15 degrees is ample and even then, my own physical limitations should stop me from ever exceeding 15 degrees of rotation in a micro-second. Even if there is a micro-error of less than 15 degrees, the recentering code should be able to handle that perfectly fine; its those regular large spikes that are an deal-breaker. The sketch itself is below, credit to the original creator and people who have modified it since, my own changes are pretty minimal all-in-all:

If you are wondering what my addition to the code is, it is pretty much as follows:

I’ve not included the defining of the float or its initial assignment, rather I’ll just explain this. What I’m looking at is the absolute current acceleration angle (x axis) and comparing it with the last angle (which is always updated). Note that abs (or absolute) is essentially making a negative number equal to a positive number; handy when both will be used; so -30 might as well be 30 for all the code cares.

The margin (+/- 15 degrees) is calculated based on the last angle, because the angle does increase with more head movement, we need to factor that in and have a margin that moves with the current angle. But if we exceed that margin, we have to ignore it (because there is a high likelyhood its a spike of 20-50 degrees (or more); so we use the old value instead. My experience has been that the spikes are one-off in otherwise stable output; so maybe once every 20 seconds at most; more than enough time for a new value to have been output and the old value to have been replaced.

The second article will contain the configuration of FTNoIR and the Arduino Hatire plugin, I’ll make further posts for a few games I own and the configurations I’ve opted for; including Arma 3, Assetto Corsa, Euro Truck Simulator 2, and Evochron Mercenary.