Digitising CV pot (thermal noise?)

Looking at the Rings schematics, I see that e.g. the frequency pot’s center tap is wired directly to the MCU GPIOs used for the ADC, without anti-alias filtering. When I do the same thing, my ADC reads values that jump across a range of about 5 contiguous values for any given pot position.

@pichenettes did you initially experience the same thing? I intuit it could be caused by the pot’s thermal noise, and I’m curious to know how you might have mitigated that. I suspect it is addressed here (or not?) but I’m not making sens of it:

float fm = adc_lp_[ADC_CHANNEL_CV_FREQUENCY] * 48.0f;
float error = fm - fm_cv_;
if (fabs(error) >= 0.8f) {
  fm_cv_ = fm;
} else {
  fm_cv_ += 0.02f * error;
performance_state->fm = fm_cv_ * adc_lp_[ADC_CHANNEL_ATTENUVERTER_FREQUENCY];
CONSTRAIN(performance_state->fm, -48.0f, 48.0f);

float transpose = 60.0f * adc_lp_[ADC_CHANNEL_POT_FREQUENCY];
float hysteresis = transpose - transpose_ > 0.0f ? -0.3f : +0.3f;
transpose_ = static_cast<int32_t>(transpose + hysteresis + 0.5f);

It’s unlikely the pot would be turned fast enough to generate frequencies above twice the ADC sample-rate.

You did not specify which MCU you’re using, and what is the ADC acquisition time and sample rate, but it’s very likely to be due to the poor performance of the MCU’s built-in ADC itself. There’s nothing you can do about it besides low-pass filtering the ADC readouts in software (on recent MCUs, like the H7, there’s a hardware averager than can be enabled).

This is where a one-pole filter is applied on the value read by the ADC.


I’m using an STM32F407 (Discovery board) with the ADC in interrupt mode. The sampling time is ADC_SAMPLETIME_480CYCLES, the APB clock divider is RCC_HCLK_DIV4, and the system clock is running at 168MHz.

Indeed. But it is my understanding that thermal noise energy is present up to very high frequencies (at some point it exponentially decreases to zero); Wikipedia states that at room temperature this transition occurs in the terahertz. I could be wrong but I expect it to be even higher for a module in a case where the ambient temperature is higher. Did you ever experiment with putting an analog anti-aliasing filter on the input?

I can believe that. I could put in a simple averaging low-pass filter without losing out too much in responsiveness. I might try that, thanks for the suggestion.