CV Potentiometer ADC help
  • Hi, everyone. Happy Holidays. I’m fairly new at circuit design and could use some guidance.

    I’m trying to read a 10k potentiometer with an ADC input pin on a micro-controller for my DIY modular synth project. The circuit is pretty simple at the moment with one pot end pin to 3.3V and the other to AGND. The pot wiper goes to the input pin. This pot will be a manual CV control for the software.

    What resolution should I be aiming for here? 10 bit, 11 bit, 12 bit ? I don’t think higher than any of those, because physically turning with your hand is really not possible with that many values.

    I’m also having trouble getting the ADC values to be stable after reading. Maybe this project needs decoupling capacitors and smoothing software? I read a little about those two solutions, but need some help. Any idea how I should decouple and maybe some code I could use?

    Thanks!

  • > What resolution should I be aiming for here? 10 bit, 11 bit, 12 bit ?
    > Maybe this project needs decoupling capacitors and smoothing software?

    Hard to know without knowing which MCU you use. I suggest you to read the application notes published by the manufacturer of the MCU you use – you’ll learn for example that on an AVR, you get the 10 bit resolution only if you stop all peripherals during the acquisition. Or that there are silicon “bugs” on STM32F4 that seriously downgrade ADC performance.

    Adding a small capacitor (100nF) between the wiper and ground can help (note that it’s not called a “decoupling” capacitor – it works by filtering the discontinuity you can have while the ADC multiplexer and S&H does its thing), but the bulk of the work will have to be done in software.

    You can do one or several of those things:

    • Average the past N readings and use this as a reading (that’s equivalent to a FIR filter).
    • Sort the past N readings and average the readings between rank N/4 and 3N/4 (a variant of the method above, more robust to abnormal deviations).
    • Use a one-pole low pass filter (value += 0.01 * (new_value – value)).
    • Use hysteresis: if (abs(new_value – value) > threshold) new_value = value;

  • Its always a good idea to connect the top of your pot to a stable source, preferrably some sort of 3.3V voltage reference. As a short fix, you could add a decoupling capacitor between 3.3V and GND right next to the pot, but I doubt the effect would be significant.

    Keep in mind that even with a perfectly stable voltage on the ADC input pin, there will always ripple in your DAC readings due to the relatively bad characteristics of the builtin ADCs. The most common way to deal with this is to add some software filtering to values to even out those tiny jumps.
    I think its best to read 10bit or 12bit values and low pass filter them afterwards. Most synths will probably have an internal resolution af 7 or 8 bits to the values they store in the patch data. This is enough for most use cases. If stepping becomes audible, you can always add interpolation. E.g. the Analog 4 by elektron works that way. Most parameters are in ranges of 0-127 (7bit; this also makes it easier to reproduce patches because you can dial in the exact same numbers to create the same sound) but they are smoothed out with interpolation to reduce the audible stepping.

    Edit: oops, pichenettes was faster once again

  • Thanks guys! I’ll try all these tips out.

    MCU is Teensy 3.1 https://www.pjrc.com/teensy/teensy31.html
    power supply is https://www.adafruit.com/products/501?gclid=CKfC_YXsor0CFQ8OOgod9F4AJQ

    I guess it could be possible that some noise is from the MCU or PSU.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion