Shop OBEX P1 Docs P2 Docs Learn Events
LOOKING FOR HELP ON TEMPERATURE SENSING 250 - 350 degree F. — Parallax Forums

LOOKING FOR HELP ON TEMPERATURE SENSING 250 - 350 degree F.

GUY GARDNERGUY GARDNER Posts: 6
edited 2006-08-15 16:23 in BASIC Stamp
I have purchased a DS2760 thermocouple kit from Parallax and have spent considerable hours working with it. Although I have learned about the stamps working with it, I have found the documentation lacking and the sample program very confusing to work with. If anyone could help me, I would sincerely appreciate it.

The task I am working on is to monitor and control the temerature on a heating head in the range of 250 - 300 degrees F.
I am using a J type thermocouple and would like to take direct readings in degrees F rather than C. (Centigrade degrees give me two degrees F for every degree C.)

Are there any tables available for F rather than C that comes with the Kit?

Has anyone got a simple example of software that works with the DS2760 thermocouple kit that doesn't have a long list of variables that consume 75% of the available RAM? There are some other functions that I would like to do with the BS2p after the temperature is determined.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-09 20:25
    Guy,

    ·· I believe I received an e-mail from you on this and replied.· We only have the tables listed on our website currently available, but you can use their format to create additional tables in the format you want.· Have you looked at both the Demo and Advanced example code?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • metron9metron9 Posts: 1,100
    edited 2006-08-10 04:18
    I'm no expert at math or spreadsheets but I do know there are functions in excell that can give you a table given a few points of data.

    For example I have an NTC Thermistor and the table goes by 5 degree C so 0c= 3226 ohms 25C=1000ohms and 50C=365ohms

    I put these three numbers in and used an exponential trendline but I know you can get it to give you the exponential formula so you could then run a table of 1 degree steps. Perhaps someone who knows more about excell can tell us how to do it.

    I see the DS2760 is a Seebeck voltage thermocouple but I would think the large tables of data could be compressed by using additional math functions that would reduce the 75% amount of memory required. Just tossin in some ideas to chew on perhaps they are not an option that would work. I will have to get one of these devices to play with me thinks.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
    584 x 503 - 38K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-08-10 15:43
    Parallax basically provides pro-forma information to demonstrate that the device and the software that supports the device is operational. Often the examples are bare bones when compared with our ambitions.

    The Forum is a whole different thing. Here, other users help each other and learn more through teaching one another.

    In other words, you really have to define your goals more specifically if you are going to get detailed help rather than vague suggestions. Often, just through the act of defining what exactly you want [noparse][[/noparse]like what the chart should exactly look like], you will begin to see an easy solution.

    Obviously, Excel is not a Parallax product and is quite a bundle of resources in its own right. Somebody may be able to help, but it is important that you get us pointed in the right direction in detail and that you share the effort. Try to make it fun and fellowship.

    Try Wikipedia for a conversion formula and themocouples if you don't understand the following.

    Temperature is the same linear relationship regardless of C or F. Why do you want exponential curves? I haven't used this device, but I would understand a log scale in terms of making a smaller linear chart.

    Is the voltage an exponential function?
    BasicStamps usually deal with these through curve fitting a chain of linear sectons in a data file[noparse][[/noparse]You can look at Dr. T. Allen's Parallax text on sensors and download it for FREE] because of excessive time demands for number crunching with the Basic Stamp. This can eat up most of the BasicStamp's EEPROM unless careful.

    If you really want to have that eponential·ability for the sake of detail, the Parallax Propeller has 32 bit parallel processing with floating point and log scales in EEPROM.· For greater scientific accuracy, I would look at that processor.

    Regarding temperature conversion.
    Centigrade is 100 degrees between Freezing and Boiling Points, while Farhenheit is 180 degrees in the same range -- The ratio is 5/9th in one direction and 9/5ths in the other.

    You have to adjust the freezing point by adding or deducting 32 for it to work.

    So I think it is C = (F-32)* 5/9 Of course, double check because that is merely from mymemory of college chemistry, 35 years ago.· I hope I am not being pedantic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan

    Post Edited (Kramer) : 8/10/2006 3:51:55 PM GMT
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-08-10 17:10
    Kramer said...

    Temperature is the same linear relationship regardless of C or F. Why do you want exponential curves?
    I haven't used this device, but I would understand a log scale in terms of making a smaller linear chart.

    While temperature is a linear scale.... the relationship between the temperature and the
    thermocouple's resistance in noticibly non-linear without some outside compensation.
    An exponential curve usually fits thermocouples and thermistors rather nicely. I've used
    cubic splines before (many moons ago) when more data was available for a temperature
    sensor I characterized to produce an equation that smoothed through the data for
    interpolation and thus a complete table could be generated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking

    Post Edited (Fe2o3Fish) : 8/10/2006 5:20:31 PM GMT
  • bulkheadbulkhead Posts: 405
    edited 2006-08-10 17:51
    I have this same sensor but only have a BS2 so I can't run the 1-wire device. Are you using a BS2? If so where did you get the converter?
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-08-10 19:06
    Thanks Rusty,
    I do understand that the sensor works with an exponential function to convert to temperature.

    The underlying dilemma is that on one hand the BasicStamp is really slow with this type of calculation [noparse][[/noparse]conversion of exponential to linear] and on the other hand when you use data table to speed up the processs, the process becomes very EEPROM intensive.

    So it is a choice between writing a program that bogs down the Stamp's ability to do other things quickly or use the EEPROM to provide a lot of data for quick response but less programing space for the other programs. Either way, you begin to lack capacity.

    Both problems disappear with the Propeller. Much faster at 160Mhz, more RAM, better math accuracy at 32bits, sizzle with 8 parallel processors, efficent due to log tables in EEPROM, and cheaper than a BasicStamp at $25 each. Win. Win. Win. SPIN, the Propeller's language now has a set of BasicStamp Objects for people that are moving over to it. It ain't hard to learn.

    Dr Tracy Allen has written a course for Parallax in sensors and I think you can find detailed, in depth discussion about the trade offs with the Stamp.

    I suspect you could use an Op AMP to convert the exponential function to a linear voltage. Then the BasicStamp could just use a ADC to measure the voltage as a temperature. You would have much more freedom to use the Stamp to do other things with the data.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-08-10 21:45
    Kramer,

    OK, so we're on the same page.

    One reason not to go with the less expensive Prop-job is that the overall solution
    may not permit a large 40-pin DIP or a surface mount critter. One possibility for a
    plain ol' BS2 would be to generate a relatively small table of evenly spaced values
    that could still be kept in the Stamp's program memory and do just a simple linear
    interpolation for other values, which the stamp won't be to slow about doing.

    Like all engineering, it'll be a matter of what gets traded off -- accuracy vs speed
    vs memory usage. I like the idea of a log amp but that adds more parts, is yet
    another conversion in which accuracy can be lost, the log functionality may need
    a good bit of tweaking to get it to "match" the thermocouple, and one more place
    something can go wrong in the circuit! Still, it could be fun to 'xperiment with!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-08-11 06:13
    How about using this co-processor for $15?

    www.parallax.com/detail.asp?product_id=604-00030

    The BS2 docs give examples for using it with a DS1620 digital thermometer.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-11 06:30
    Guy, It may be that you can get away with a linear approximation. To first order, thermocouples are nowhere near as nonlinear (logarithmic) as thermistors. But the nonlinearities they do have are peculiar.

    I'm attaching the response curves for type J, K and T thermocouples, as well as a curve that compares the residual errors for type T and type K after a linear approximation through zero and 100 degrees Celsius. (Sorry, I didn't have type J on the curve). The residual errors can be subtracted out with additional polynomial terms. However, that might not be necessary, depending on your application. The type J may be linear enough over your target 250 to 350 degree Fahrenheit range.

    Chris suggested that you look at the example programs that come with the kit. There is a Celsius to Fahrenheit conversion routine there.

    I'll try to delve a little more into what the program is doing, and thermocouple theory.

    You can get the thermocouple table in almost exactly the format you need from a reference like the ones at Omega Scientific. I've attached a type J table in excel format. The tables that come with the DS2760 kit are basically data statements made verbatim with the values out of the table, (for type K or type J or what have you), multiplied by 1000 so that they will all be integers (WORD values).

    Note that the program for using thermocouples has to perform several steps. It reads not only the voltage from the thermocouple but also the temperature of the reference junction. The DS2760 measures its own temperature, which is the reference junction, also called the "cold" junction. The program looks up the temperature of the cold junction in the table and extracts the voltage a thermocouple (of type K, or for yours, a type J) would produce at exactly that temperature. It adds that voltage to the measured thermocouple voltage. The result is the voltage the measurement thermocouple would be producing if its reference were actually in an ice bath, instead of at the temperature of the DS2760. Now the program has to look up that compensated voltage in the table, and find the corresponding temperature. That is what you want to find. It would be easy if you had a table of temperatures vs voltage, but the table you have is a table of voltages vs temperature. That is why the program goes into the binary search algorithm. It is essentially a lookdown routine, using binary search to find the temperature corresponding to the given voltage. A lot of the complexity of that program, aside from the one-wire stuff, has to do with the lookup and lookdown routines for the eeprom table.

    If you don't need a lot of accuracy, you could dispense with the table. Simply use a linear formula to calculate the cold junction value, and then also use a linear formula to calculate the measurement temperature.

    An alternative thermocouple conditioner (for type K only) is the MAX6675, a direct to digital (SHIFTIN) 8-pin chip with the cold junction compensation performed on chip. Another is the AD595, an analog output, but also with the cold junction compensation performed on chip. It is nice to have the cold junction compensation performed on chip, but it is much more versatile to leave it for the processor to do the math, because then it can with a change of table handle any thermocouple type, and the compensation can cover a wider range and take into account the nonlinearities. Don't get carried away with accuracy though. Thermocouples have many unique and wonderful features, but long term stability and accuracy is not one of them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
    397 x 274 - 7K
    432 x 260 - 8K
    392 x 275 - 7K
    391 x 587 - 14K
  • GUY GARDNERGUY GARDNER Posts: 6
    edited 2006-08-15 06:40
    Chris Savage (Parallax) said...
    Guy,

    I believe I received an e-mail from you on this and replied. We only have the tables listed on our website currently available, but you can use their format to create additional tables in the format you want. Have you looked at both the Demo and Advanced example code?


    Chris:

    The response by Tracy Clark is very informative.

    How does one go about tranferring data from an Excel spread sheet into a Stamp data file. In other words if I build a data set in excel, how to I get it into the Stamp data file.

    Also, where can I see info about your solder pot example?

    Thanks,

    Guy Gardner smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Guy M. Gardner
  • GUY GARDNERGUY GARDNER Posts: 6
    edited 2006-08-15 06:43
    Chris Savage (Parallax) said...
    Guy,

    I believe I received an e-mail from you on this and replied. We only have the tables listed on our website currently available, but you can use their format to create additional tables in the format you want. Have you looked at both the Demo and Advanced example code?


    Chris:

    One other comment. This is the first time I have visited or worked in a "Forum". Wow! How great to see the responses and get input from others. Keep it up!

    Guy smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Guy M. Gardner
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-15 07:09
    Re going from Excel to a Stamp DATA file. Suppose you have the values in columns F18 and G18 that you want to turn into a DATA statement for the Stamp. In cell J18 (say), enter the following formula:

    ="DATA Word " & F18 & ", Word " & G18
    



    You can also scaling, for example, F18 *1000 instead of just F18. Suppose that F18 contains the value 431 and G18 is 1025. Those values might actually come from formulas in those cells. But what you see in the cell J18 after you accept the above formula will be,

    DATA Word 431, Word 1025
    



    Okay, extend that to as many columns as you need. Copy the formula and paste it into as many rows as you need. Copy the DATA statements from column J (say) and paste them into your Stamp program. viola'!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-15 16:23
    Guy,

    You asked off topic in the "RUN" thread about simple sensors (like the DS1620) that might be used up to 350 deg Fahrenheit. Most IC sensors don't go that high. For example, the venerable AD590 is useful only up to 300 deg F (150 deg C).

    Probably the simplest option is a thermistor, because you could use it in an RCtime circuit. The SM103J1K from US Sensor has a resistance of 10 kohms at 220 deg C. You have to be careful with circuit layout and perhaps shielding too. This would require a lookup table for conversion of RCTIME result to temperature, so it is not super simple with respect to programming.

    As a thermocouple conditioner, the MAX6675 is much easier to use than the DS2760. It is a direct to digital 8=pin soic, 0 to 1024 deg C, resolution 0.25 deg C, with cold junction compensation built in.
    MAX667xa.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.