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

Thread: analogRead() question

  1. #1

    analogRead() question

    hi there,

    i need a 12-bit resolution for some of my analog measurements in a project, so i change the resolution in setup() like so:

    analogReadResolution(12);

    other parts of the code need only a 10 bit resolution.

    since this project should run at low latency... is there any speed difference in reading 12 bits and bitshift by 2 (>>2) v.s. setting the resolution to 10bit?

  2. #2
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    727
    Yes, but I encourage your to measure how much yourself.

  3. #3
    Hallo lokki

    I tested the ADC in the Teensy 4.1. The ADC is very noisy. A resolution of 12 bits is hardly usable. The ADC reference voltage is coupled to VCC. That is a big problem. External smoothing of the ADC reference voltage is not possible. I shifted the resolution to 7Bit and set analogReadAveraging to 32. I use potentiometers at the ADC input for parameter setting from 0-127 of the envelopes.


    My measurements

    12Bit resolution with noise (Averaging to 32 and read interval every 50ms)


    10Bit resolution without noise (Averaging to 32 and read interval every 50ms)


    8Bit resolution without noise (Averaging to 32 and read interval every 50ms)


    12Bit resolution shift 4 to right without noise (Averaging to 32 and read interval every 50ms)



    Code:
       init analog Inputs
      analogReadResolution(12);
      analogReadAveraging(32);
    ..

    I think an external 12Bit ADC chip is the better solution, e.g. MCP 3208-CI / P.

    Best regards from Germany. Rolf

  4. #4
    Unfortunately, I cannot edit my post. The image title is incorrect. It is called with noise not without. Sorry ..

Posting Permissions

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