Wrong values got from potentionmeter an joystck

Dear All,

A just put an Arduino nano on a breadboard and connected a joystick to it trying to retrieve the values from it printing it to the serial monitor but its value range is between 0 and 892 instead of 0-1023. I tried with another joy (same model) and the result was the same.
After this I connected a separate pontentionmeter to test it and it has maximum value 897 while another potentionmeter had 905.

Do you know that why can’t they reach 1023?

The joysticks have a small range of useful motion, basically in the ends it doesn’t send any information back, we can say that only the 2/3 of the whole range is useable.

Thank you in advance!

Why does it matter?

The joysticks have a small range of useful motion, basically in the ends it doesn't send any information back, we can say that only the 2/3 of the whole range is useable.

Please post a link to where you got the joysticks

Without seeing exactly what you have and your circuit arrangement it's about impossible to say why you see what you see, especially in the case of the potentiometer. You could just take your chip Vcc and measure it on an analog input and see what the bit count is or use a DMM and measure the actual input to your analog in between ground and AI pin.

Ron

Typical Joystick using X and Y axis should look like this but all joysticks are not the same.

Ron

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Can you post a link to where you bought the joysticks?

Thanks.. Tom... :slight_smile:

Sorry guys, I was noob…
I connected to VIN pin instead of 5V. Now the range is correct for the joysticks and potentionmeters as well, but there is one interesting thing.

The two joys have different center values:
1st: X: 509 and Y: 482
2nd: X: 513 and Y: 505

Basically none of them is perfect, but I suppose this is because they are cheap joys.

I have this:
https://www.hestore.hu/prod_10035502.html

Cheap joys indeed. You can deal with the discrepancy of central positions in software.

Basically none of them is perfect, but I suppose this is because they are cheap joys.

No pot is perfect. There is a tolerance and linearity spec/variation and the slider usually won't go all the way to zero/full resistance. And, in a self-centering joystick there will be some mechanical misalignment.

Your worst-case center-reading of 482 is about 30 counts off. Out of of 1023 that's only a 3% error. Not too terrible.

Thank you everybody! Based on your advice, I finally realized that a few percentage mistake is not a big problem after all. Maybe a more expensive joy/potmeter would be more precise.

As UKHeliBob said, fix things in software.
Cheap (or all) joysticks need some zero-position deadband and mapping (restricting) of the extremes.
This comes up frequently, so there are posts with code for you to find.
Use the search field on top of this page.
Leo…

Cheap and precision are often mutually exclusive, particularly for mechanical devices. Its easier in electronics, but you still pay more for precision devices due to the additional calibration / laser-trimming steps.

There's a rather nice exception for position sensing which is capacitive encoders (as used in digital calipers),
its cheap and simple and accurate technology. Don't know if any joysticks use it.