Pot jitters during ADC capture


+ Reply to Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,144


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    I have not seen Henrik's piece of code, but as he noted it is not a sort or fast one.

    In the mean time, maybe you can:

    1. find the reason of the jitter/noise of the pot output.
    2. try getting 10 samples, sort them, keep the middle 4 or 5 ones, add and divide by 4 or 5 to get the average.

    seems a lot but is fast enough for most of the cases.

    For a sorting routine see here: https://www.picbasic.co.uk/forum/sho...highlight=sort and this https://www.picbasic.co.uk/forum/con...orting-Numbers

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    It's a hardware issue, the pots are brand new. The slider overlaps multiple resistor changes. I don't get these jitters using my rotary pots.

    I read the big ADC thread:
    https://www.picbasic.co.uk/forum/sho...eading-Routine

    - using 10-bit ADC on 18F26K22
    - take 16 readings into a table
    - sort using Melanie's routine
    - take the median average
    - add previous average twice and divide by 3 for exponential average

    ...still jitters.

    I placed a small cap across VSS and wiper.

    ...still jitters.

    I tried this low-pass filter with 16K and 10uF:
    https://www.instructables.com/Smooth...iometer-Input/

    ...still jitters.

    Tried shifting out low bit.

    ...still jitters.

    Tried shifting out low 2 bits.

    ...still jitters.

    Tried shifting out low 3 bits.

    ...still jitters.

    Tried shifting out low 4 bits.

    ...mostly stable

    But now the high range only goes up to 976 or so.

    I'd have to convert to a ratio of 1023 for my variables (MS Flight Sim variables=0-1023).
    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
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Took the average of middle 4 entries, still jittered.

    Gradually dropped off low bits until I was down to 6 high bits.

    It jitters a LOT less. It's at a level that would be acceptable.

    I guess that's the price I have to pay when I use the "most affordable new pots from China".
    Last edited by Demon; - 5th August 2024 at 23:48.
    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!

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    did you do a test with a different regular pot instead if slider, and did you try, say a, 1 microfarad across Vss and slider tap ?

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


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Quote Originally Posted by amgen View Post
    did you do a test with a different regular pot instead if slider, and did you try, say a, 1 microfarad across Vss and slider tap ?
    I had made tests a few days ago using various ceramic and electrolytics up to 10uF with no improvement.

    I have one last thing to test, gonna report back.
    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
    Nov 2003
    Location
    Greece
    Posts
    4,144


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Quote Originally Posted by Demon View Post
    Gradually dropped off low bits until I was down to 6 high bits.
    Well, 4 bits down means the jitter is max 15 counts of the ADC... This is too much!

    Cannot understand how can a pot have so much bad connection of its wiper... If you use this port in audio circuit, it should make a lot of noise! Even old and dusty pots, if stationary, do not have such behavior

    But then you said that with rotary pots you do not observe any jitter. All the sliders do the same?

    If yes, better dump them and get decent ones.

    Ioannis

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Sorry for the delay but the thread is a decade old so....
    What's the value of the pot in question? Link to actual product or datasheet?

    It certainly sounds like a hardware issue. If it works OK with a rorary pot, of the same value, then the slide pot is crap - obviously.

    But, do you really NEED 10 bit resolution? Even if you throw away say 3 bits you still have 127 discrete values. On a 70mm long pot that's about 0.5mm movement. If the sim software expects 10bits then just shift the value left three digits.

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    if the slider pots had been sitting around for a few years then the wiper windings could be tarnished (not good electrical contact). might be able to spray/squirt some contact cleaner and vigorously move slider to get better contact

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


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Quote Originally Posted by HenrikOlsson View Post
    Sorry for the delay but the thread is a decade old so....
    What's the value of the pot in question? Link to actual product or datasheet?

    It certainly sounds like a hardware issue. If it works OK with a rorary pot, of the same value, then the slide pot is crap - obviously.

    But, do you really NEED 10 bit resolution? Even if you throw away say 3 bits you still have 127 discrete values. On a 70mm long pot that's about 0.5mm movement. If the sim software expects 10bits then just shift the value left three digits.
    No rush here Henrik.

    It's a linear 10K slide, my rotaries are 5K, but that shouldn't matter. If anything, the slides should be even more smooth since they have more distance to produce a variation in resistance.

    I have 3 uses for these:

    - flaps, 45mm with 4 detents (created with 3D printed housing since it cost a gazillion to add in pot).
    - mixture, 60mm, doesn't require that much precision.
    - throttle, 100mm, this is the important one since players can tweak their throttle in very small increments when landing.

    6 bits would give me 64 values, like I said, I could make due with that if I have to.

    This isn't old stock. I had to wait a month for manufacturing. Then they had quality control issues (housing pins not completely bent horizontally so the pot wobbled on PCB). They redid the order, but still, was not impressed.

    The pots passed static tests, but now I'm starting to code and the first thing I tackled was pot debounce since that was left "unanswered" when I was testing stand-alone switch debouncing.

    I'm just disappointed in the low quality straight from the manufacturer.
    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
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    I had one last thing to test:

    The slide pot was soldered onto a new PCB from JLCPCB. It's just the pot with a connector, nothing else to interfere (I do this to test all my devices).

    I had used a 3-pin header to connect to the breadboard (brand new, very tight, no jiggleness in connections).

    I tried again, but this time using a female header socket, and used jumper wires to connect straight to the PIC on the breadboard.

    Same jitters, so I've eliminated the header connector as possible issue (the PCB only holds by those 3 pins, so it had some
    movement).

    Looks like I'm down to stripping the bottom 4 bits.

    One last possibility, finding a PIC on JLCPCB with at least 8 pins with 12-bit ADC. Not my favourite idea; I was looking at using the TQFP-64 16F1937 for my LEDs, switches, pots and encoders. If I have to buy PICs in bulk later, I wanted to limit my use to 1 for USB, 1 for I/O to limit costs.
    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!

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Quote Originally Posted by Ioannis View Post
    ...All the sliders do the same? ...
    I have 3 sizes, 45, 60 and 100 mm, all the same mediocre performance.
    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 : 6

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