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

Thread: Analog Input Noise at Midrange

  1. #1
    Junior Member
    Join Date
    Jan 2021
    Posts
    6

    Analog Input Noise at Midrange

    Hi all,

    I'm having a problem with analog input on my Teensy 4.1 not behaving linearly. At about 1.6-1.7V, I'm getting a lot of noise on the analog input. The measured values fluctuate about +/-15 counts, which works out to about 90mV. The input behaves normally at higher and lower voltages, but I'm finding that this noise creates a discontinuity in my sensor measurements that would otherwise behave linearly. Is there a way to eliminate this noise?

    One interesting thing I found was that it is quite difficult to actually set the potentiometer to 1.65 volts, as the slightest touch to adjust the Pot would move the voltage a large amount. Below 1.6 or above 1.7 volts it was much easier to adjust the voltage, the potentiometer wasn't as "touchy."

    Here's a screenshot of the serial plotter, note the noise between 500 and 530 counts:
    Click image for larger version. 

Name:	Teensy_Analog_Troubleshooting_Annotated.jpg 
Views:	25 
Size:	53.8 KB 
ID:	25696

    Here's my setup and code:

    Hardware:
    Teensy 4.1, powered by PC USB
    Benchtop power supply supplying 3.3V
    Potentiometer for adjusting voltage
    Multimeter for measuring voltage.

    Click image for larger version. 

Name:	Teensy_Analog_Troubleshooting.jpg 
Views:	30 
Size:	128.6 KB 
ID:	25695


    Code:
    void setup()
    {                
      Serial.begin(38400);
    }
    
    int val;
    
    void loop()                     
    {
      val = analogRead(17);
      Serial.print("analog is: ");
      Serial.println(val);
      delay(250);
    }

  2. #2
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    1,085
    Does it occur when you use the power supply connected directly to the ADC input (no pot)?

  3. #3
    Quote Originally Posted by Doodads View Post
    One interesting thing I found was that it is quite difficult to actually set the potentiometer to 1.65 volts, as the slightest touch to adjust the Pot would move the voltage a large amount. Below 1.6 or above 1.7 volts it was much easier to adjust the voltage, the potentiometer wasn't as "touchy."
    Which suggests that there is something flaky with the pot. Since you are feeding the pot from an external supply, drop its voltage to say 2V. Does the problem occur at a proportionally lower voltage? If yes then it is definitely the pot. If it stays at 1.65V, then it might be the ADC.

    ADC's work best with low pass filtered and buffered signals.

  4. #4
    Junior Member
    Join Date
    Jan 2021
    Posts
    6
    Quote Originally Posted by jonr View Post
    Does it occur when you use the power supply connected directly to the ADC input (no pot)?
    I tried this out, and the noise does not occur. Interesting!


    Quote Originally Posted by UhClem View Post
    Which suggests that there is something flaky with the pot. Since you are feeding the pot from an external supply, drop its voltage to say 2V. Does the problem occur at a proportionally lower voltage? If yes then it is definitely the pot. If it stays at 1.65V, then it might be the ADC.

    ADC's work best with low pass filtered and buffered signals.
    I gave this a try at 2.3V on the power supply, and the noise went away when lowering the voltage, but then reappeared when I adjusted the potentiometer to 1.65V on the analog input. So it's not an issue with that spot in the potentiometer travel, but maybe with some other property of the potentiometer? Here's a graph of what happened:

    Click image for larger version. 

Name:	Teensy_Analog_Troubleshooting_Annotated_2.jpg 
Views:	16 
Size:	68.5 KB 
ID:	25712

    The fact that the problem does not occur when directly connected to the power supply makes me think it's not an issue with the Teensy, but I'm still stumped on why I'm seeing the noise with the potentiometer. My actual use case on my project is reading a 4-20ma sensor over a 165ohm resistor. I think solving the potentiometer noise issue could help solve my sensor noise issue as well?

    UhClem, does the secret lie in the low pass filter and buffering? As an electronics novice, would I be better served using an external ADC, or could it be as simple as adding a capacitor to my existing setup?

  5. #5
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    1,085
    > I tried this out, and the noise does not occur. Interesting!

    This suggests that you should use a lower impedance source. Or add capacitance near the teensy pin.

  6. #6
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,371
    I'd be worried that sometime else is using the pin digitally and this is the effect of an input gate or Schmitt-trigger or some such.
    What is the impedance of the potentiometer?

  7. #7
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,371
    Incidentally this is probably related to this problem: https://forum.pjrc.com/threads/68621...-on-Teensy-4-1

Posting Permissions

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