2
\$\begingroup\$

I'm trying to make my Arduino read the 10K potentiometers on a joystick using analogRead(), but the values returned fluctuate too much when the joystick isn't being touched. I'm not using shielded cables, but they are very short (the distance from the joystick to the MCU is only about the length of the MCU itself).

The Arduino I'm using is a Teensy 3.2, so I went to get tech support at their website. The solution I found most was to use a unity gain buffer, so I was hoping to get some help building a circuit for my situation.

The Teensy 3.2 is a 3.3V device that has 5V tolerant pins and uses USB to directly upload the programs. I have some 358 op amps on hand, but it is my understanding that these won't deliver rail to rail voltage which I would need when the potentiometer's wiper is at the minimum and maximum positions. I also have a lot of 4558 op amps but I don't think these are suitable for single supply circuits that I was hoping to power from the USB this device uses.

\$\endgroup\$
11
  • 2
    \$\begingroup\$ I highly doubt it's about adding buffers that would help with this. Generally MCUs can read 10k pots just fine. \$\endgroup\$
    – Justme
    Feb 26, 2022 at 0:34
  • \$\begingroup\$ The values being read were jittery and this was the advice that I found to clean up the noisy signal. Not saying you're wrong, but this was the lead that I'm following. \$\endgroup\$
    – TRS-80
    Feb 26, 2022 at 0:38
  • 1
    \$\begingroup\$ Well, it's hard to figure out what you are asking. There is also no links to any buffers or filters so it is hard to say if you need one or not. Besides filtering can be done in software too. \$\endgroup\$
    – Justme
    Feb 26, 2022 at 0:43
  • \$\begingroup\$ How would the joystick even know where the center of the screen is? Sounds like a driver issue, not a noise issue. One thing you could check is whether you're accidentally sending data that's out of bounds from your "mouse" at times. Maybe that could move the cursor to the center of the screen? \$\endgroup\$
    – Drew
    Feb 26, 2022 at 0:46
  • 1
    \$\begingroup\$ try cleaning up the jitter through software ... send the average of three readings ... jitter as the source of the problem is probably a red herring \$\endgroup\$
    – jsotola
    Feb 26, 2022 at 1:15

1 Answer 1

0
\$\begingroup\$

The correct way is to filter in software, not to add hardware. If you already wrote the driver to immediately send a new value when it changes, then a filter won't help here. If an analog signal is between two values, it is still between two values after filtering and can jump between them when reading with the ADC.

The usual solutions could be for example to have a dead zone in the assumed middle position where it will not send new positions to PC, assuming some kind of calibration is done to know the actual center instead of assuming it. First order filter could be used in software but the output could still toggle between two values if input does.

\$\endgroup\$

Your Answer

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

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