ADC conversion trouble


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73

    Question ADC conversion trouble

    Hi all,

    I am trying to get a one decimal presentation to a displayed temperature value. I’m using an LM35 which delivers 10mV / C it works almost as expected without decimals. If I test it by squeezing the LM35 between my fingers it goes; 24, 25, 26, 27, 29, 30 skipping 28? When I release it, it goes; 30, 29, 27, 26 and so on? And I cannot figure it out. ??

    And as mentioned; my next problem is how to get one decimal.

    I am using a16F88 set to 10 bit A/D and here’s part of the code:

    ADCIN 0,T

    T = (T*/500)>> 2

    LCDOUT $FE,1,"TEMP= ",DEC T, “C”


    Any ideas?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    Hi PICante,
    What are you using as Vref for the ADC? If you're using your PIC supply as Vref and it is exactly 5.00V you still only get ~2counts per degree C. 5.0V divided by 1024 (10bits) makes one LSB 4,89mV.

    If you aren't using an external Vref for the ADC, I'd try that and see what happens. A Vref of 1.024V in this case would let you meassure up to 102.4°C with a resolution of 0.1° - in a perfect world.

    HTH
    /Henrik.

  3. #3
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Smile

    Hej Henrik,

    I am using the supply for reference; it’s very stable and good filtered 5.01 Volts, I also realize the limitations it brings. I see your point about the resolution and I would like to try using an external reference if I just knew how. Any good links for studying the suggested solution?

    BTW, do you have any clue about why it skips 28? Could it be something wrong with my math?

    Thank you!
    Tack!

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Use a voltage divider to set the VREF. Darrel has info here.
    http://www.pbpgroup.com/modules/wfse...p?articleid=25

    Try reading your LM35 with a volt meter. Possible it is doing the skipping.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default

    BTW, do you have any clue about why it skips 28? Could it be something wrong with my math?
    No, not really, except from the fact that you only get two counts per degree from the ADC. You might wan't to try taking 10 or more samples and average them to filter the signal. Also it's possible that you're running into some kind of rounding error in the math due the low resolution but I haven't looked into it that much.

    Regarding the external Vref I'd suggest you look at the datasheet for the particular PIC you're using regarding the ADC and its various Vref options.

    Another option might be to just put an OPAMP after the sensor, boosting the signal by a factor of xx to better utilize the full range of the ADC.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    A good current/temperature compensate Vref is always more than welcome... boosting the sensor output... mmmmpppppfffffff maybe not a good idea.

    There's a load of great few bucks constant voltage source ICs here and there.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Can't get ADC to loop
    By TravisM in forum mel PIC BASIC
    Replies: 2
    Last Post: - 11th October 2009, 15:33
  2. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  3. Help with ADC conversion
    By dbachman in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st February 2009, 20:02
  4. ADC trouble with PIC16F88
    By inventosrl in forum mel PIC BASIC
    Replies: 9
    Last Post: - 3rd December 2008, 12:56
  5. ADC problem
    By NacNud in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th December 2004, 02:27

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