Forgotten your password?
Request a new one here.

DIY Head Tracker

UPDATE : This is all now formally captured over at www.edtracker.org.uk - I won't maintain this article any more; please head over to that website for any further details or instructions.


You will need :-


1x Arduino Micro development board (just like this one from Hobby Components)

1x GY521 MPU 6050 3-axis gryoscope breakout board (just like this one from Hobby Components)

1x 6x6mm button (just like SW003 or SW085 from Bitsbox)

1x Pocketmoon-Brumster-DeadFred Incorporated daughter board (!) - etch it yourself with my plans. DON'T FORGET TO MIRROR THE IMAGE before printing, if necessary!


Etch the board using your favourite method. I am not going to go into the detail of how to etch your own PCB but it's entirely doable at home. A quick google of "diy pcb etch" will soon turn something up ;)



Solder the switch into place first.

Next solder the header pins into the Arduino Micro, then solder the Arduino Micro into place - it goes in from underneath with the pins coming up through the board

Next solder the header pins into the daughter board for the MPU (the 8-pin header to the bottom of the above diagram), then position the MPU6050 breakout board onto that row of headers afterwards, and solder that into place.


You end up with the following (underside) :-



...and topside...



Next install the Arduino development environment on your PC.


Now download the source files from Pocketmoon's GitHub repository, and also the i2cdevlib libraries from Jeff Rowberg's repository. Install the i2cdev libraries into the Arduino "libraries" folder. You have a sketch file which is what you will load into the Arduino IDE and compile, but first you must copy the HID.cpp and USBAPI.h files into the relevant folder in your Arduino install directory. Just retain the folder structure that's present in the above ZIP file. You might wish to retain a copy of the original files before you overwrite them. By overwriting them, you allow the Arduino Micro to be modified to report itself to windows as a HID device (Human Interaction Device) - ie. a joystick. It is this feature that we use to represent the head tracker to your games - they basically think it's a 3-axis joystick.


Copy those two files, then open up the sketch file (headtracker.ino). Plug your Arduino Micro into a USB port, configure the Arduino IDE software with the correct COM port, and then upload your sketch. Once successfully programmed in, you're away and done!




If you get some wandering or axis creep over time it may be that you need to fiddle with your gyro offset settings. Take a look in the code for the following lines :-


// supply your own gyro offsets here, scaled for min sensitivity


Reset the GyroOffset values to 0 for all 3 rows, recompile and upload your sketch, then turn on the serial port monitor and look at the values that are being spat out. If they're not all zero, then you have your new offset values - in x, y and z order. Invert those numbers (so 56 becomes -56, or -20 becomes 20) and plumb the numbers back into the above code as your new offset values, recompile and upload, and you should be better off. Make sure you have the tracker on a flat surface and you don't move it during calibration ;)


Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.04 seconds
234,661 unique visits