Newbie electronics question: ADC/pots

Go To Last Post
31 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are buying pots to use as knobs read by ADC how do you decide the resistance: 5K, 10K, 50K, 100K, etc?

 

Presumably (because you connect the outer ends to Vcc and Gnd and it's therefore a connection between the rails) the idea is to get the highest resistance possible so the current lost is as low as possible? So is there any actual disadvantage to getting 100K+, perhaps even 1M pots?

 

Also, if reading the wiper position it's presumably much easier (and more accurate) to get linear rather than log pots ?

 

(this is why I usually prefer encoders but in this case I want the knob position to effectively show the value by its position)

This topic has a solution.

Last Edited: Fri. Mar 25, 2022 - 07:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't forget to take into account the input resistance of the ADC, which will add a certain amount of non-linearity, and the charge time of the ADC sampling capacitor. There is a figure in the datasheet for the minimum resistance of a connected source to maintain accuracy/precision.

 

Of course, if your pots do nothing more than give some input value, it doesn't really matter.

 

Unless you are power constrained then I'd be inclined to go for around 10k.

 

And yes, linear pots. Log pots are very inaccurate.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Fri. Mar 25, 2022 - 03:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ADC should see an impedance of 10k or less for best results (has bias currents), so anything up to 20K would be "best".  However, you probably don't need 1000 positions, and if it is an arbitrary knob (without fine markings), what does position really mean?  So even some slight slop is not noticeable.  That would be different if the pot was used as, say, a position sensor for a plotter pen.   

 

Certainly log has its place.  It is more position discernable where the log slope is low (you have to turn the knob a lot to get much voltage change)...or in other words, to get the adc to change 10 steps, you have to turn the knob a lot, whereas in other places 10 adc steps is had just from your shaky fingers.   You get width in one section of travel at the expense of another section.  So linear is often the best choice when things are equal.  And any scaling (log, curves, zig-zags, etc) can be done in software, as they say.   1024 points is generally plenty to work with.  Oftentimes I will stick in a 10 turn pot & 1024 points is still a lot (just a minor nudge, 3.5 deg), to set some pwm value.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Mar 25, 2022 - 04:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm with Brian Fairchild here.  10k is what I typically wind up with, although there are some at 5k or 20k, depending.  Ideally, you want a buffer amp between the pot and the ADC circuit - that gets rid of the ADC input impedance problem - but that might be more parts than you want.

 

The problem with too-high values of pot is that there isn't very much current flowing there, and the slightest upset will do horrible things to your measurements.  With a buffer, those problems go away, and then you can use 100k pots.  I'd be real reluctant to do anything with a 1M pot - just not enough current flowing through it to accurately measure.

 

Yes also to linear.  If you want log results, either put in a log buffer amp or deal with it in software.  Have fun!   S.

 

Eta PS:  Consider also a couple resistors above and/or below the pot, so that when thrown to either limit it's still not a dead short to either Vcc or GND.  They can be pretty small - 100 ohms or so.  S. 

Last Edited: Fri. Mar 25, 2022 - 04:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Making the resistance too high might also increase the chance of getting more noise on the line (in cases where the surrounding environment is harsh and noisy). I am not 100% sure, maybe other freaks can comment on this.

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan
“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint-Exupery

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

and the slightest upset will do horrible things to your measurements.

I always include a cap right at the adc pin & often maybe 1k in series to the pot (gives a little RC closer to the travel ends).  Also gives a bit of protection against cable shorts (such as going to a panel) or miswiring. Dividing by 1000 is much better than dividing by 0. 

Unless I had a really high accuracy need, a buffer seems somewhat overkill (which brings  its own offset and possible gain error (albeit gain is easily set to "1"), at least for a knob.

You could probably "get by" with 100k for a pot (which is 50k max to the adc), and cap---depending on the need.  1 Meg does seem to be over the edge.  If power saving is needed, power the pot from an IO pin. It will almost certainly be accurate enough for most needs.

 

Consider also a couple resistors above and/or below the pot,

I add those sometimes, mostly to protect the wiring/system.  So if a wire coming from 5V gets shorted, it won't bring down the whole system.  You can also then detect if the wiper wire is shorted to gnd or Vcc & turn off the flamethrower.

 

As an aside, always hook up all 3 pot pins to something...never use only 2 pins.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Mar 25, 2022 - 04:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Brian Fairchild wrote:
Unless you are power constrained then I'd be inclined to go for around 10k.
Cheers.

avrcandies wrote:
However, you probably don't need 1000 positions
Being able to discern 128 steps would be good ;-) (MIDI tends to carry 7 bits of info!)

Scroungre wrote:
10k is what I typically wind up with,
reading around it does seem to be 10K used in most examples. I'm guessing it's because of the impedance thing. 10K presumably means 500uA across it (Vcc=5V)? If the thing might eventually be battery powered I wonder how much of a concern this might be?

 

Thanks folks I will very likely go with 10K.

 

BTW I know the picture is not much to go on but does anyone recognize the brand of pot used here. Those are pretty standard tact switches around them to give an idea of scale so perhaps 6-8mm square ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I'm guessing they are from ALPS or Alpha...

 

 

https://www.mouser.co.uk/Product...

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the brand of pot used here

The brand is probably China  cheeky   Cheapo pots are pretty generic (even though there are 100000 styles of generic pots)....usually they will be spec'd like 6mm square body size...do you have a dimension?  You'll see  "the same" pot from 200 different "companies" .....not sure if there is really only one maker or really 200 makers.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


About a generic as things get from Amazon  RV09 (V=vertical) POTS

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah ha "RV09" was, indeed, the "magic" I was missing. Adding that to search terms has opened up an Aladdin's cave !!

 

I also thought that 9mm shaft length was the shortest I could get but now find lots of 6mm which could fit the bill nicely.

 

Thanks everyone. I'm going to mark avrcandies post as the actual solution but only because I only get to mark one post. Several others were very useful indeed :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Is this for your "music box" interface?

 

Is a human sliding the pot back and forth a lot, in real time, or just making occasional adjustments?

 

As it will likely be a front panel control, with a human touching it, you probably want a little protection from static electricity, etc.

 

I would use a 10K, 20K, or 25K pot.

Don't use a 1 M pot unless you want the control to also act like a Thermin, and vary with your hand interaction...

 

I'd suggest a 330 ohm - ish resistor in series with the wiper to the ADC Pin.

I'd put a small cap, perhaps 0.1 uF, from the ADC Pin to Ground.

(Your circuit will have lots of 01. uF caps, might as well just stick with that value.)

 

The Pot, fixed resistor, and cap all form a LPF on the ADC voltage input.

What is interesting is that the cutoff frequency changes with the position of the Pot.

Either way, the "response time" will be fine for a human adjusting the Pot.

 

The classic AVR's spec'd an input impedance to the ADC of <= 10K ohms.

Having the small cap helps to filter out noise, and provides the charge to charge the sample and hold cap in the ADC input circuitry.

(It lowers the Zin to the ADC)

 

For your user interface for your music box you won't need a buffer between the Pots and the ADC inputs, that would be overkill for this application.

It would be useful if you were buffering a carefully designed analog front end for a pH meter probe, EKG, analog color sensor, etc.

 

As shown above, some pots have the extra cage with large mounting tabs, you WILL want those if your human is going to be torquing on the pots for hours on end.

Likewise, I like the through hole pots, (and mounting tabs), for the user interface.

They seem to be structurally more sound.

 

If this is a simple set it and forget it calibration pot, and not subject to continuous usage, then the additional mounting tabs aren't necessary.

 

Good luck with your project!

 

JC

 

Edit: Typo

Last Edited: Fri. Mar 25, 2022 - 08:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Jay,

 

I don't suppose you have heard of the "Pocket Operators" from Teenage Engineering (a Swedish kickstarter start-up, orginally)?

 

https://teenage.engineering/prod...

 

 

Now I collect "small synths". I tend to collect them as I'm always on the look out for the perfect "handheld synthesizer". Especially one that would bring back memories of the Casio VL-1 I owned 30 years ago. Up to now I'd seen the POs but never got one.

 

Then for Valentine's Day this year my wife got me a PO-32 (the "Tonic" (as in "Gin & Tonic"), the one just disappearing off the left in the above picture) and it's a revelation! It's actually a drum machine rather an a melody generator but it's SO addictive simply to "tinker" with. In fact I've learned more in a month or two about drumming and rythmn patterns than I ever knew in the previous N decades !

 

Unlike so many small/portable synths (even down as far as the Modal Craft 2 or the Korg NTS-1 : others that I own) these truly are the synth you can slip into your pocket. And it makes them so much more usable as you can just carry it anywhere (I take it out to the shed when I'm sitting with cat#2 and it drives him demented - it even has a small speaker in the design.

 

As you can see in the picture the design is deliberately "industrial". On the flipside they are something like:

 

 

The clip holds two AAA batteries.

 

But among the range, while there are samplers, drum machines and subtractive synths, there isn't an FM synthesiser and just recently I've been getting interested in FM synthesis so I wanted to have a crack at making a handheld. Not "copying" the POs but "inspired" by them. I've also been considering getting this recently and its design is equally inspiring:

 

It has an unusual approach to FM synthesis. Instead of the modulator/carrier relationship of the operators being fixed so you only have 20-30 fixed connection "algorithms" to choose from (think "Yamaha DX7" or Korg Volca FM), the Liven XFM is different in that every one of the four operators can be connected to any of the other four in any connection pattern you choose. To achieve this a LOT of adjustments are required. Each op has four controls for it own ADSR, envelope then there is the harmonic multiplier for each operator, also control for the amount each feeds into each of the other ops and itself (feedback). In fact it's so complex that almost all the buttons you see above have a second function (printed on an overlay you put on top while editing) just to configure all the sound paths

 

In fact there is also an online FM synth demo:

 

https://notes.ameo.design/fm.html

 

 

that has a very similar design (anything can feed to anything). Only in that case it's not just 3 or 4 operators but 8!! So imagine that every square on that grid were a rotary control to set the level. In column 1 the control is the op's frequency multiplier then across the grid it's the amount of feed from each op into each other op. Finally, in the right column it's the feed of each op's output to the output mixer.

 

If you scaled that back to just 4 ops it would be kind of what I have in mind. In fact I sketched this out (actually this is an old version - current is more "matrix"y)

This is my UI design in the PC app "Ctrlr" that would send MIDI CC and just be used for testing until there's pots/encoders/whatever in real hardware to use for control.

 

The actual core synth design would be something like:

 

On which each mixer (5 of them) need 4 controls and the envelopes each need 4 controls for their ADSR. It might look like an explosion in a spaghetti factory but that's because every sine oscillator and its envelope has to be able to feed to every other one (and its self for feedback)

 

Now I know you can do this in far less controls with encoders and a display. In some user interface you would switch to the right page (eg ADSR for op3)  and then use 4 encoders (say) to wiggle that thing's controls. But I like the idea of a physical matrix where you can see (and twiddle with) the position of absolutely everything at once on a large grid of knobs. And the position of each control is your immediate feedback to show how it is set. In fact it might not need a display at all (though I have some 128x64 OLEDs coming with a view to showing oscilloscope and/or spectrum analysis view to the user). The concern of an OLED is the battery usage. That is where the segmented LCD of the POs scores highly. The display is "always on" but the things run for months on one set of AAA batteried.

 

As I want to keep my design "handheld"/portable, hence the need for a lot of little knobs. 

 

I already ordered 30 mini encoders (for just £20!) that are on a slow boat from China already but then I was thinking that pots with knobs (that have a "notch" to show where they are set) is perhaps more "old school" and immediate than an encoder that gives no positional feedback about what value the control represents.

 

I might actually get pots with knobs:

 

just in case knobs gives a better visual "feedback" to where the control is set. But it's tempting to just remove the knobs and leave them off to one side to have more "industrial"/exposed controls like pocket operators.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
(this is why I usually prefer encoders but in this case I want the knob position to effectively show the value by its position)
Absolute encoders are stocked though an order of magnitude more expensive than pots.

Competition in magnetic angular position IC is increasing (AMR, TMR)

 

Absolute Encoders – Mouser

https://youtu.be/6Sv42swys0k?t=503 for 10s on replacing pots in audio mixers for dusty and wet environments (replace IP-rated pots)

in Coffee Break | S2E4 | Remove Magnets to Improve Your Position Sensor Design - YouTube

LDC instead of an ADC (inductance to digital converter); IIRC, Texas Instruments was first to market with Microchip Technology for radiation-tolerant LDC.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, way too much for my brain to keep up with!

 

To fit all of those pots / encoders, with finger wiggle room, on the front panel will mean you need big pockets if it is pocket carryable.

The little Sinclair scientific calculator was a marvel in its small size.

I guess you can shrink the above down, somewhat.

 

While you are thinking about pots and encoders also remember that you can get them with a push button switch on the rotary control.

That could give you an instant "Auto-Center" for each control, or push and hold for the 2ND Function on the control, or...

 

I would likely build a desktop version first, with lots of room for the user interface, mains power, and lots of room for the circuitry.

It would also be significantly easier to modify / revise, (if needed ;)  ) than a micro-sized version.

Once I had the Beta up and running, I'd think about how to shrink it. 

 

It sounds (no pun intended) like a truly great project!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
(which brings  its own offset and ...
Significant competition in zero drift op amps; auto-zero op amps for reasonably steady ambient.

 

AS2333 (Operational Amplifiers) (Diodes Inc.)

Coffee Break | S6E3 | Catch My Drift: Design Considerations for Zero-Drift Amplifiers - YouTube (14m19s)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
As shown above, some pots have the extra cage with large mounting tabs, you WILL want those if your human is going to be torquing on the pots for hours on end.
More likely is wrenching (knob sustains side impulse typically by a drop onto pavement ... roadiessmiley

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I might actually get pots with knobs:

I'll add not long ago I got a big bag (maybe 200) of those exact random color knobs from ebay for only a few bucks.  They fit great & once pressed on, stay there!

 

The stem type switches can also have "button caps" put on top...I wasn't lucky there.  For whatever reason they will say "4mm" round/square cap, or whatever, but never give the shaft diam.

So I took an eyeball guess, and guessed wrong..I got a bag full that won't fit any of my switches...oh well $3 down the drain!   

 

You might like adding one of these to your panel, let your fingers do the tap dance or electric slide with this 10K pot.  They peel and stick (and are meant to go under a graphics overlay)

 

 

As an aside, while looking for the finger pot (used one around 1990), I found the following unique item--never seen this anywhere.

 

https://media.digikey.com/pdf/Da...

By bringing the exterior magnet into a proximity necessary to connect with the internal magnetic attractors, the operator can obtain linear position sensing based on the location of the exterior magnet. As the exterior magnet moves, so does the electrical output of the MagnetoPot.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sat. Mar 26, 2022 - 12:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cliff, have you seen Ken Shirriff's analysis of the DX7 chipset? https://www.righto.com/2021/11/r...

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To choose the size (end-end resistance) of a pot as an ADC input, I use two primary criteria:

 

1) What is the maximum suggested ADC source resistance? For many AVR ADCs, it is 10K, as I recall. Then I note that the highest source resistance seen looking into the wiper occurs when the wiper is exactly at the middle of the pot. The source resistance is the parallel combination of the top half of the pot and the bottom half of the pot. For a 10K source resistance, you could have the top half be 20K and the bottom half be 20K and meet the 10K limit. Thus, the maximum pot resistance would be 40K, which is probably a very non-standard value. This limit would be satisfied by ANY pot that has a resistance less than  40K.

 

2) The maximum allowed power supply current. Often, the pot is connected between Vcc and ground. Then the pot would increase the power supply current by Vcc/Rpot.

 

These are the basic criteria but they are tempered by an additional fact: What is the maximum desired pot voltage? This depends on the available ADC reference voltage(s). Often, Vcc is one of the permitted reference voltages and this works well with a pot that is connected between Vcc and ground. But, some ADCs have much more limited choices for reference. One example might be a 2.5V reference with a Vcc of 3.3V. In this case, the optimum pot value is more complex because there are three things to juggle. One can derive a set of equations to use for value selection, but they probably are not worth the effort here.  Instead, it may be more useful to note that, for MOST situations, using a 10K pot with a chosen dividing resistor between Vcc and the top of the pot will always meet the 10K source resistance requirement because the maximum resistance seen looking into the wiper will always be less than 10K, no matter what the dividing resistor is. 

 

It is also important to note that the tolerance on potentiometer resistance is usually fairly poor; 10% or worse is quite common. This means that you might not hit an exact 2.5V when you try to divide down Vcc=3.3V to 2.5V in order to match an ADC reference of 2.5V.  There are ways that you can improve this, some, at the cost of additional power supply current.

 

Hope this helps

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Y' all are nuts.  If you want a pretty noise, allow me to quote Flanders and Swann:

 

 I had an urge and I had to obey it.

I found a French horn in a second-hand shop.

I polished it up and I started to play it...

 

cheeky  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...in spite of the neighbours who begged me to stop.

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
Unless you are power constrained then I'd be inclined to go for around 10k.
yes
DocJC wrote:

I'd suggest a 330 ohm - ish resistor in series with the wiper to the ADC Pin.

yes.Tried to built with MKM or at least multilayer caps.Also metal film resistors.

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used some pots as front panel controls for a recent project. Although they were linear, the first and last 10-15 degrees or so were decidedly non-linear. Maybe this was the particular pot - we were constrained to a particular type for other reasons. I set threshold values of (something like) 10% and 90% and only used the range in between those two points. Suitable front panel artwork indicated the range that was meaningful.

 

Greg

regards
Greg

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it's non-linear I guess one could use some kind of translation (maybe linear interpolation) conversion table but it would be a pain if each control has to be profiled. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although they were linear, the first and last 10-15 degrees or so were decidedly non-linear. Maybe this was the particular pot

...some pots have a little metal at the travel ends that the wiper rides into....that can be good if you want to ensure you have 0000 ohms there.  They might even spec that

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to report back. So the Aliexpress boat finally arrived from China and I got one hundred of two different shaft length RV09 10K pots. So I wired samples up to an Arduino.

 

I thought I wanted the shorter shaft ones as they are most like the short shaft encoders on Teenage Engineering Pocket Operators. But in reality it's the longer ones that look the part and feel easily "grabbable". 

 

Inevitable video (with curious audio track added on top) of me twiddling knobs with output on that stupidly small I2C OLED screen... 

 

https://youtu.be/-MclDUuPv78

 

Last Edited: Fri. May 6, 2022 - 06:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 (with curious audio track added on top)

 The question, of course, is whether the music in the video's background is from your device, (as discussed above)?

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nope I recorded video on my phone then uploaded to YouTube and only then realised you could hear my swivel chair creaking in the background. So I looked for a way in both YouTube Studio online and also the Studio app on my phone but it seems you can't just delete the audio. But YouTube offer a bunch of licence free music tracks you can put "on top" so I deliberately picked one that sounds "synthy".

 

It's going to be a while before I actually have my own design (FM) synth implemented. In fact I'm going to do the design in two stages. Just make a button/knob/display controller first that outputs MIDI CCs then implement the synth engine to take MIDI as input. The two can be implemented and tested in total isolation and will actually be useful without the other one. I can drive the synth using Ctrlr app on Windows without needing the physical MIDI controller and I can use the MIDI controller to input to PC apps (as long as I make the CC numbers user configurable) 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've said it before, but it bears repeating:  What a cool project!

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
What a cool project!
Nice Cliff.yes

www.tokopedia.com/madagang .Buy and Donated cheap electronics and manuscripts.