Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Thermocouple Macros

Introduction:

Temperature measurements using thermocouples must correct for their inherent nonlinearities. Daqarta provides three different approaches: If you use a Thermocouple To Frequency conversion circuit, you can load thermocouple table .TBL files (via the Fcal option of the Frequency Counter) that are automatically interpolated to provide a large resizeable temperature readout.

Alternatively, you can use a "chopper" circuit such as the External DC-to-AC Modulator to convert DC voltage from thermocouple outputs into AC to pass the sound card's AC-only input stage. You'd then use the Demodulate option in Decimate mode to convert back to DC data, which can be manipulated by macros to provide Custom Meter displays, a Chart Recorder, data logging, or perhaps a temperature controller application.

Finally, you can use an inexpensive Arduino or Numato board to read up to 6 input channels, but note that these only have 10-bit resolution and will need external gain. The DC_Chart_Recorder macro mini-app can be modified to use the thermocouple macros to allow direct temperature recording.

The frequency counter method has a simple circuit that already includes the needed cold junction compensation. The chopper/modulator needs to have that compensation added to its more-complex circuit. You can do that by using the input portion of the Thermocouple To Frequency circuit, up to just before it connects to pin 7 of the LM331 chip. The Arduino/Numato approach also needs compensation, but you can use the LM335 precision temperature sensor directly to drive one of the analog inputs to compensate the remaining 5 channels.

The chopper approach has the advantage that it can handle simultaneous measurements on both sound card input channels, whereas the frequency counter only works with a single channel. The Arduino/Numato method can handle more channels, but requires more construction since it needs to provide gain.

With the chopper and Arduino/Numato methods you need to correct for the inherent thermocouple nonlinearity, but instead of tables your macros (or modifications to DC_Chart_Recorder) can call the included macros to provide the correction. These directly solve the high-order polynomial thermocouple equations given in the ITS-90 (International Temperature Scale of 1990) document provided by the US National Institute of Science and Technology (NIST).

The thermocouple macros take an input in user variable E, which must be in mV, and return variable C holding degrees Celsius. See Macro Data Unit Conversions to convert from raw sound card input to volts, then divide by 1000 to get mV. With that value in E, call the macro for the type of thermocouple you are using. For type K you'd use @_TC_Type_K, for example.

You can convert to degrees Fahrenheit F via:

    F=1.8 * C + 32

The macro listings appear below. Each starts with a comment line giving the intended temperature range. Note that some types have more-limited ranges than the .TBL files. For example, the _TC_Type_B macro is limited to temperatures above 250 degrees C, whereas the corresponding B_TypeTC.TBL file goes down to 0. This is because the .TBL files use the "forward" (mV verus temperature) equations given in ITS-90, whereas these macros use the "inverse" (temperature versus mV) equations given there. For some reason, those are more limited.


_TC_Type_B Macro Listing:

;<Help=H491D
;For E = 0.291 to 13.820 mV, C = 250 to 1820 degC
;Error = -0.02 to 0.03 degC


IF.E=<2.431
    C=9.8423321e1 +6.9971500e2*E -8.4765304e2*E^2
    C=C +8.4765304e3*E^3 -8.3345952e2*E^4 +4.5508542e2*E^5
    C=C -1.5523037e2*E^6 +2.9886750e1*E^7 -2.4742860*E^8
ELSE.
    C=2.1315071e2 +2.8510504e2*E -5.2742887e1*E^2
    C=C +9.9160804*E^3 -1.2965303*E^4 +1.1195870e-1*E^5
    C=C -6.0625199e-3*E^6 +1.8661696e-4*E^7 -2.4878585e-6*E^8
ENDIF.


_TC_Type_E Macro Listing:

;<Help=H491D
;For E = -8.825 to 76.373 mV, C = -200 to +1000 degC
;Error = -0.02 to +0.03 degC


IF.E=<0
    C=1.6977288e1*E -4.3514970e-1*E^2 -1.5859697e-1*E^3
    C=C -9.2502871e-2*E^4 -2.6084314e-2*E^5 -4.1360199e-3*E^6
    C=C -3.4034030e-4*E^7 -1.1564890e-5*E^8
ELSE.
    C=1.7057035e1*E -2.3301759e-1*E^2 +6.5435585e-3*E^3
    C=C -7.3562749e-5*E^4 -1.7896001e-6*E^5 +8.4036165e-8*E^6
    C=C -1.3735879e-9*E^7 +1.0629823e-11*E^8 -3.2447087e-14*E^9
ENDIF.


_TC_Type_J Macro Listing:

;<Help=H491D
;For E = -8.0975 to 69.553 mV, C = -210 to 1200 degC
;Error = -0.05 to +0.04 degC


IF.E=<0
    C=1.9528268e1*E -1.2286185*E^2
    C=C -1.0752178*E^3 -5.9086933e-1*E^4 -1.7256713e-1*E^5
    C=C -2.8131513e-2*E^6 -2.3963370e-3*E^7 -8.3823321e-5*E^8
ELSE.
    IF.E=<42.919
        C=1.978425e1*E -2.001204e-1*E^2
        C=C +1.036969e-2*E^3 -2.549687e-4*E^4 +3.585153e-6*E^5
        C=C -5.344285e-8*E^6 +5.099890e-10*E^7
    ELSE.
        C=-3.11358187e3 +3.00543684e2*E -9.94773230*E^2
        C=C +1.70276630e-1*E^3 -1.43033468e-3*E^4 +4.73886084e-6*E^5
    ENDIF.
ENDIF.


_TC_Type_K Macro Listing:

;<Help=H491D
;For E = -5.891 to 54.886 mV, C = -200 to 1372 degC
;Error = -0.05 to 0.06 deg C


IF.E=<0
    C=2.5173462e1*E -1.1662878*E^2 -1.0833638*E^3
    C=C -8.9773540e-1*E^4 -3.7342377e-1*E^5 -8.6632643e-2*E^6
    C=C -1.0450598e-2*E^7 -5.1920577e-4*E^8
ELSE.
    IF.E=<20.644
        C=2.508355e1*E +7.860106e-2*E^2 -2.503131e-1*E^3
        C=C +8.315270e-2*E^4 -1.228034e-2*E^5 + 9.804036e-4*E^6
        C=C -4.413030e-5*E^7 +1.057734e-6*E^8 -1.052755e-8*E^9
    ELSE.
        C=-1.318058e2 +4.830222e1*E -1.646031*E^2
        C=C +5.464731e-2*E^3 -9.650715e-4*E^4 +8.802193e-6*E^5
        C=C -3.110810e-8*E^6
    ENDIF.
ENDIF.


_TC_Type_N Macro Listing:

;<Help=H491D
;For E = -3.990 to 47.513 mV, C = -200 to 1300 degC
;Error = -0.04 to 0.03


IF.E=<0
    C=3.8436847e1*E +1.1010485*E^2 +5.2229312*E^3
    C=C +7.2060525*E^4 +5.8488586*E^5 +2.7754916*E^6
    C=C +7.7075166e-1*E^7 +1.1582665e-1*E^8 +7.3138868e-3*E^9
ELSE.
    IF.E=<20.613
        C=3.86896e1*E -1.08267*E^2 +4.70205e-2*E^3
        C=C -2.12169e-6*E^4 -1.17272e-4*E^5 +5.39280e-6*E^6
        C=C -7.98156e-8*E^7
    ELSE.
        C=1.972485e1 +3.300943e1*E -3.915159e-1*E^2
        C=C +9.855391e-3*E^3 -1.274371e-4*E^4 +7.767022e-7*E^5
    ENDIF.
ENDIF.


_TC_Type_R Macro Listing:

;<Help=H491D
;For E = -0.226 to 21.103 mV, C = -50 to 1768.1 degC
;Error = +/-0.02 below 250 degC, +/-0.005 above


IF.E=<11.361
    IF.E=<1.923
        C=1.8891380e2*E -9.3835290e1*E^2 +1.3068619e2*E^3 -2.2703580e2*E^4
        C=C +3.5145659e2*E^5 -3.8953900e2*E^6 +2.8239471e2*E^7
        C=C -1.2607281e2*E^8 +3.1353611e1*E^9 -3.3187769*E^10
    ELSE.
        C=1.334584505e1 +1.472644573e2*E -1.844024844e1*E^2 +4.031129726*E^3
        C=C -6.249428360e-1*E^4 +6.468412046e-2*E^5 -4.458750426e-3*E^6
        C=C +1.994710149e-4*E^7 -5.313401790e-6*E^8 +6.481976217e-8*E^9
    ENDIF.
ELSE.
    IF.E=<19.739
        C=-8.199599416e1 +1.553962042e2*E -8.342197663e*E^2
        C=C +4.279433549e-1*E^3 -1.191577910e-2*E^4 +1.492290091e-4*E^5
    ELSE.
        C=3.406177836e4 -7.023729171e3*E +5.582903813e2*E^2
        C=C -1.952394635e1*E^3 +2.560740231e-1*E^4
    ENDIF.
ENDIF.


_TC_Type_S Macro Listing:

;<Help=H491D
;For E = -0.235 to 18.693 mV, C = -50 to 1768.1 degC
;Error = +/-0.02 below 1064 degC, +/-0.002 above


IF.E=<10.332
    IF.E=<1.874
        C=1.84949460e2*E -8.00504062e1*E^2 +1.02237430e2*E^3
        C=C -1.52248592e2*E^4 +1.88821343e2*E^5 -1.59085941e2*E^6
        C=C +8.23027880e1*E^7 -2.34181944e1*E^8 +2.79786260*E^9
    ELSE.
        C=1.291507177e1 +1.466298863e2*E -1.534713402e1*E^2 +3.145945973*E^3
        C=C -4.163257839e-1*E^4 +3.187963771e-2*E^5 -1.291637500e-3*E^6
        C=C +2.183475087e-5*E^7 -1.447379511e-7*E^8 +8.211272125e-9*E^9
    ENDIF.
ELSE.
    IF.E=<17.536
        C=-8.087801117e1 +1.621573104e2*E -8.536869453*E^2
        C=C +4.719686976e-1*E^3 -1.441693666e-2*E^4 +2.081618890e-4*E^5
    ELSE.
        C=5.333875126e4 -1.235892298e4*E +1.092657613e3*E^2
        C=C -4.265693686e1*E^3 +6.247205420e-1*E^4
    ENDIF.
ENDIF.


_TC_Type_T Macro Listing:

;<Help=H491D
;For E = -5.603 to 20.872 mV, C = -200 to 400 degC
;Error = -0.03 to +0.04 degC


IF.E=<0
    C=2.5949192e1*E -2.1316967e-1*E^2 +7.9018692e-1*E^3
    C=C +4.2527777e-1*E^4 +1.3304473e-1*E^5
    C=C +2.0241446e-2*E^6 +1.2668171e-3*E^7
ELSE.
    C= 2.592800e+1*E -7.602961e-1*E^2 +4.637791e-2*E^3
    C=C -2.165394e-3*E^4 +6.048144e-5*E^5 -7.293422e-7*E^6
ENDIF.


See also Macro Examples and Mini-Apps

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved