Shop OBEX P1 Docs P2 Docs Learn Events
Analog to Digital — Parallax Forums

Analog to Digital

ArchiverArchiver Posts: 46,084
edited 2001-03-19 01:24 in General Discussion
Hello everyone,

I used the standard program to read the 8 channels off of an 8bit
ADC0838 a/d converter. This program I think is by Scott Edwards.
Anyways, I got the circuit up and running and I have connected to two
of the channels an LM35 thermometer. I am curious, the numbers I get
in for each channel are what? Are they the voltage or current? Or are
these numbers the temperature. I always get a "31" in for channel 0
and channel 1. I think something is wrong, but I am not sure. Any help
would be greatly appreciated.

PS - Is anyone ever in the chatroom?

Thanks,
Corey C.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-03-13 02:41
    Hi Corey

    I also have been experimenting with the ADC0834 and LM34 (Fahrenheit ). You
    are looking at a linearly voltage.

    Goto National Semiconductor for data sheets.

    www.national.com

    Put LM35 in the search field.

    The following is an excerpt for that web site on LM35

    The LM35 series are precision integrated-circuit temperature sensors, whose
    output voltage is linearly proportional to the Celsius (Centigrade)
    temperature. The
    LM35 thus has an advantage over linear temperature sensors calibrated in °
    Kelvin,
    as the user is not required to subtract a large constant voltage from its
    output to
    obtain convenient Centigrade scaling. The LM35 does not require any external

    calibration or trimming to provide typical accuracies of ±¼°C at room
    temperature
    and ± °C over a full -55 to +150°C temperature range. Low cost is assured by

    trimming and calibration at the wafer level. The LM35's low output
    impedance,
    linear output, and precise inherent calibration make interfacing to readout
    or control
    circuitry especially easy. It can be used with single power supplies, or
    with plus and
    minus supplies. As it draws only 60 µA from its supply, it has very low
    self-heating,
    less than 0.1°C in still air. The LM35 is rated to operate over a -55° to
    +150°C
    temperature range, while the LM35C is rated for a -40° to +110°C range (-10°
    with
    improved accuracy). The LM35 series is available packaged in hermetic TO-46
    transistor packages, while the LM35C, LM35CA, and LM35D are also available
    in
    the plastic TO-92 transistor package. The LM35D is also available in an
    8-lead
    surface mount small outline package and a plastic TO-220 package.

    Hope this helps

    Bruce Snowden

    the_coin_guy@y... wrote:

    > Hello everyone,
    >
    > I used the standard program to read the 8 channels off of an 8bit
    > ADC0838 a/d converter. This program I think is by Scott Edwards.
    > Anyways, I got the circuit up and running and I have connected to two
    > of the channels an LM35 thermometer. I am curious, the numbers I get
    > in for each channel are what? Are they the voltage or current? Or are
    > these numbers the temperature. I always get a "31" in for channel 0
    > and channel 1. I think something is wrong, but I am not sure. Any help
    > would be greatly appreciated.
    >
    > PS - Is anyone ever in the chatroom?
    >
    > Thanks,
    > Corey C.
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-13 17:17
    Hello,

    Thank you Bruce for the information. It is greatly appreciated. I was
    under the impression that because I had the voltage reference pin on
    the adc0838 hooked up to 5v, I would not be getting the exact
    temperatures in to the STAMP. I guess not. It seems to be working
    fine. On the LM35, I am getting around 22degrees celsius in --> this
    is about right. Any information on this Vref pin is still appreciated
    however. It confuses me somewhat.

    Thanks,
    Corey C.

    --- In basicstamps@y..., Bruce <bsnowde@a...> wrote:
    > Hi Corey
    >
    > I also have been experimenting with the ADC0834 and LM34 (Fahrenheit
    ). You
    > are looking at a linearly voltage.
    >
    > Goto National Semiconductor for data sheets.
    >
    > www.national.com
    >
    > Put LM35 in the search field.
    >
    > The following is an excerpt for that web site on LM35
    >
    > The LM35 series are precision integrated-circuit temperature
    sensors, whose
    > output voltage is linearly proportional to the Celsius (Centigrade)
    > temperature. The
    > LM35 thus has an advantage over linear temperature sensors
    calibrated in °
    > Kelvin,
    > as the user is not required to subtract a large constant voltage
    from its
    > output to
    > obtain convenient Centigrade scaling. The LM35 does not require any
    external
    >
    > calibration or trimming to provide typical accuracies of ±¼°C at room
    > temperature
    > and ± °C over a full -55 to +150°C temperature range. Low cost is
    assured by
    >
    > trimming and calibration at the wafer level. The LM35's low output
    > impedance,
    > linear output, and precise inherent calibration make interfacing to
    readout
    > or control
    > circuitry especially easy. It can be used with single power
    supplies, or
    > with plus and
    > minus supplies. As it draws only 60 µA from its supply, it has very low
    > self-heating,
    > less than 0.1°C in still air. The LM35 is rated to operate over a
    -55° to
    > +150°C
    > temperature range, while the LM35C is rated for a -40° to +110°C
    range (-10°
    > with
    > improved accuracy). The LM35 series is available packaged in
    hermetic TO-46
    > transistor packages, while the LM35C, LM35CA, and LM35D are also
    available
    > in
    > the plastic TO-92 transistor package. The LM35D is also available in an
    > 8-lead
    > surface mount small outline package and a plastic TO-220 package.
    >
    > Hope this helps
    >
    > Bruce Snowden
    >
    > the_coin_guy@y... wrote:
    >
    > > Hello everyone,
    > >
    > > I used the standard program to read the 8 channels off of an 8bit
    > > ADC0838 a/d converter. This program I think is by Scott Edwards.
    > > Anyways, I got the circuit up and running and I have connected to two
    > > of the channels an LM35 thermometer. I am curious, the numbers I get
    > > in for each channel are what? Are they the voltage or current? Or are
    > > these numbers the temperature. I always get a "31" in for channel 0
    > > and channel 1. I think something is wrong, but I am not sure. Any help
    > > would be greatly appreciated.
    > >
    > > PS - Is anyone ever in the chatroom?
    > >
    > > Thanks,
    > > Corey C.
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-14 05:26
    Corey,

    As I understand it, the Vref is to provide a Reference voltage so that the
    ADC0831 can use it to make comparison to the voltage coming from the
    LM35/LM34.

    I take it that you are referring to Scott Edwards book, "Programming and
    Customizing The Basic Stamp Computer". He suggest to set the Vref to 2.55
    volts. In my circuit mounted on a Experimental board, I had to set it to
    2.58 to get the reading from the LM34/ADC0831 to compare to a DVM (digital
    volt meter). You can use a DVM and read directly from the LM35 at Vin+. The
    DVM set to the right scale, will show the temp. I then adjusted R1 pot so
    that the Stamp has the same temp as the DVM. Upon reading the voltage at
    Vref, this voltage was 2.58. Close enough, as there could just be some error
    in my circuit or DVM.

    I am also learning the Basic Stamp. I am currently working on a program
    comparing the ADC0831/LM34 to the DS1620 for temperature reading. So if what
    I say here is incorrect or can be explain by someone in more elegant way, I
    won't be offended.

    Bruce Snowden

    the_coin_guy@y... wrote:

    > Hello,
    >
    > Thank you Bruce for the information. It is greatly appreciated. I was
    > under the impression that because I had the voltage reference pin on
    > the adc0838 hooked up to 5v, I would not be getting the exact
    > temperatures in to the STAMP. I guess not. It seems to be working
    > fine. On the LM35, I am getting around 22degrees celsius in --> this
    > is about right. Any information on this Vref pin is still appreciated
    > however. It confuses me somewhat.
    >
    > Thanks,
    > Corey C.
    >
    > --- In basicstamps@y..., Bruce <bsnowde@a...> wrote:
    > > Hi Corey
    > >
    > > I also have been experimenting with the ADC0834 and LM34 (Fahrenheit
    > ). You
    > > are looking at a linearly voltage.
    > >
    > > Goto National Semiconductor for data sheets.
    > >
    > > www.national.com
    > >
    > > Put LM35 in the search field.
    > >
    > > The following is an excerpt for that web site on LM35
    > >
    > > The LM35 series are precision integrated-circuit temperature
    > sensors, whose
    > > output voltage is linearly proportional to the Celsius (Centigrade)
    > > temperature. The
    > > LM35 thus has an advantage over linear temperature sensors
    > calibrated in °
    > > Kelvin,
    > > as the user is not required to subtract a large constant voltage
    > from its
    > > output to
    > > obtain convenient Centigrade scaling. The LM35 does not require any
    > external
    > >
    > > calibration or trimming to provide typical accuracies of ±¼°C at room
    > > temperature
    > > and ± °C over a full -55 to +150°C temperature range. Low cost is
    > assured by
    > >
    > > trimming and calibration at the wafer level. The LM35's low output
    > > impedance,
    > > linear output, and precise inherent calibration make interfacing to
    > readout
    > > or control
    > > circuitry especially easy. It can be used with single power
    > supplies, or
    > > with plus and
    > > minus supplies. As it draws only 60 µA from its supply, it has very low
    > > self-heating,
    > > less than 0.1°C in still air. The LM35 is rated to operate over a
    > -55° to
    > > +150°C
    > > temperature range, while the LM35C is rated for a -40° to +110°C
    > range (-10°
    > > with
    > > improved accuracy). The LM35 series is available packaged in
    > hermetic TO-46
    > > transistor packages, while the LM35C, LM35CA, and LM35D are also
    > available
    > > in
    > > the plastic TO-92 transistor package. The LM35D is also available in an
    > > 8-lead
    > > surface mount small outline package and a plastic TO-220 package.
    > >
    > > Hope this helps
    > >
    > > Bruce Snowden
    > >
    > > the_coin_guy@y... wrote:
    > >
    > > > Hello everyone,
    > > >
    > > > I used the standard program to read the 8 channels off of an 8bit
    > > > ADC0838 a/d converter. This program I think is by Scott Edwards.
    > > > Anyways, I got the circuit up and running and I have connected to two
    > > > of the channels an LM35 thermometer. I am curious, the numbers I get
    > > > in for each channel are what? Are they the voltage or current? Or are
    > > > these numbers the temperature. I always get a "31" in for channel 0
    > > > and channel 1. I think something is wrong, but I am not sure. Any help
    > > > would be greatly appreciated.
    > > >
    > > > PS - Is anyone ever in the chatroom?
    > > >
    > > > Thanks,
    > > > Corey C.
    > > >
    > > >
    > > >
    > > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-14 16:00
    Bruce,

    That makes sense to me. However, when I hooked up some LM35's to the
    input channels on the ADC0838 and I had Vref connected to +5v, the
    temps came in on my stamp debug screen correctly!? I dont understand
    why. Logically, the Vref should have to be connected to 2.55V ???

    Corey C.

    --- In basicstamps@y..., Bruce <bsnowde@a...> wrote:
    > Corey,
    >
    > As I understand it, the Vref is to provide a Reference voltage so
    that the
    > ADC0831 can use it to make comparison to the voltage coming from the
    > LM35/LM34.
    >
    > I take it that you are referring to Scott Edwards book, "Programming and
    > Customizing The Basic Stamp Computer". He suggest to set the Vref
    to 2.55
    > volts. In my circuit mounted on a Experimental board, I had to set
    it to
    > 2.58 to get the reading from the LM34/ADC0831 to compare to a DVM
    (digital
    > volt meter). You can use a DVM and read directly from the LM35 at
    Vin+. The
    > DVM set to the right scale, will show the temp. I then adjusted R1
    pot so
    > that the Stamp has the same temp as the DVM. Upon reading the
    voltage at
    > Vref, this voltage was 2.58. Close enough, as there could just be
    some error
    > in my circuit or DVM.
    >
    > I am also learning the Basic Stamp. I am currently working on a program
    > comparing the ADC0831/LM34 to the DS1620 for temperature reading.
    So if what
    > I say here is incorrect or can be explain by someone in more elegant
    way, I
    > won't be offended.
    >
    > Bruce Snowden
    >
    > the_coin_guy@y... wrote:
    >
    > > Hello,
    > >
    > > Thank you Bruce for the information. It is greatly appreciated. I was
    > > under the impression that because I had the voltage reference pin on
    > > the adc0838 hooked up to 5v, I would not be getting the exact
    > > temperatures in to the STAMP. I guess not. It seems to be working
    > > fine. On the LM35, I am getting around 22degrees celsius in --> this
    > > is about right. Any information on this Vref pin is still appreciated
    > > however. It confuses me somewhat.
    > >
    > > Thanks,
    > > Corey C.
    > >
    > > --- In basicstamps@y..., Bruce <bsnowde@a...> wrote:
    > > > Hi Corey
    > > >
    > > > I also have been experimenting with the ADC0834 and LM34 (Fahrenheit
    > > ). You
    > > > are looking at a linearly voltage.
    > > >
    > > > Goto National Semiconductor for data sheets.
    > > >
    > > > www.national.com
    > > >
    > > > Put LM35 in the search field.
    > > >
    > > > The following is an excerpt for that web site on LM35
    > > >
    > > > The LM35 series are precision integrated-circuit temperature
    > > sensors, whose
    > > > output voltage is linearly proportional to the Celsius (Centigrade)
    > > > temperature. The
    > > > LM35 thus has an advantage over linear temperature sensors
    > > calibrated in °
    > > > Kelvin,
    > > > as the user is not required to subtract a large constant voltage
    > > from its
    > > > output to
    > > > obtain convenient Centigrade scaling. The LM35 does not require any
    > > external
    > > >
    > > > calibration or trimming to provide typical accuracies of ±¼°C
    at room
    > > > temperature
    > > > and ± °C over a full -55 to +150°C temperature range. Low cost is
    > > assured by
    > > >
    > > > trimming and calibration at the wafer level. The LM35's low output
    > > > impedance,
    > > > linear output, and precise inherent calibration make interfacing to
    > > readout
    > > > or control
    > > > circuitry especially easy. It can be used with single power
    > > supplies, or
    > > > with plus and
    > > > minus supplies. As it draws only 60 µA from its supply, it has
    very low
    > > > self-heating,
    > > > less than 0.1°C in still air. The LM35 is rated to operate over a
    > > -55° to
    > > > +150°C
    > > > temperature range, while the LM35C is rated for a -40° to +110°C
    > > range (-10°
    > > > with
    > > > improved accuracy). The LM35 series is available packaged in
    > > hermetic TO-46
    > > > transistor packages, while the LM35C, LM35CA, and LM35D are also
    > > available
    > > > in
    > > > the plastic TO-92 transistor package. The LM35D is also
    available in an
    > > > 8-lead
    > > > surface mount small outline package and a plastic TO-220 package.
    > > >
    > > > Hope this helps
    > > >
    > > > Bruce Snowden
    > > >
    > > > the_coin_guy@y... wrote:
    > > >
    > > > > Hello everyone,
    > > > >
    > > > > I used the standard program to read the 8 channels off of an 8bit
    > > > > ADC0838 a/d converter. This program I think is by Scott Edwards.
    > > > > Anyways, I got the circuit up and running and I have connected
    to two
    > > > > of the channels an LM35 thermometer. I am curious, the numbers
    I get
    > > > > in for each channel are what? Are they the voltage or current?
    Or are
    > > > > these numbers the temperature. I always get a "31" in for
    channel 0
    > > > > and channel 1. I think something is wrong, but I am not sure.
    Any help
    > > > > would be greatly appreciated.
    > > > >
    > > > > PS - Is anyone ever in the chatroom?
    > > > >
    > > > > Thanks,
    > > > > Corey C.
    > > > >
    > > > >
    > > > >
    > > > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 03:13
    --- In basicstamps@y..., the_coin_guy@y... wrote:
    Corey,

    When I adjust Vref pot to +5v on my circuit, I get a reading
    of 35 F for what should be 70 F. Way off. Are you sure you
    are reading the correct leg of the pot ? The wiper leg,
    (Center Leg) ?

    +5v________/\/\/\/\/\/\________________ GRD
    / \
    |
    |
    | <- to Vref
    Should be set to 2.55V
    between the wiper, and GRD

    Assuming that you are reading the correct leg of the pot, what
    is your reading if you adjust it to 2.55v ?

    Bruce





    > Bruce,
    >
    > That makes sense to me. However, when I hooked up some
    LM35's to the
    > input channels on the ADC0838 and I had Vref connected to
    +5v, the
    > temps came in on my stamp debug screen correctly!? I dont
    understand
    > why. Logically, the Vref should have to be connected to
    2.55V ???
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 13:53
    Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    I don't even have a pot on there as it is now. I am getting the
    correct temperatures! I just don't understand why? I will try it with
    a pot....

    Thanks,
    Corey



    --- In basicstamps@y..., bsnowde@a... wrote:
    > --- In basicstamps@y..., the_coin_guy@y... wrote:
    > Corey,
    >
    > When I adjust Vref pot to +5v on my circuit, I get a reading
    > of 35 F for what should be 70 F. Way off. Are you sure you
    > are reading the correct leg of the pot ? The wiper leg,
    > (Center Leg) ?
    >
    > +5v________/\/\/\/\/\/\________________ GRD
    > / \
    > |
    > |
    > | <- to Vref
    > Should be set to 2.55V
    > between the wiper, and GRD
    >
    > Assuming that you are reading the correct leg of the pot, what
    > is your reading if you adjust it to 2.55v ?
    >
    > Bruce
    >
    >
    >
    >
    >
    > > Bruce,
    > >
    > > That makes sense to me. However, when I hooked up some
    > LM35's to the
    > > input channels on the ADC0838 and I had Vref connected to
    > +5v, the
    > > temps came in on my stamp debug screen correctly!? I dont
    > understand
    > > why. Logically, the Vref should have to be connected to
    > 2.55V ???
    > >
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 16:23
    Corey,

    I am using the ADC0831 as listed on p 119 in Scott Edwards book. For
    information and data sheets on both the ADC0831 and ADC0838 go to:

    http://www.national.com

    I am not sure what the difference of the two are. The ADC0838 look
    interesting with up to 8 channels. They both are listed on the same data
    sheet. Look at page 14 of the data sheet for a full run down on the Vref.
    Briefly, the ADC0803X is 8 bits, giving 256 data points. So ( as I
    understand it ) by adjusting Vref to 2.55 v you are allowing each uV to
    represent a degree. 0v would also be a data point. (2.55v / 256 data points
    = 1 uV per data point)

    You may be using a different circuit/program that compensates for the 5V on
    Vref then what I am using. ie. Maybe you have a fixed resister in place of
    the pot. Or your program could be using an equation to bring the results in
    line. Another though that has just occurred to me, You are measuring
    Centigrade, where I am measuring Fahrenheit. The Centigrade unit is a larger
    unit than the Fahrenheit. This may explain the difference in reference
    voltage as you would need a wider voltage range ?? I don't have a Centigrade
    LM35 to try on this end.

    On another note, Some say if it isn't broke, don't fix it. :-)
    I am curious why you have such different results, so let me know what you
    find.

    Bruce Snowden

    the_coin_guy@y... wrote:

    > Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    > I don't even have a pot on there as it is now. I am getting the
    > correct temperatures! I just don't understand why? I will try it with
    > a pot....
    >
    > Thanks,
    > Corey
    >
    > --- In basicstamps@y..., bsnowde@a... wrote:
    > > --- In basicstamps@y..., the_coin_guy@y... wrote:
    > > Corey,
    > >
    > > When I adjust Vref pot to +5v on my circuit, I get a reading
    > > of 35 F for what should be 70 F. Way off. Are you sure you
    > > are reading the correct leg of the pot ? The wiper leg,
    > > (Center Leg) ?
    > >
    > > +5v________/\/\/\/\/\/\________________ GRD
    > > / \
    > > |
    > > |
    > > | <- to Vref
    > > Should be set to 2.55V
    > > between the wiper, and GRD
    > >
    > > Assuming that you are reading the correct leg of the pot, what
    > > is your reading if you adjust it to 2.55v ?
    > >
    > > Bruce
    > >
    > >
    > >
    > >
    > >
    > > > Bruce,
    > > >
    > > > That makes sense to me. However, when I hooked up some
    > > LM35's to the
    > > > input channels on the ADC0838 and I had Vref connected to
    > > +5v, the
    > > > temps came in on my stamp debug screen correctly!? I dont
    > > understand
    > > > why. Logically, the Vref should have to be connected to
    > > 2.55V ???
    > > >
    >
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 17:50
    >Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    >I don't even have a pot on there as it is now. I am getting the
    >correct temperatures! I just don't understand why? I will try it with
    >a pot....

    Maybe you have the shiftin command reading the wrong number of bits.
    The effect of that would be a factor of two error in the result.

    You can use any reference value, but you have to multiply the A/D raw
    result by a constant to convert it to engineering units. For
    example, the LM35 puts out 10 millivolts per degree C, and the 8 bit
    converter with a 2.56 volt reference has a sensitivity of 2.56/256 =
    0.010 volts per bit, so the answer comes out directly in Celsius.
    With a 5.12 volt reference, the sensitivity is 5.12/256=0.020 volts
    per bit, so a one bit change happens for each 2 degrees C, and you
    have to multiply the A/D result times 2 to get the answer.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 18:04
    >Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    >I don't even have a pot on there as it is now. I am getting the
    >correct temperatures! I just don't understand why? I will try it with
    >a pot....

    Maybe you have the shiftin command reading the wrong number of bits.
    The effect of that would be a factor of two error in the result.

    You can use any reference value, but you have to multiply the A/D raw
    result by a constant to convert it to engineering units. For
    example, the LM35 puts out 10 millivolts per degree C, and the 8 bit
    converter with a 2.56 volt reference has a sensitivity of 2.56/256 =
    0.010 volts per bit, so the answer comes out directly in Celsius.
    With a 5.12 volt reference, the sensitivity is 5.12/256=0.020 volts
    per bit, so a one bit change happens for each 2 degrees C, and you
    have to multiply the A/D result times 2 to get the answer.

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 19:50
    Hi,

    The Celsius vs. Fahrenheit theory is a good one. You are right, it may
    have something to do with this. However, both the LM35 and LM34 create
    10mV/degree Celsius or Fahrenheit....so...? I will try adjusting the
    Vref with a pot and see what happens.

    Thanks,
    Corey C.


    --- In basicstamps@y..., Bruce <bsnowde@a...> wrote:
    > Corey,
    >
    > I am using the ADC0831 as listed on p 119 in Scott Edwards book. For
    > information and data sheets on both the ADC0831 and ADC0838 go to:
    >
    > http://www.national.com
    >
    > I am not sure what the difference of the two are. The ADC0838 look
    > interesting with up to 8 channels. They both are listed on the same
    data
    > sheet. Look at page 14 of the data sheet for a full run down on the
    Vref.
    > Briefly, the ADC0803X is 8 bits, giving 256 data points. So ( as I
    > understand it ) by adjusting Vref to 2.55 v you are allowing each uV to
    > represent a degree. 0v would also be a data point. (2.55v / 256
    data points
    > = 1 uV per data point)
    >
    > You may be using a different circuit/program that compensates for
    the 5V on
    > Vref then what I am using. ie. Maybe you have a fixed resister in
    place of
    > the pot. Or your program could be using an equation to bring the
    results in
    > line. Another though that has just occurred to me, You are measuring
    > Centigrade, where I am measuring Fahrenheit. The Centigrade unit is
    a larger
    > unit than the Fahrenheit. This may explain the difference in reference
    > voltage as you would need a wider voltage range ?? I don't have a
    Centigrade
    > LM35 to try on this end.
    >
    > On another note, Some say if it isn't broke, don't fix it. :-)
    > I am curious why you have such different results, so let me know
    what you
    > find.
    >
    > Bruce Snowden
    >
    > the_coin_guy@y... wrote:
    >
    > > Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    > > I don't even have a pot on there as it is now. I am getting the
    > > correct temperatures! I just don't understand why? I will try it with
    > > a pot....
    > >
    > > Thanks,
    > > Corey
    > >
    > > --- In basicstamps@y..., bsnowde@a... wrote:
    > > > --- In basicstamps@y..., the_coin_guy@y... wrote:
    > > > Corey,
    > > >
    > > > When I adjust Vref pot to +5v on my circuit, I get a reading
    > > > of 35 F for what should be 70 F. Way off. Are you sure you
    > > > are reading the correct leg of the pot ? The wiper leg,
    > > > (Center Leg) ?
    > > >
    > > > +5v________/\/\/\/\/\/\________________ GRD
    > > > / \
    > > > |
    > > > |
    > > > | <- to Vref
    > > > Should be set to 2.55V
    > > > between the wiper, and GRD
    > > >
    > > > Assuming that you are reading the correct leg of the pot, what
    > > > is your reading if you adjust it to 2.55v ?
    > > >
    > > > Bruce
    > > >
    > > >
    > > >
    > > >
    > > >
    > > > > Bruce,
    > > > >
    > > > > That makes sense to me. However, when I hooked up some
    > > > LM35's to the
    > > > > input channels on the ADC0838 and I had Vref connected to
    > > > +5v, the
    > > > > temps came in on my stamp debug screen correctly!? I dont
    > > > understand
    > > > > why. Logically, the Vref should have to be connected to
    > > > 2.55V ???
    > > > >
    > >
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 19:57
    Yes, That's what I thought. But if I did the calculations to
    compensate for the 5volt Vref, I would get the wrong temp. If I
    multiplied the temperature I am currently getting in by about 2, I get
    around 40 degrees Celsius at room temperature! I prefer the 20 degrees
    I am getting now!

    Confused,
    Corey C.


    --- In basicstamps@y..., Tracy Allen <tta@e...> wrote:
    > >Are you using the ADC0831 or the ADC0838? Maybe there are variances?
    > >I don't even have a pot on there as it is now. I am getting the
    > >correct temperatures! I just don't understand why? I will try it with
    > >a pot....
    >
    > Maybe you have the shiftin command reading the wrong number of bits.
    > The effect of that would be a factor of two error in the result.
    >
    > You can use any reference value, but you have to multiply the A/D raw
    > result by a constant to convert it to engineering units. For
    > example, the LM35 puts out 10 millivolts per degree C, and the 8 bit
    > converter with a 2.56 volt reference has a sensitivity of 2.56/256 =
    > 0.010 volts per bit, so the answer comes out directly in Celsius.
    > With a 5.12 volt reference, the sensitivity is 5.12/256=0.020 volts
    > per bit, so a one bit change happens for each 2 degrees C, and you
    > have to multiply the A/D result times 2 to get the answer.
    >
    > -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 20:35
    >Yes, That's what I thought. But if I did the calculations to
    >compensate for the 5volt Vref, I would get the wrong temp. If I
    >multiplied the temperature I am currently getting in by about 2, I get
    >around 40 degrees Celsius at room temperature! I prefer the 20 degrees
    >I am getting now!

    What is the exact shiftin command you are using? I am thinking about
    the -pre versus -post parameter, which if wrong can give an apparent
    x2 factor in the reading.
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-15 21:48
    Hi,

    I am using that standard ADC0838 program by Scott Edwards. So, I dont
    think the command would be incorrect, but you can check.

    Thanks,
    Corey C.


    --- In basicstamps@y..., Tracy Allen <tta@e...> wrote:
    > >Yes, That's what I thought. But if I did the calculations to
    > >compensate for the 5volt Vref, I would get the wrong temp. If I
    > >multiplied the temperature I am currently getting in by about 2, I get
    > >around 40 degrees Celsius at room temperature! I prefer the 20 degrees
    > >I am getting now!
    >
    > What is the exact shiftin command you are using? I am thinking about
    > the -pre versus -post parameter, which if wrong can give an apparent
    > x2 factor in the reading.
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-16 15:20
    Tracy,

    I changes the command from shifting in 9 bits to shifting in 8 bits. I
    think it now works? Any thoughts on why?

    Thanks,
    Corey C.

    --- In basicstamps@y..., Tracy Allen <tta@e...> wrote:
    > >Yes, That's what I thought. But if I did the calculations to
    > >compensate for the 5volt Vref, I would get the wrong temp. If I
    > >multiplied the temperature I am currently getting in by about 2, I get
    > >around 40 degrees Celsius at room temperature! I prefer the 20 degrees
    > >I am getting now!
    >
    > What is the exact shiftin command you are using? I am thinking about
    > the -pre versus -post parameter, which if wrong can give an apparent
    > x2 factor in the reading.
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-18 19:48
    >Tracy,
    >
    >I changes the command from shifting in 9 bits to shifting in 8 bits. I
    >think it now works? Any thoughts on why?
    >
    >Thanks,
    >Corey C.

    Corey,

    After looking at the ACC0838 timing, I would try

    for channel=0 to 7
    command=%1000+channel
    low adcs
    shiftout dopin,cpin,msbfirst,[noparse][[/noparse]command\5]
    shiftin dipin,cpin,msbpost,[noparse][[/noparse]result\8]
    high adcs
    debug dec channel,tab,dec result
    pause 200
    next

    That is probably similar to what you have now (I have not actually
    seen the application note you are referring to). What do you have in
    the position of the msbpost? It all has to do with reading the right
    number of bits into the result variable.

    And from careful reading of the timing diagram in the ADC0838 data
    sheet. I am not sure that the above code will work, because I have
    not used that part. Sometimes the data sheets are confusing (or
    wrong!) and you have to experiment with different combinations of
    mode and number of bits. But it is satisfying when you do get your
    understanding of SHIFTIN matched up with the published timing diagram.

    The timing diagram shows that the ADC0838 takes in the command on the
    rising edges of the the first 5 clock pulses after CS goes low.
    Subsequently, the most significant bit of the data is clocked out on
    the falling edge of the sixth clock pulse. That is the justification
    for the msbpost above. That tells the Stamp to read the data _after_
    it receives the sixth clock pulse. Another way you could do it is:

    shiftin dipin,cpin,msbpre,[noparse][[/noparse]result\9]

    In addition to the 8 data bits, the shiftin here reads the dud low
    bit that comes out on the falling edge of the 5th clock pulse. Note
    that the mode this time is msbpre, and there are 9 bits transferred.
    The Stamp reads that dud 9th bit _before_ it receives the sixth clock
    pulse.

    I hope that helps.

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-19 00:23
    Corey,

    I haven't followed this thread all the way back but have you looked at
    the ADC038.ZIP file in the BS2 library?

    http://www.hth.com/filelibrary/BS2-IC/

    Adolph Stumpf
    astumpf@q...



    --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > >Tracy,
    > >
    > >I changes the command from shifting in 9 bits to shifting in 8
    bits. I
    > >think it now works? Any thoughts on why?
    > >
    > >Thanks,
    > >Corey C.
    >
    > Corey,
    >
    > After looking at the ACC0838 timing, I would try
    >
    > for channel=0 to 7
    > command=%1000+channel
    > low adcs
    > shiftout dopin,cpin,msbfirst,[noparse][[/noparse]command\5]
    > shiftin dipin,cpin,msbpost,[noparse][[/noparse]result\8]
    > high adcs
    > debug dec channel,tab,dec result
    > pause 200
    > next
    >
    > That is probably similar to what you have now (I have not actually
    > seen the application note you are referring to). What do you have in
    > the position of the msbpost? It all has to do with reading the
    right
    > number of bits into the result variable.
    >
    > And from careful reading of the timing diagram in the ADC0838 data
    > sheet. I am not sure that the above code will work, because I have
    > not used that part. Sometimes the data sheets are confusing (or
    > wrong!) and you have to experiment with different combinations of
    > mode and number of bits. But it is satisfying when you do get your
    > understanding of SHIFTIN matched up with the published timing
    diagram.
    >
    > The timing diagram shows that the ADC0838 takes in the command on
    the
    > rising edges of the the first 5 clock pulses after CS goes low.
    > Subsequently, the most significant bit of the data is clocked out on
    > the falling edge of the sixth clock pulse. That is the justification
    > for the msbpost above. That tells the Stamp to read the data _after_
    > it receives the sixth clock pulse. Another way you could do it is:
    >
    > shiftin dipin,cpin,msbpre,[noparse][[/noparse]result\9]
    >
    > In addition to the 8 data bits, the shiftin here reads the dud low
    > bit that comes out on the falling edge of the 5th clock pulse.
    Note
    > that the mode this time is msbpre, and there are 9 bits transferred.
    > The Stamp reads that dud 9th bit _before_ it receives the sixth
    clock
    > pulse.
    >
    > I hope that helps.
    >
    > -- regards,
    > Tracy Allen
    > electronically monitored ecosystems
    > http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-03-19 01:24
    Tracy,

    Thanks a lot! Great help! As for the ADC0838.zip, that's the program I
    am using. . . I changes the shiftin 9 bits to shiftin 8...its seems to
    work now.

    Thanks,
    Corey C.


    --- In basicstamps@y..., apstumpf@u... wrote:
    > Corey,
    >
    > I haven't followed this thread all the way back but have you looked at
    > the ADC038.ZIP file in the BS2 library?
    >
    > http://www.hth.com/filelibrary/BS2-IC/
    >
    > Adolph Stumpf
    > astumpf@q...
    >
    >
    >
    > --- In basicstamps@y..., Tracy Allen <tracy@e...> wrote:
    > > >Tracy,
    > > >
    > > >I changes the command from shifting in 9 bits to shifting in 8
    > bits. I
    > > >think it now works? Any thoughts on why?
    > > >
    > > >Thanks,
    > > >Corey C.
    > >
    > > Corey,
    > >
    > > After looking at the ACC0838 timing, I would try
    > >
    > > for channel=0 to 7
    > > command=%1000+channel
    > > low adcs
    > > shiftout dopin,cpin,msbfirst,[noparse][[/noparse]command\5]
    > > shiftin dipin,cpin,msbpost,[noparse][[/noparse]result\8]
    > > high adcs
    > > debug dec channel,tab,dec result
    > > pause 200
    > > next
    > >
    > > That is probably similar to what you have now (I have not actually
    > > seen the application note you are referring to). What do you have in
    > > the position of the msbpost? It all has to do with reading the
    > right
    > > number of bits into the result variable.
    > >
    > > And from careful reading of the timing diagram in the ADC0838 data
    > > sheet. I am not sure that the above code will work, because I have
    > > not used that part. Sometimes the data sheets are confusing (or
    > > wrong!) and you have to experiment with different combinations of
    > > mode and number of bits. But it is satisfying when you do get your
    > > understanding of SHIFTIN matched up with the published timing
    > diagram.
    > >
    > > The timing diagram shows that the ADC0838 takes in the command on
    > the
    > > rising edges of the the first 5 clock pulses after CS goes low.
    > > Subsequently, the most significant bit of the data is clocked out on
    > > the falling edge of the sixth clock pulse. That is the justification
    > > for the msbpost above. That tells the Stamp to read the data _after_
    > > it receives the sixth clock pulse. Another way you could do it is:
    > >
    > > shiftin dipin,cpin,msbpre,[noparse][[/noparse]result\9]
    > >
    > > In addition to the 8 data bits, the shiftin here reads the dud low
    > > bit that comes out on the falling edge of the 5th clock pulse.
    > Note
    > > that the mode this time is msbpre, and there are 9 bits transferred.
    > > The Stamp reads that dud 9th bit _before_ it receives the sixth
    > clock
    > > pulse.
    > >
    > > I hope that helps.
    > >
    > > -- regards,
    > > Tracy Allen
    > > electronically monitored ecosystems
    > > http://www.emesystems.com
Sign In or Register to comment.