analogRead() question

Status
Not open for further replies.

lokki

Well-known member
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?
 
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)
12-Bit-noise.jpg


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


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


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



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
 
Unfortunately, I cannot edit my post. The image title is incorrect. It is called with noise not without. Sorry ..
 
Status
Not open for further replies.
Back
Top