0
\$\begingroup\$

I would like to replace the microcontroller of an old gamepad with a Arduino/Teensy board. To do this, I need to connect all buttons and the output of the 4 potentiometers of the gamepad's joysticks to the Arduino.

Unfortunately, the potentiometers are not wired as voltage dividers but as variable resistors with a common source/ground pin:

schematic

simulate this circuit – Schematic created using CircuitLab

I could just put a constant resistor at the output of every potentiometer and read the voltage at this position, but then the voltage changes nonlinearly. The ADC resolution of the Arduino is not high enough to accurately measure such nonlinear curves.

Is there a way to linearly convert the resistance of the potentiometers into a voltage value to then read? I think it could be possible with pnp transistors as a constant current source, but im not sure how to wire it.

\$\endgroup\$
2
  • \$\begingroup\$ What are the minimum and maximum values of resistance that each potentiometer will produce? What is the "common pin" connected to? \$\endgroup\$ Commented Apr 29, 2019 at 17:47
  • \$\begingroup\$ Not only should you worry about the ADC resolution but as well as the clock frequency of the microprocessor. Are you certain that the microprocessor you're replacing has the same clock frequency? You might get some delay in your game control mechanics. \$\endgroup\$
    – user103380
    Commented Apr 29, 2019 at 18:41

2 Answers 2

2
\$\begingroup\$

Connect each variable resistor to its own fixed current sink. The value of the current should be slightly less than the value you get when you divide the supply voltage by the maximum resistance. Then the voltage drop across each one will be linearly proportional to its position.

Or you could tie the common point to ground and use current sources. Then the voltage drop will be ground-referenced.

\$\endgroup\$
1
\$\begingroup\$

Back in the day this was done with a NE558. A capacitor was charged through the variable resistance, and time it takes to charge is sent as a digital pulse. An Arduino or Teensy can very well perform the same.

\$\endgroup\$

Your Answer

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

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