0

What reasons could there be for a joystick to return 0 when using analogRead?

X-pin is connected to AO and y-pin is connected to A1.

VCC is connected to 5V and GRND is connected to GRND.

By default (as in when not using the joystick) the value should be approximately 500, right? Well why is the value then 0? Can this only be a wiring issue?

5
  • What value do you get when you move the stick? Maybe 0 just means centre and then when the stick is moved you get -90 and +90 (or something like that)? Mar 2, 2017 at 17:38
  • It doesn't go below 0 at any point, however it does increase by 2 or so when moved up/right
    – helppls
    Mar 2, 2017 at 17:40
  • Moving just 2 sounds like electrical static and that the joystick is not working or not powered correctly. Have you set your arduino analog pins as INPUT? Mar 2, 2017 at 17:45
  • 2
    thank you... I changed the wiring a bit and it worked :)
    – helppls
    Mar 2, 2017 at 17:50
  • For a question like this you need to a) check your joystick out of circuit with an ohm meter and confirm the values that the pots are producing, and b) describe (ideally with a schematic) the exact circuit you're using. Note that as it stands this isn't a very good StackExchange question because it's unlikely to help anybody else. Going back and filling in the details might get you some upvotes.
    – cjs
    Apr 2, 2017 at 22:44

2 Answers 2

1

Follow these steps to identify the problem.

  1. Disconnect A0/A1 from Arduino and use a multimeter to check the voltage coming from the joystick X and Y. If it swings from 0 to 5V....the problem is in the Arduino. Check your code and connections. Maybe your wires are damaged?

  2. If the voltage is not changing at X and Y pins, disconnect power from the joystick and use a multimeter to check the joystick potentiometer. Check all three terminals in each axis of the joystick. If R is the measured resistance between the two outer pins, then the resistance between the central pin and each of the outer pins should vary from 0 to R depending on the position of the joystick.

  3. If there is no problem at all with the joystick readings by potentiometer then the problem has to be on the Arduino side.

0

Adding an answer after clarification:-

Moving the joystick also failed to produce a valid reading which indicated a wiring issue or incorrect configuration of the Analog pin in the Arduino code.

Proven to be a wiring problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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