I'm trying to build a head tracker for PC games using an Arduino Micro (as it has the 32u4 chip for acting as an HID joystick) and an IMU, and this library. I noticed that for the main axes, X Y and Z, you can only report an 8-bit integer value, from -127 to 127, and 255 values isn't enough for 360 degrees with floating point precision. I did notice that something called "X Y and Z rotation" supported 360 values, and the library seems to suggest it takes a 16 bit integer, which suggests it is possible to get more precision out of the first 3 axes. Is there any way to increase the precision of the joystick axes? Just how many bits does Windows HID allow you to assign to an axis?
I had an idea, but held on to it in case someone with knowledge came along(it might be unreasonable or dumb), I did not want to confuse anything. Since no one has answered yet, I will throw it out there... Can you use the joystick values just for direction of head turn and speed of head turn? So for say the Y axis... Say if the value is 127, you translate that into ... LOOKING UP @ MAX SPEED, and another variable Say HEAD POSITION Y is incremented or decremented. Unless I am completely wrong, I think This way you could have as much precision as needed.
Never mind, my apologies I think I understand now, you want realtime/head(real life) position to determine the view from a headset?
Yeah but don't worry about it, I found a ready-made Arduino library to act as a USB joystick with 16-bit axes for maximum precision:
And if you're curious, here's a photo of the finished product:
And here's a video of me using it in a game:
That is pretty cool. I marked this for later reference.
PS I imagine it looks pretty silly to someone that doesn't know whats going on.
Would you mind sharing your code? I am working on a identical project and couldn't figure out how to assign imu axis to joystick axis.