how to get an analog potentiometer to settle down?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1

    Default how to get an analog potentiometer to settle down?

    I'm working on a project that uses the ADC to read an analog potentiometer. It's causing problems for me when the voltage on the ADC fluctuates slightly. Like when the voltage it's reading is 2.4955V and the ADC can't make up its mind whether it's 2.49V or 2.5V. Is there a way to make the voltage settle down?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: how to get an analog potentiometer to settle down?

    Can I decrease the resolution of the ADC?

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: how to get an analog potentiometer to settle down?

    or just round the output .
    George

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: how to get an analog potentiometer to settle down?

    Quote Originally Posted by towlerg View Post
    or just round the output .
    How do I do that? Is there a command line that will round up or down?

  5. #5
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: how to get an analog potentiometer to settle down?

    Yes, there is such command, but I don't remember it's name, check the manual, it was something like I=I<<I or whatever.

  6. #6
    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: how to get an analog potentiometer to settle down?

    If you DEFINE ADC_BITS 8 it will grab the 8 high bits of the 10bit result from the ADC, you'll leave the noise in the lower two bits but at one point or another you're still going to be on the edge where the 3rd bit is flipping back and forth and you're back at square one.

    You can always take multiple samples and average them to smooth things out a bit.

    /Henrik.

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: how to get an analog potentiometer to settle down?

    I haven't tried the sampling/averaging fix yet. I'm having some trouble with the new 16F616. With the 16F676, the only problem I had was with the pot not wanting to settle. Now, there's all kinds of problems with the 16F616. It seems like the primary difference between the two chips are the comparators. I'm a little confused by the differences between the 16F676's CMCON register and the 16F616's CM1CON0 and CM2CON0 registers. Seems like if I want CM1CON0 to be configured the same as CMCON = %00000111, I would write it as CM1CON0 = %00000000, but the last 2 bits are a little confusing to me. Do I need to configure both the CM1CON0 and CM2CON0 registers?

    Also, could the way I have ADCON1 configured be causing trouble? Seems like FOSC2 is what I want. Faster is better, right?

    Below is the configuration section of my code for the 16F616. Sorry for so many questions. I'm still pretty new to this.

    Code:
    #config 
        __CONFIG _CP_OFF & _WDTE_OFF & _BOREN_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF
    #endconfig
    
    
    ADCON1 = %00000000
    ANSEL = %00000110
    CM1CON0 = %00000000               'program worked previously with 16F676 CMCON = %00000111   
    
    TRISA = %00001111
    TRISC = %00000000
    
    ' Set TMR0 to interrupt every 16.384 milliseconds
       OPTION_REG = %10000101        ' Set TMR0 configuration and enable PORTB pullups
       INTCON = %10100000           ' Enable TMR0 interrupts
       On Interrupt Goto tickint

Similar Threads

  1. Potentiometer reading
    By tacbanon in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 9th January 2012, 01:19
  2. Servo speed, from potentiometer
    By CipiCips in forum mel PIC BASIC
    Replies: 2
    Last Post: - 20th May 2011, 08:26
  3. Using sound/audio as a potentiometer?
    By mekohler in forum Schematics
    Replies: 5
    Last Post: - 24th October 2007, 20:53
  4. Switch / Potentiometer
    By bearpawz in forum Off Topic
    Replies: 12
    Last Post: - 19th January 2007, 21:45
  5. Potentiometer with indexing.
    By muddy0409 in forum General
    Replies: 2
    Last Post: - 1st January 2006, 19:41

Members who have read this thread : 0

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