Problems with analog pin on Nano

Hello guys!
So, I'm having some problems with my analog pins on a project I'm working on
I'm trying to adapt an G27 shifter to usb using the Nano (I know it's limitations due to not having the HID capabilities, but I want to try doing this, even without those capabilities)
So, i'm with an db9 port connected to my arduino, with the following wiring diagram:
imagem_2023-10-31_212732930

I've made a connection to the Y axis of the shifter to an digital pin, which is actually working fine, but it's not of much use to what I need, which is an analog value.
The analog port, when using the analogRead is always returning it's max value, 4095, which is a problem.

here's the code, which is just for checking the value on those ports:

int analogPin = A3; 
                    
int val = 0; 
int pushButton = 5;
void setup() {
  Serial.begin(9600);
  pinMode(A3, INPUT);
   pinMode(pushButton, INPUT); 
}

void loop() {
  int buttonState = digitalRead(pushButton);
  Serial.println(buttonState);
  delay(500);  

  val = analogRead(analogPin);  
  Serial.println(val);
  delay(500);     
  }

So, I really need some help on this.
I even don't know certainly if each gear will return a different value, but I'm really looking forward to give it a try on this.
(if you have an tip on how to translate the digital sign to something I can use to identify which gear is it, or anything else, please, feel free to comment!)

Not needed, and may configure the pin as a digital input. Not sure on that, but try without.

just tried, no changes on the monitor

Well, without a schematic of the internals of a "G27", and no idea of what it is, I guess I'm done.

oh, should have clarified that on the post, sorry lol
So, the G27 is a logitech gaming wheel, and I'm trying to connect it's shifter to the Nano
If i'm not mistaken, the shifter uses potentiometers, but I couldn't find a internal diagram.

If you have a voltmeter you could measure an analog voltage - if there is one.
Maybe the analog output/s of this shifter have to be pulled up (try a 10kΩ resistor) - they may be variable resistances.

Hi, @jv_pc
Welcome to the forum.

Have you Googled;

G27 logitech gaming wheel arduino

Tom... :grinning: :+1: :coffee: :australia:

hey, measuring the voltage between the analog pin and the ground, it's a 5v voltage
about the analog outputs being needed to be pulled up, I really don't think that's the case, this wiring diagram is based on a similar project which uses the pro micro, and the analog outputs didn't needed that.

Then why isn't it varying, why is there no variation? What's "analogy" about that?

PE - If you can't pick off something, somewhere, > 1V and less < 5V, that's telling you something.

Hello Tom, thanks for the welcome!

I have done quite some research before starting this project, but couldn't find anything related to this problem.

well, I think the variation is there, because the digital pin on Nano that it's connected to the shifter Y axis, it's actually recognizing when there's a variation, and I need this similar thing on the analog pin, like it happens in the similar project with micro
here's the project for reference: GitHub - n-e-y-s/G27_Pedals_and_Shifter at n-e-y-s_devel
Also, I just measured the voltage between the gorund and the analog pin, and It was to be exact, it's a 4,56v

And if you jack around with the shifter, then what?

ok, so
when moving the shifter in the X axis to the left, the voltage changes to 4,55v and to the right, 4,57v
so, there's variance, but a really little one

This happens on the Y axis on the digital pin too, but the voltage variance it's much bigger, almost 2 voltages when it varies

He notes ─ "when wiring the male connector for the shifter, remember that the pins will read right to left rather than left to right."

That would be on the wire side.

image

yep, followed that correctly for sure

That's readable - or should be.

so, probably that on an analog pin should work just fine because of the higher variance
but it's the X axis variance readable by any way ?

You noted a maybe 20mV difference. So that's not happening.
What if you pull it down with a 10kΩ resistor (that is, to GND)?

I don't want to put too fine a point on this - but there should be some 'broad' range of voltages to analogRead or that isn't going to work.
(So, if not - Why not?)

What reading do you get from that pin when you move in the y axis?
Likewise the y axis output when you move in the x axis?

Tom... :grinning: :+1: :coffee: :australia:

sure, why not
I could try to pull it down for sure, I'm just not very familiar with it, where should I put this 10kΩ resistor ?
and just to clarify, the resistor will get my voltage near to 0v, so that the variance of 20mV can be read ? or the variance will be higher with the resistor ?
(btw, thanks for the help already)