Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Pot Jumpin'

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Location
    Boca Raton, Florida
    Posts
    7

    Pot Jumpin'

    Hi there -
    I am using a Teensy 4.1 board with some 100k linear potentiometers. I'm currently experimenting with the CCPotentiometer Class in the Control_Surface library, but I've found this issue to come up with the USB_MIDI AnalogControlChange example included with Teensyduino 1.53...
    I'm getting major jumps in the value that is being read. It seems like the speed that I turn the potentiometer has an impact on the value. I have tried scaling the values using the explanation in CCPotentiometer-Map, but it's not quite cutting it.
    Can anyone help me to understand what is going on here and how I might fix it?
    Thanks

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    918
    Could this just be a scratchy pot? This can be cured with a small capacitor from the wiper to ground, 100nF or similar.

    100k is a bit high for a pot, more likely to pick up noise than ones of 5k or 10k value.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Location
    Boca Raton, Florida
    Posts
    7
    Quote Originally Posted by MarkT View Post
    100k is a bit high for a pot, more likely to pick up noise than ones of 5k or 10k value.
    That's interesting. I had tried a couple of 100k and a couple of 1m pots, thinking that a voltage divider is a voltage divider.. switching to a 5k pot worked perfectly well. Any idea why this is?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,999
    Quote Originally Posted by newman View Post
    Any idea why this is?
    Lower source impedance allows for the voltage sampling capacitor inside the chip to charge (or discharge) to the right voltage during the limited time for sampling, and it also helps overcome small errors due to "charge injection" through unintended capacitive coupling inside the chip to other signals.


    thinking that a voltage divider is a voltage divider
    Indeed it is when the voltage measurement is an impedance much higher than the impedance of the circuit. Most digital multimeters are 10M resistance load to the circuit they're measuring. But the ADC input on Teensy and most other microcontrollers isn't such a high impedance. It's a capacitor and a transistor which turns on for a brief time to (hopefully) let the capacitor charge to the measured voltage.

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    918
    The main issue with high impedance inputs is noise coupling to it from nearby signals - logic signals switch so fast that
    even tiny amounts of stray capacitance will induce significant currents.

    For instance a logic trace at 3.3V switching in 2ns is slewing at 3.3 / 2x10^-9 = 1.65 GV/s -- yes, gigavolts per
    second...

    A tiny 0.1pF stray capacitance will couple 165ľA from that trace while its switching(*), and into a 100k circuit 165ľA
    produces a voltage error of 16.5V (although only for the duration of the switching, and actually its limited to 3.3V
    by the voltage step).

    So you can see that its very easy to get noise into a high impedance circuit from nearby high speed logic.

    With long cables you get capacitive coupling to nearby cabling (such as the mains supply), which can also
    induce noise (especially transients from switching events on the mains circuit).

    Using lower impedances becomes less sensitive to noise through capacitive coupling, and a simple way
    is to add a capacitor which provides a direct path to ground for coupled noise.

    There are other sorts of interference such as magnetic induction which can't be eliminated by lowering
    the impedance, but that's only a problem near transformers or if there's high current wiring nearby.

    (*) equation of capacitor: C dV = I dt, so I = C dV/dt

  6. #6
    Junior Member
    Join Date
    Feb 2021
    Location
    Boca Raton, Florida
    Posts
    7
    Thanks Paul and Mark - this is great, extremely helpful information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •