ADC, filtering high frequencies for potentiometer input with simple RC circuit  - Page 1
Forum section: electronics / beginners

author: wllmx
author_rank: Newbie
timestamp: June 25, 2023, 07:06:51 pm
content: Hi y'all, I've been having issue with my potentiometers being super unstable when reading them (to the point of a 7 bit reading being wobbly). I'm using high-quality, recently-lubricated pots but a circuit without any passives besides the pot (I know, I know). I've redesigned the circuit, but my EE knowledge is just falling short to know if I'm making sense or not.For the post-pot circuit I picked a value of 100 ohms so the RC filter has a cutoff feq of 160Hz with a step response time of ~5ms. I'm thinking the 100 ohm resistor will not be generating a problematic amount of Johnson–Nyquist noise. For the pre-pot circuit, I added the RC filter to filter out some of the noise before going in, with the capacitor to function as a decoupling capacitor.I really barely know what I'm doing here so any and all feedback is appreciated (even just a: "this doesn't make any sense")Here is the circuit:

author: TimFox
author_rank: Super Contributor
timestamp: June 25, 2023, 07:40:12 pm
content: What type of pot is your "10 k" unit?If it be wirewound, there will be a finite resolution (which a good data sheet will quantify) as the wiper goes bumpety-bump across the winding.For low-value multi-turn wirewound pots (e.g., 100\$\Omega\$, 1.25" trimpot), this resolution can be surprisingly coarse.Wirewound pots are used when their tempco is critical.

author: wllmx
author_rank: Newbie
timestamp: June 25, 2023, 07:58:45 pm
content: Hey Tim, they're carbon film (1 turn, 300deg). They're the panel mount trough-hole Alps potentiometers that you see in a lot of digital audio gear. Thanks for asking! The majority of the issues right now are caused by their instability at rest.

author: DavidAlfa
author_rank: Super Contributor
timestamp: June 25, 2023, 09:13:47 pm
content: You made it way better than required, if still getting issues with that then it must be a problem with the ADC or the power supply.Replace the pot with two fixed resistors, i.e. 2k2+2k2, but I think it'll do the same.What device are you using yo read it?There are MCUs with really bad ADCs, like the esp32.Better if you posted some parts of the pcb and a bit of the ADC schematic.

author: wllmx
author_rank: Newbie
timestamp: June 25, 2023, 09:57:48 pm
content: The circuit I showed is the new planned version, designed to fix the issues of the old one. If nothing looks outright dumb, I'm probably gonna do some testing and order the components etc. Thanks a lot for all the feedback so far guys, really appreciate it!

author: DavidAlfa
author_rank: Super Contributor
timestamp: June 25, 2023, 11:03:58 pm
content: Then it might be the ADC adquisition time.High impedance sources heavily affect the adc, as it charges the internal sampling capacitor.If the impedance is too high and the sampling time too low, you'll get bad readings.ADC capacitance is usually ~10pF, small but still might not fully charge in time.A simple fix is to add a small 1nF cap near the ADC pin, so it has no trouble sourcing the current.Also try increasing the sampling time in the ADC settings.But basically you want at least 5RC time to let the capacitors charge, I'd use at least 10RC for best stability.With 10pf and 10K, 10RC would be 1us.But the ADC pin has also some impedance and there might be other considerations, so check the datasheet and reference manual.