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

Thread: Analog read affected by multiple pots using the Audio Shield

  1. #1
    Junior Member
    Join Date
    Jan 2021

    Analog read affected by multiple pots using the Audio Shield

    Hi PJRC Forum,

    I would like to read a value from an analog pin A0 on Teensy 4 while also having another pot wired to A1, both 50K pots.
    For my purpose, the middle pot pins are wired to A0 and A1, the left pins to GND and right ones to +5V, no additional resistors.
    It is important to note that my teensy is also soldered to an Audio Shield. I am using a breadboard to test everything.

    The code:
    #include <Arduino.h>
    void setup()
    int val;
    void loop()                     
      val = analogRead(14);
      Serial.print("analog 0 is: ");
    My problem starts while reading the value of analogRead(A0); it seems to change based on the values of other pots wired to the Teensy.
    In other words, turning other pots seems to affect the value of the A0 pin I am reading.
    In addition, the value of the read reaches 1023 already when the pot is about 3/4 turned.

    I have read online about reading the pin twice but this has not solved my issue.
    The problem seems to amplify with additional pots wired to the Teensy and being altered.
    Using an almost identical code and wiring, I have tested the problem on Arduino Nano and Uno; no pins affect each other at all.

    What am I doing wrong here? Is it the Audio Shield? Perhaps I need some pull-down resistors or different pot values?
    My ultimate project involves a set of buttons and pots.
    Pressing a specific button should trigger a button-specific code; however, twisting the pots in my project affects the value of the button read with analogread, making Teensy wrongly recognize which button is pressed.

    Thanks for your help!

  2. #2
    The Teensy 4.0 is a 3.3V device, connecting analog pins to 5V will destroy it. Your potentiometers should be wired to 3.3V, not 5V.


  3. #3
    Junior Member
    Join Date
    Jan 2021
    Thats great advice Pieter, that fixed it!


  4. #4
    Senior Member
    Join Date
    Jul 2020
    50k is a bit high for ADC use, as this means the ADC multiplexer sees upto 25k impedance from the pot.
    When switching between pots the charge stored on the sample&hold capacitor of the ADC can lead to crosstalk
    between inputs unless the impedance is low enough to keep this below 1 LSB.

    10k pots are a good default choice, keeping the impedances at/below 5k. This will also reduce the effect of
    capacitive noise pickup in wiring between microcontroller and the pots themselves.

    But if 50k is working fine for you, no problem, I'd just be aware that such issues can arise.

Posting Permissions

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