Interfacing a Joystick with an ADC

Thread Starter

Header

Joined Nov 15, 2009
5
Hi,

I am attempting to interface a joystick that has two pins for each axis (like a normal resistor, except variable) to my μC's (ATmega32) ADC. My problem is that, I cannot figure out the proper way to connect it. I have tried connecting one pin to 5v and the other to my μC, but that yields no results.

Any help would be appreciated!
 

Markd77

Joined Sep 7, 2009
2,806
A simple way would be a voltage divider.
Basically connect one of the 2 pins to ground and the other pin to the ADC channel and also to 5V through a fixed resistor. Pick a resistor that is maybe about half the maximum of the variable resistor and experiment from there.
 

Thread Starter

Header

Joined Nov 15, 2009
5
Okay, I have a voltage divider up and running, but the voltage on the ADC isn't changing enough(changes about one volt) to get a precise reading. Using the internal amp on the AVR results in a value of 255 no matter where I move the joystick.

Thanks!
 

beenthere

Joined Apr 20, 2004
15,819
Are you sure that joystick has an analog output? You should be able to feed it 5 volts and ground, and the outputs of both axes should be a voltage that varies from 5 volts and ground.

With two pins, yours sounds like it might just have switches.
 

beenthere

Joined Apr 20, 2004
15,819
According to the link, you put power to pins 2 and 4 (that would be ground and +5), and the other pins are the X and Y axis signals. You should be able to read the voltage outputs with a meter to see if it works properly - checking for resistance is not telling the whole story.
 
Top