Pot jitters during ADC capture


+ Reply to Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Tried shifting out low 4 bits.


    ...mostly stable


    But now the high range only goes up to 976 or so.
    kinda makes me wonder how that can even work

    perhaps show your code
    Warning I'm not a teacher

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    I have to clean it up first. It's a mess from all the trials.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    You had slide pots made for you? That can't be cheap...

    It's a linear 10K slide, my rotaries are 5K, but that shouldn't matter.
    With those values it probably does not matter but don't just write it off.
    The sample & hold circuit in the ADC works by temporarily connecting a small capacitor to the selected input. This capacitor is charged thru the impedance of the voltage source (your potentiometer) - which varies depending on where along the "track" the slider is positioned. If the jitter is worse with the slider closer to the bottom than to the top it could be an issue.

    Look at section 17.4 (or table 27.21) of the datasheet for the 26K22. It states that the maximum recommended impedance is 3k.

    If nothing else you could try filtering the wiper voltage with a capacitor, say 1uF and then buffer the signal with a rail-to-rail OP before feeding it to the PIC.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    With these pots (slider 10K) I would first use an opamp as buffer, feed a 1K series resistor, then a parallel 10uF cap and then a buffer opamp again before driving PIC input.

    Just to be sure...

    Most PIC I used before had 10K input impedance of Sample and Hold ciruit. This 3K that Henrik mentioned is too low for a 10K pot!

    Ioannis

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Quote Originally Posted by Ioannis View Post
    With these pots (slider 10K) I would first use an opamp as buffer, feed a 1K series resistor, then a parallel 10uF cap and then a buffer opamp again before driving PIC input....
    I had never seen that suggested in my "debounce potentiometer" research. Starting to look into it (after I understand what it's doing ).


    Quote Originally Posted by Ioannis View Post
    ... Most PIC I used before had 10K input impedance of Sample and Hold ciruit. This 3K that Henrik mentioned is too low for a 10K pot! ...
    First time I hear that too.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Quote Originally Posted by HenrikOlsson View Post
    You had slide pots made for you? That can't be cheap....
    (made for me) as in I ordered them on Alibaba, but they were stock, no customizations. They only mods I had done, were within the company's available options (single slide, longer handle, dust cover, etc).


    Quote Originally Posted by HenrikOlsson View Post
    ...If the jitter is worse with the slider closer to the bottom than to the top it could be an issue...
    I just checked, it's similar at both ends (visibly 3-4 bits jittering on my LCD display)


    Quote Originally Posted by HenrikOlsson View Post
    ...Look at section 17.4 (or table 27.21) of the datasheet for the 26K22. It states that the maximum recommended impedance is 3k. ...
    Oh snap, I've been seeing everywhere that 10K is the accepted norm for ADC on Microchip PICs. Never even checked the specific datasheet (that and my mind is having a hard time using the word impedance and associating it with resistance - don't ask me why).


    Quote Originally Posted by HenrikOlsson View Post
    ... If nothing else you could try filtering the wiper voltage with a capacitor, say 1uF and then buffer the signal with a rail-to-rail OP before feeding it to the PIC.
    Starting to google that now...
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Quote Originally Posted by HenrikOlsson View Post
    ... Look at section 17.4 (or table 27.21) of the datasheet for the 26K22. It states that the maximum recommended impedance is 3k. ...
    Henrik, is it possible your datasheet has an error?

    Is it possible you were looking at a low-voltage variant?

    Mine says 10K max. I had actually highlighted it during my research on ADC.

    (turns out Mr E really did teach me to RTFM )


    Name:  18F26K22 impedance.png
Views: 8268
Size:  41.7 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    The higher the source (pot) resistance the greater the error in the voltage that PIC ADC will read. So, adding an opamp as a buffer will add no load to the source (pot) as it ihas very large input resistance (impedance that is) and too low, in the order of ohms output resistance. So it will drive any ADC input with no error introduced. For your experiments I proposed two opamps to buffer the r-c filter, as this filter will increase source resistance.

    Ioannis

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    I'm looking at this post:

    https://electronics.stackexchange.co...c-analog-input


    I have 3 slide pots, so I found a quad op-amp OPA4314 at JLCPCB:

    https://wmsc.lcsc.com/wmsc/upload/fi...WR_C129333.pdf


    Interesting stuff. This never came up in my research to debounce a pot. They quickly lose me when they talk about frequencies and Nyquist. I'm assuming this relates with audio. I'm just sampling a pot and wouldn't know how to tweak that R/C combo.

    The R/C combo here is WAAAAY lower:

    https://electronics.stackexchange.co...t-input-to-adc


    Found an explanation on how to chose the R/C combo between a buffer and ADC here:

    https://electronics.stackexchange.co...-an-adc-input:


    It points to a TI note that suggests 100R/1nF for the OPAx365 (in the image). I'm assuming this is an excellent starting point; TI describes it as "ideal for driving sampling analog-to-digital converters (ADCs)".

    https://wmsc.lcsc.com/wmsc/upload/fi...BVR_C96626.pdf


    Only available in single and dual, but still relatively cheap (from what I expected, I'm just happy it's available at JLCPCB).
    Last edited by Demon; - 8th August 2024 at 02:38.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  10. #10
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    a voltage follower amp is really only a benefit if the signal source impedance is so high that the adc input loads the signal so much to make it inaccurate. it will not smooth out a crappy pot if anything it may accentuate it.
    a lowpass filter will help whether its analog pre adc or digital post adc will make little difference
    right now I'm working with FSR'S [force sensitive resistors] with 200k to 500k resistances on a pic 16f18426
    no problem what so ever

    what do the pots perform like when measured on a ohmmeter [an analog one would be ideal]
    if they are really that bad then the resolution achievable will be low no matter how you go about it
    especially if there are dead spots
    Last edited by richard; - 8th August 2024 at 04:09.
    Warning I'm not a teacher

  11. #11
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Quote Originally Posted by Demon View Post
    Interesting stuff. This never came up in my research to debounce a pot.
    Maybe because you do not debounce a pot but only a switch or push button. Pots are filtered in the rare case of noise. Usually are rock stable and with a couple of averaging there is no problem.

    Ioannis

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    Quote Originally Posted by HenrikOlsson View Post
    ...Look at section 17.4 (or table 27.21) of the datasheet for the 26K22. It states that the maximum recommended impedance is 3k...
    HENRIK FOR THE WIN!

    I migrated to a 16F1937 and the pot is now acting marvelously. I now jitters at most only 1 value (what I initially expected when the wiper straddles zones).

    WOOT!!!
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    I do not think this made the difference...! Probably a bad connection.

    The lower sample and hold impedance would add error to your A-to-D conversion. Not jitter.

    Ioannis

  14. #14
    Join Date
    May 2013
    Location
    australia
    Posts
    2,643


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    I do not think this made the difference...! Probably a bad connection.
    +1
    me too or bad code
    Warning I'm not a teacher

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Pot jitters during ADC capture

    I just noticed this gem from Darrel:

    https://dt.picbasic.co.uk/CODEX/AtoDAveraging

    You know how the least sigificant digit will "wobble" back and forth between 2 numbers? It's half-way between 2 numbers and it can't quite figure out which one it should be. Well, this adds hysteresis to the averaging routine to eliminate that.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Using hardware capture
    By Bruce in forum Code Examples
    Replies: 14
    Last Post: - 25th March 2012, 05:52
  2. Capture woes...
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 22nd May 2011, 08:36
  3. Capture with PIC16F88
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th March 2010, 13:05
  4. Capture without CCP
    By boroko in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th March 2009, 23:09
  5. Capture
    By SlotH in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th May 2005, 19:17

Members who have read this thread : 14

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts