1

I am completely new at Arduino. I have a joystick:

enter image description here

It is however quite different from all the other joystick-tutorials, as their joysticks have 5 pins, not just 4. So I am quite at loss here. How do I connect it?

  • I would imagine one pin goes to 5V, one to GND, and the other two connect to analog inputs. I would expect there to be markings on the board telling you which is which. – Majenko Jan 6 '17 at 17:00
  • Wouldn't I need one to a key to read the data? – andrew Jan 6 '17 at 17:05
  • I didn't understand what you just asked. – Majenko Jan 6 '17 at 17:05
  • Is the fifth for when you press down on the joystick, like a button? Try connecting a multimeter and see how the resistances change when you play with the joystick. – Gerben Jan 6 '17 at 17:06
  • 1
    You read the analog value. That's really all there is to it. Analog values go from 0 to 1023. 512 (or thereabouts) is the middle of the joystick. It goes up and down from there. There's nothing to "interpret", and you certainly won't find a library for it. – Majenko Jan 6 '17 at 17:21
1

If the link that Mark Smith provided is correct, that is a “dual-axis mini xy joystick module PSP 2-Axis Analog Thumb Joystick Module Thumb Joystick for Arduino”, with (as other comments suggested) pins labeled on back of board as GND, X, Y, VCC.

To use it, attach GND to Arduino ground; connect each of X and Y to analog inputs, like A0 ... A7; connect VCC to (typically) 5 V. Then read results on your analog input lines.

Note, it makes sense to test the device using a DVM beforehand. Measure resistance from GND to VCC to find out overall resistance, so you can decide if 5 V is appropriate or if you should use a lower voltage. (For example, if overall resistance is several thousand ohms, 5 V is ok; if only a few hundred, add one or two thousand ohms in series and take analog readings using a 1.1 V reference instead of 5 V reference.) Also measure resistance from GND to X as you move the thumb control, and from GND to Y.

0

For sure there should be 4 pins, 'GND', 'VCC', 'X' and 'Y'. GND (-) is used when the joystick goes into a negative axis (depending x or y) on a Cartesian plane it transfers as negative into the Arduino board. The same thing happens when it goes to positive (VCC (+)) (depending x or y) on a Cartesian plane it transfers as positive onto the Arduino Board.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.