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

Thread: Improve ADC Readings Teensy 4

  1. #1
    Junior Member
    Join Date
    Mar 2020
    Posts
    1

    Improve ADC Readings Teensy 4

    Hello Guys,

    Today I connected the Teensy 4 ADC to a signal generator and started measuring.
    I included the simple ADC Reading Script and the Serial Output of the values. As you can see the ADC Readings are "quite" noisy. I know that the teensy 4 is not a high-end professional adc device, but is there a way to improve the adc accuracy?

    I used averaging, but that did not really help.

    The first thing that came to my mind was to use an external reference voltage that performs better than the inbuilt voltage regulator.

    What do you guys think?


    Code:
    // variables
    int adcs = 0;                   // raw value from analog in
    float voltage=0.0;                 //Voltage
    // constants
    const int adcPin = A2;           // analog in pin identifier
    
    /* setup, run once */
    void setup(){
        Serial.begin(9600);
        // configure Teensy pins
        analogReadResolution(12);   // (0-4095)
        analogReadAveraging(12);
     }
    
    /* loop, run continuously */
     void loop() {
    
     
        adcs = analogRead(adcPin);
        voltage= (adcs * 3.295)/4095;
        Serial.print("ADC Value: ");Serial.print(adcs);Serial.print(" Voltage: ");Serial.println(voltage,3);
      
        delay(250);
    }
    HTML Code:
    ADC Value: 2500 Voltage: 2.012
    ADC Value: 2505 Voltage: 2.016
    ADC Value: 2497 Voltage: 2.009
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2497 Voltage: 2.009
    ADC Value: 2494 Voltage: 2.007
    ADC Value: 2488 Voltage: 2.002
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2497 Voltage: 2.009
    ADC Value: 2498 Voltage: 2.010
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2495 Voltage: 2.008
    ADC Value: 2497 Voltage: 2.009
    ADC Value: 2501 Voltage: 2.012
    ADC Value: 2500 Voltage: 2.012
    ADC Value: 2503 Voltage: 2.014
    ADC Value: 2498 Voltage: 2.010
    ADC Value: 2495 Voltage: 2.008
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2495 Voltage: 2.008
    ADC Value: 2503 Voltage: 2.014
    ADC Value: 2507 Voltage: 2.017
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2503 Voltage: 2.014
    ADC Value: 2494 Voltage: 2.007
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2502 Voltage: 2.013
    ADC Value: 2504 Voltage: 2.015
    ADC Value: 2496 Voltage: 2.008
    ADC Value: 2496 Voltage: 2.008

  2. #2
    Member
    Join Date
    Feb 2018
    Location
    Corvallis, OR
    Posts
    58
    The Teensy 4.0 doesn't have any capability to use anything except V3.3 as the analog reference. If you need better results, you'll need an external ADC.

    Various earlier posts say that the T4.0 ADC really only has 10 effective bits--or one part in 1024. For a max 4096 counts, that's about 4 LSBs. You could improve things a bit with more oversampling and filtering, but intermittent loads on the 3.3V (such as writing to SD cards) are going to tweak the 3.3Volt reference and add noise.

Posting Permissions

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