# How to get x and y position from joystick?

I have VR2 Joystick and I want to hack it. What I think is that, to determine analog voltage of joystick outpin and to mimic this values in Arduino with AnalogWrite function. I tried measure analog voltage of joystick pins but I cannot record this values. Is there any way to find x, y position of joystick? Actually, I don't know whether is this method is correct. Because, values can mislead, maybe. Is there another way you know, you apply?

There is a 2-page forum thread here that explains how to interface with the VR2 joystick.

etc...

• lol, Jason .. 2 ppl finding the same forum at the same time :-) – Guntram Blohm Oct 9 '15 at 13:12
• Great minds think alike! I voted your answer up since it actually provides extra information, as opposed to mine which basically says, "hey just go look over there" :) – Jason Geffner Oct 9 '15 at 13:16
• In many cases, a 'there is a real good explanation over there' answer has more value than the short summary that an answer here can provide. – Guntram Blohm Oct 9 '15 at 13:20

You might be interested in this forum post where people have already interfaced your joystick to an arduino. It also has a link to the specifications of a similar joystick, including a data sheet.

Note that each direction uses 2 hall effect sensors, whose outputs correspond, and you should read both of them and compare them. Only if their sum is a constant value, +/- a few percent, can you assume that both of them work. Or, if you want to emulate the joystick in an existing circuit, you'll have to provide both values to "fool" the existing logic.

Also, please not that the standard Arduino `AnalogWrite` function doesn't do a true analog write; instead, it sets the output to a PWM (pulse width modulation) signal with a duty cycle ratio that corresponds to the `AnalogWrite` written value. This is "analog" enough to control the brightness of a LED, but won't work with anything that requires a true analog signal. In order to produce a true analog signal, you'll need to use an Arduino Due or Arduino Zero, which have 2 resp. 1 true analog output signal (which isn't enough if you want to simulate the 4 hall sensors that the joystick has), so you'll need a 4-channel digital to analog converter with an arduino library, something like this.

If you seriosly consider starting a project, i'd strongly recommend you get a digital oscilloscope that will allow you to check the real voltages on both your joystick and your simulation.