Looking for a reliable joystick

I tried few (not-expensive) joysticks and I constantly find few issues:

  1. The "zero" value of a joystick is higher than 512.
  2. The worst is that the "zero" value increases while application is running.

I tried this one:

I can overcome in-perfect "zero" value, but how to make sure that over time it doesn't change.

The cheaper joysticks use potentiometers. There's a little tiny metal contact sliding along a resistance track. Dirt, water, age and electrical noise will all cause problems in the long term.

Expensive joysticks use hall effect sensors. They sense the rotation of a magnet without touching it. They never wear out and dirt and water don't affect the magnetic signal. If you can find one under $300 you are doing well. However some single-axis controls such as the throttle on an electric bike use the same technology and they are relatively cheap.

I doubt joysticks on XBox controller cost 300$. Does it mean that XBox software overcomes the deficiencies?

Also from available joysticks are there particular models with affordable cost?

There you go. If you're able to use one of those then you are doing well.

You need to give more information about your application. "Are there affordable cars?" Yes, but if you are trying to carry 20 people and you only have a few thousand dollars then no, there aren't "affordable" cars.

Hi,
What is the application that requires precision joysticks.

Have you programmed in a dead band for the zero position of your device.

Even in industrial and Xbox, PS3 and PS4 there is a deadband programmed, or a center position switch for each axis.

The output of your potentiometer joystick is only as good as your power supply, have you monitored your supply while testing you unit?

Thanks.. Tom.. :slight_smile:

Thank you guys for responses.

I am building a dron. I want the dron to don't move if joystick is released. At the start up I make multiple measures of the steady state and use it as zero value.

What is the deadband programmed?

Instead of looking for 'zero' as being 512, let 'zero' be any read value (for example) between 502 and 522. The 'deadband' in this case is +/- 10 counts. Now if the joystick produces a value between 502 and 522 the system will assume a position value of 'zero'

Not only 'zero' might need trimming, but also the 'extremes' might not be 0 and 1023.
Since we didn't see any code or pictures, we also can't be sure you're using the pots correctly.

You should write a few lines of code that just displays the pot values in the serial monitor.
Then try to tame the beast with double reads, offsets, and/or map().
Post your code and a picture of the setup if you want help with that.

You might need a bit more than just "potValue = analogRead(potPin);"
Attached is an example (unrelated) I wrote for reading a pot and converting to 0-100% (101 values).
It ignores the extremes, and has a deadband between each % value.
And only prints if the % value changes.
Leo..

// converts the position of a 10k lin(B) pot to 0-100%
// pot connected to A0, 5volt and ground

int rawValue;
int oldValue;
byte potPercentage;
byte oldPercentage;

void setup() {
  Serial.begin(115200); // set serial monitor to this baud rate, or change the value
}

void loop() {
  // read input twice
  rawValue = analogRead(A0);
  rawValue = analogRead(A0); // double read
  // ignore bad hop-on region of a pot by removing 8 values at both extremes
  rawValue = constrain(rawValue, 8, 1015);
  // add some deadband
  if (rawValue < (oldValue - 4) || rawValue > (oldValue + 4)) {
    oldValue = rawValue;
    // convert to percentage
    potPercentage = map(oldValue, 8, 1008, 0, 100);
    // Only print if %value changes
    if (oldPercentage != potPercentage) {
      Serial.print("Pot percentage is: ");
      Serial.print(potPercentage);
      Serial.println(" %");
      oldPercentage = potPercentage;
    }
  }
}

afedorov:
I am building a drone. I want the drone to don't move if joystick is released. At the start up I make multiple measures of the steady state and use it as zero value.

What is the deadband programmed?

It's de-sensitisation. So you just have to write code that processes the values from the joystick. Make the joystick unresponsive if the joystick values lie in some suitable range around the 512 region..... such as... make the joystick not do anything (eg. output zero values) if the actual joystick values fall in the range from say 508 to 516, or whatever range you want.

Before you work on the drone, probably better off starting with using your joystick to control an RC car to begin with.

I am actually testing the joystick on a RC car I built. The issue I noticed that the over time the default value shifts and original limit doesn't work anymore.

Could this be related to battery voltage dropping?
Leo..

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Including how you are powering your system.

Thanks.. Tom... :slight_smile: