I'm working on converting an old Thrustmaster WCS Mk2 and Flight stick combination to USB (For fun and education) via the Arduino Micro and the NicoHood\HID library, so far things have gone pretty smoothly, I have all the axes reporting and all the buttons are read via a pair of shift registers but I've run into an issue with the joystick pots that I'm unsure how to solve.
In the Gameport joystick the pots are ~100k pots that are connected to power and signal via their first and second pins, since the Arduino cannot read resistance directly I've setup a voltage divider for each of the axes so I can read the voltage difference as the pot is turned.
When using a 100k ohm resister as R2 in the divider I got a range of 2.5V - 5V as would be expected, however, I wanted to take full advantage of the 10 bit ADC and moved from a 100k to a 22k, this allowed a range of about 4.8V to .8V.
At this point I noticed that the voltage divider was having the interesting effect of biasing the values coming into the Arduino. What I mean by this is as the pot was turned there were smaller steps at the lower end of the scale than the larger end.
I ran a simulation through falstad, comparing the response from a voltage divider with a 100k pot as r1 and a 22k resister as r2 and confirmed that the response is non-linear, whereas with a linear pot, the response is nearly linear, as expected.
My question is, after all that preamble, is there a way to read the analog values from the joystick in a linear way, utilizing as much of the resolution of the 10 bit ADC as possible, without modifying the joystick? Obviously I could gut the stick and rewire the pots, but I'd like to avoid this with either a hardware or software compensation of some kind so that other gameport joysticks might also work, but I'm afraid I'm a little out of my depth.
I've researched the issue and from what I've seen so far, most people seem ok with just utilizing the 2.5 to 5v range with less non-linearity, but I'd like to have higher resolution and I'm sure there must be a solution!
Any suggestions are greatly appreciated!